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
34
35
36
37
38
39
40
41
42
|
<?php
namespace JsonApi\Schemas;
use Neomerx\JsonApi\Contracts\Schema\ContextInterface;
use JsonApi\Schemas\SchemaProvider;
class Datafield extends SchemaProvider
{
const TYPE = 'datafield';
public function getId($datafield): ?string
{
return $datafield->getId();
}
public function getAttributes($datafield, ContextInterface $context): iterable
{
return [
'name' => (string) $datafield->name,
'object_type' => $datafield->object_type,
'object_class' => $datafield->object_class,
'institut_id' => $datafield->institut_id,
'priority' => $datafield->priority,
'type' => $datafield->type,
'typeparam' => $datafield->typeparam,
'is_required' => (bool) $datafield->is_required,
'default_value' => $datafield->default_value,
'is_userfilter' => (bool) $datafield->is_userfilter,
'mkdate' => date('c', $datafield->mkdate),
'chdate' => date('c', $datafield->chdate)
];
}
/**
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function getRelationships($datafield, ContextInterface $context): iterable
{
return [];
}
}
|