1
0
mirror of https://github.com/flarum/core.git synced 2025-10-17 01:36:09 +02:00

Update for new tobscure/json-api relationship handling

This commit is contained in:
Toby Zerner
2015-10-30 11:03:38 +10:30
parent e1315d27a4
commit 95e3ff8fa8
13 changed files with 165 additions and 219 deletions

View File

@@ -51,27 +51,27 @@ class NotificationSerializer extends AbstractSerializer
}
/**
* @return \Flarum\Api\Relationship\HasOneBuilder
* @return \Tobscure\JsonApi\Relationship
*/
protected function user()
protected function user($notification)
{
return $this->hasOne('Flarum\Api\Serializer\UserBasicSerializer');
return $this->hasOne($notification, 'Flarum\Api\Serializer\UserBasicSerializer');
}
/**
* @return \Flarum\Api\Relationship\HasOneBuilder
* @return \Tobscure\JsonApi\Relationship
*/
protected function sender()
protected function sender($notification)
{
return $this->hasOne('Flarum\Api\Serializer\UserBasicSerializer');
return $this->hasOne($notification, 'Flarum\Api\Serializer\UserBasicSerializer');
}
/**
* @return \Flarum\Api\Relationship\HasOneBuilder
* @return \Tobscure\JsonApi\Relationship
*/
protected function subject()
protected function subject($notification)
{
return $this->hasOne(function ($notification) {
return $this->hasOne($notification, function ($notification) {
return static::$subjectSerializers[$notification->type];
});
}