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

@ -18,8 +18,8 @@ class CreateAction extends BaseAction
// By default, the only required attributes of a discussion are the
// title and the content. We'll extract these from the rbaseequest data
// and pass them through to the StartDiscussionCommand.
$title = $params->get('discussions.title');
$content = $params->get('discussions.content');
$title = $params->get('data.title');
$content = $params->get('data.content');
$user = $this->actor->getUser();
$command = new StartDiscussionCommand($title, $content, $user, app('flarum.forum'));
@ -34,7 +34,7 @@ class CreateAction extends BaseAction
}
$serializer = new DiscussionSerializer(['posts']);
$document = $this->document()->setPrimaryElement($serializer->resource($discussion));
$document = $this->document()->setData($serializer->resource($discussion));
return $this->respondWithDocument($document);
}