aboutsummaryrefslogtreecommitdiff
path: root/lib/classes/JsonApi/Schemas/BlubberStatusgruppeThread.php
blob: 76651e4af7e4058adf148bc0cfefdf92a3fd7455 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php

namespace JsonApi\Schemas;

use JsonApi\Errors\InternalServerError;
use Neomerx\JsonApi\Contracts\Schema\ContextInterface;
use Neomerx\JsonApi\Schema\Link;

class BlubberStatusgruppeThread extends BlubberThread
{
    const REL_STATUSGRUPPE = 'group';

    /**
     * In dieser Methode können Relationships zu anderen Objekten
     * spezifiziert werden.
     * {@inheritdoc}
     */
    public function getRelationships($resource, ContextInterface $context): iterable
    {
        $relationships = parent::getRelationships($resource, $context);

        $relationships[self::REL_STATUSGRUPPE] = [
            self::RELATIONSHIP_DATA => \Statusgruppen::build(
                [
                    'statusgruppe_id' => $resource['metadata']['statusgruppe_id']
                ],
                false
            )
        ];

        return $relationships;
    }
}