src/Entity/LandingPageBlock.php line 49

  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use ApiPlatform\Metadata\ApiResource,
  5.     ApiPlatform\Metadata\Get,
  6.     ApiPlatform\Metadata\GetCollection,
  7.     ApiPlatform\Metadata\Post,
  8.     ApiPlatform\Metadata\Put,
  9.     ApiPlatform\Metadata\Delete,
  10.     ApiPlatform\Metadata\ApiFilter,
  11.     ApiPlatform\Doctrine\Orm\Filter\OrderFilter;
  12. use App\Doctrine\Attribute\TargetEntity,
  13.     App\Repository\LandingPageBlockRepository;
  14. use App\Enum\BlockType,
  15.     App\Filter\IriFilter;
  16. #[ApiResource(
  17.     description'Landing page blocks',
  18.     normalizationContext: ['groups' => [
  19.         'read',
  20.         'read:' self::class,
  21.         'read:' self::class . 'Translation',
  22.         'read:' AbstractThumb::class,
  23.         'read:' AbstractBlock::class,
  24.         'read:' AbstractBlockTranslation::class,
  25.         'read:' AbstractBlockTranslationLogo::class,
  26.         'read:' AbstractBlockTranslationFile::class
  27.     ]],
  28.     denormalizationContext: ['groups' => ['write']],
  29.     security'is_granted("' Page::class . '")',
  30.     order: ['ord' => 'desc'],
  31.     operations: [
  32.         new GetCollection(),
  33.         new Post(denormalizationContext: ['groups' => ['write',  'post']]),
  34.         new Get(),
  35.         new Put(),
  36.         new Delete(),
  37.     ],
  38.     extraProperties: ['standard_put' => false],
  39. )]
  40. #[ApiFilter(IriFilter::class, properties: ['parent'])]
  41. #[ApiFilter(OrderFilter::class, properties: ['ord'])]
  42. #[TargetEntity(mappings: ['parent' => LandingPage::class])]
  43. #[ORM\Entity(repositoryClassLandingPageBlockRepository::class)]
  44. class LandingPageBlock extends AbstractBlock
  45. {
  46.     public function __construct(LandingPage $parentBlockType $type)
  47.     {
  48.         parent::__construct($parent$type);
  49.     }
  50. }