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

Upgrade to JSON-API RC3 + latest version of tobscure/json-api

Note: npm source for ember-json-api changed to a fork, but I still had
to apply a custom change to get polymorphic relationships to work (see
https://github.com/kurko/ember-json-api/pull/71#issuecomment-85257281)
This commit is contained in:
Toby Zerner
2015-03-24 15:04:24 +10:30
parent 536281e273
commit a62e04f956
36 changed files with 342 additions and 503 deletions

View File

@@ -20,14 +20,14 @@ class UpdateAction extends BaseAction
// updates (i.e. if we were to run one command and then another, if the
// second one failed, the first one would still have succeeded.)
$command = new EditPostCommand($postId, $this->actor->getUser());
$this->hydrate($command, $params->get('posts'));
$this->hydrate($command, $params->get('data'));
$post = $this->dispatch($command, $params);
// Presumably, the post was updated successfully. (The command handler
// would have thrown an exception if not.) We set this post as our
// document's primary element.
$serializer = new PostSerializer;
$document = $this->document()->setPrimaryElement($serializer->resource($post));
$document = $this->document()->setData($serializer->resource($post));
return $this->respondWithDocument($document);
}