Projekt

Allgemein

Profil

GX-Task #65345

Von Mirko Janssen vor etwa 3 Jahren aktualisiert

In the upcoming feature release der kommenden Feature Version GX v4.1 there will be an update of the v3.17 erfolgt eine Aktualisierung der [Slim](http://www.slimframework.com/) dependency from Dependency von v2 to auf v4. This update brings breaking changes regarding the Diese Umstellung bringt einige Breaking Changes bzgl. der REST API v2. v2 mit sich. 

 The `AbstractApiV2Controller` class will from then on no longer contain an Die **AbstractApiV2Controller** Klasse wird ab dann kein Attribute `api` attribute of type `\Slim\Slim`, but the two attributes des Types `\Slim\Slim` mehr enthalten, sondern die beiden Attribute `request` of type vom Typ `Slim\Http\ServerRequest` and und `response` of type vom Typ `Slim\Http\Response`. 
 Overloads or controllers that used the oder Controller, welche das `api` attribute must be modified accordingly. Attribute benutzt haben, müssen entsprechend angepasst werden. 

 The following code examples show how such a customization might look like. 

 Before: Folgende Codebeispiele zeigen, wie eine solche Anpassung aussehen könnte. Vorher: 
 ``` 
         $this->api->response->setStatus(200); 
         $this->api->response->headers->set('Content-Type', 'application/json; charset=utf-8'); 
         $this->api->response->headers->set('X-Shop-Version', $shopVersion); 
 ``` 

 After: 

 
 Nachher: 
 ``` 
         $this->response = $this->response->withStatus(200); 
         $this->response = $this->response->withHeader('Content-Type', 'application/json; charset=utf-8'); 
         $this->response = $this->response->withHeader('X-Shop-Version', $shopVersion); 
 ```

Zurück