-
-
Notifications
You must be signed in to change notification settings - Fork 894
/
Copy pathMaxDepthEagerDummy.php
48 lines (42 loc) · 1.19 KB
/
MaxDepthEagerDummy.php
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
44
45
46
47
48
<?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\Entity;
use ApiPlatform\Metadata\ApiResource;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Serializer\Annotation\MaxDepth;
/**
* *
*
*
* @author Brian Fox <brian@brianfox.fr>
*/
#[ApiResource(normalizationContext: ['groups' => ['default'], 'enable_max_depth' => true], denormalizationContext: ['groups' => ['default'], 'enable_max_depth' => true])]
#[ORM\Entity]
class MaxDepthEagerDummy
{
#[ORM\Column(type: 'integer')]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'AUTO')]
#[Groups(['default'])]
private $id;
#[ORM\Column(name: 'name', type: 'string', length: 30)]
#[Groups(['default'])]
public $name;
#[ORM\ManyToOne(targetEntity: self::class, cascade: ['persist'])]
#[Groups(['default'])]
#[MaxDepth(1)]
public $child;
public function getId()
{
return $this->id;
}
}