src/Entity/Author.php line 42

  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. use App\Repository\AuthorRepository,
  11.     App\Security\Voter\ArchivableVoter,
  12.     App\Lib\Actions;
  13. #[ApiResource(
  14.     description'Authors',
  15.     normalizationContext: ['groups' => [
  16.         'read',
  17.         'read:' self::class,
  18.         'read:' self::class . 'Translation',
  19.         'read:' AbstractAuthor::class,
  20.         'read:' AbstractAuthor::class . 'Translation'
  21.     ]],
  22.     denormalizationContext: ['groups' => ['write']],
  23.     security'is_granted("' self::class . '")',
  24.     order: ['ord' => 'desc'],
  25.     operations: [
  26.         new GetCollection(),
  27.         new Post(),
  28.         new Get(),
  29.         new Put(),
  30.         new Delete(
  31.             securityPostDenormalize'is_granted("' Actions::DELETE '", object)',
  32.             securityPostDenormalizeMessageArchivableVoter::MESSAGE
  33.         ),
  34.     ],
  35.     extraProperties: ['standard_put' => false],
  36. )]
  37. #[ORM\Entity(repositoryClassAuthorRepository::class)]
  38. class Author extends AbstractAuthor
  39. {
  40.     public function getType(): string
  41.     {
  42.         return 'author';
  43.     }
  44. }