forked from api-platform/core
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGenIdDefault.php
More file actions
43 lines (37 loc) · 1.13 KB
/
GenIdDefault.php
File metadata and controls
43 lines (37 loc) · 1.13 KB
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
43
<?php
/*
* This file is part of the API Platform project.
*
* (c) Kévin Dunglas <dunglas@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace ApiPlatform\Tests\Fixtures\TestBundle\ApiResource\GenIdFalse;
use ApiPlatform\Metadata\ApiProperty;
use ApiPlatform\Metadata\Get;
use ApiPlatform\Metadata\Operation;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
#[Get(uriTemplate: '/gen_id_default', provider: [self::class, 'getData'], normalizationContext: ['hydra_prefix' => false])]
class GenIdDefault
{
public function __construct(
public string $id,
#[ApiProperty] public Collection $subresources,
) {
}
public static function getData(Operation $operation, array $uriVariables = [], array $context = []): self
{
return new self(
'1',
new ArrayCollection(
[
new Subresource('foo'),
new Subresource('bar'),
]
)
);
}
}