1
0
mirror of https://github.com/flarum/core.git synced 2025-08-07 00:47:00 +02:00

Change API to use PSR-7 style requests and responses

This required some interface changes (mostly changing Laravel's or
Symfony's request and response classes to those of Zend's Diactoros.
Some smaller changes to the execution flow in a few of the abstract
action base classes, but nothing substantial.

Note: The request and response classes are immutable, so we usually
need to return new instances after modifying the old ones.
This commit is contained in:
Franz Liedke
2015-05-27 00:29:31 +02:00
parent 910d96f905
commit 3ff230dc26
32 changed files with 264 additions and 323 deletions

View File

@@ -3,8 +3,8 @@
use Flarum\Core\Commands\EditPostCommand;
use Flarum\Api\Actions\SerializeResourceAction;
use Flarum\Api\JsonApiRequest;
use Flarum\Api\JsonApiResponse;
use Illuminate\Contracts\Bus\Dispatcher;
use Tobscure\JsonApi\Document;
class UpdateAction extends SerializeResourceAction
{
@@ -35,10 +35,10 @@ class UpdateAction extends SerializeResourceAction
* ready to be serialized and assigned to the JsonApi response.
*
* @param \Flarum\Api\JsonApiRequest $request
* @param \Flarum\Api\JsonApiResponse $response
* @return \Flarum\Core\Models\Post
* @param \Tobscure\JsonApi\Document $document
* @return \Illuminate\Database\Eloquent\Collection
*/
protected function data(JsonApiRequest $request, JsonApiResponse $response)
protected function data(JsonApiRequest $request, Document $document)
{
return $this->bus->dispatch(
new EditPostCommand($request->get('id'), $request->actor->getUser(), $request->get('data'))