|
| 1 | +<?php |
| 2 | + |
| 3 | +/* |
| 4 | + * This file is part of the API Platform project. |
| 5 | + * |
| 6 | + * (c) Kévin Dunglas <[email protected]> |
| 7 | + * |
| 8 | + * For the full copyright and license information, please view the LICENSE |
| 9 | + * file that was distributed with this source code. |
| 10 | + */ |
| 11 | + |
| 12 | +declare(strict_types=1); |
| 13 | + |
| 14 | +namespace ApiPlatform\Tests\Fixtures\TestBundle\Entity; |
| 15 | + |
| 16 | +use ApiPlatform\Core\Annotation\ApiFilter; |
| 17 | +use ApiPlatform\Core\Annotation\ApiProperty; |
| 18 | +use ApiPlatform\Core\Annotation\ApiResource; |
| 19 | +use ApiPlatform\Core\Annotation\ApiSubresource; |
| 20 | +use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\DateFilter; |
| 21 | +use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\ExistsFilter; |
| 22 | +use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter; |
| 23 | +use Doctrine\ORM\Mapping as ORM; |
| 24 | +use Symfony\Component\Serializer\Annotation\Groups; |
| 25 | + |
| 26 | +/** |
| 27 | + * @ORM\Entity |
| 28 | + * |
| 29 | + * @ApiResource |
| 30 | + * |
| 31 | + * @ApiFilter(SearchFilter::class, properties={"id"}) |
| 32 | + */ |
| 33 | +class DummyToUpgradeWithOnlyAnnotation |
| 34 | +{ |
| 35 | + /** |
| 36 | + * @var int |
| 37 | + * |
| 38 | + * @ORM\Id |
| 39 | + * @ORM\GeneratedValue |
| 40 | + * @ORM\Column(type="integer") |
| 41 | + * @Groups({"chicago", "friends"}) |
| 42 | + * @ApiProperty(writable=false) |
| 43 | + * @ApiFilter(DateFilter::class) |
| 44 | + */ |
| 45 | + private $id; |
| 46 | + |
| 47 | + /** |
| 48 | + * @var DummyToUpgradeProduct |
| 49 | + * |
| 50 | + * @ORM\ManyToOne(targetEntity="DummyToUpgradeProduct", cascade={"persist"}, inversedBy="dummysToUpgradeWithOnlyAnnotation") |
| 51 | + * @ORM\JoinColumn(nullable=false) |
| 52 | + * @Groups({"barcelona", "chicago", "friends"}) |
| 53 | + * |
| 54 | + * @ApiSubresource |
| 55 | + * |
| 56 | + * @ApiProperty(iri="DummyToUpgradeWithOnlyAnnotation.dummyToUpgradeProduct") |
| 57 | + * @ApiFilter(SearchFilter::class) |
| 58 | + * @ApiFilter(ExistsFilter::class) |
| 59 | + */ |
| 60 | + private $dummyToUpgradeProduct; |
| 61 | +} |
0 commit comments