src/Entity/Redactor.php line 44

  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Metadata\ApiProperty;
  4. use Doctrine\DBAL\Types\Types;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use ApiPlatform\Metadata\ApiResource,
  7.     ApiPlatform\Metadata\Get,
  8.     ApiPlatform\Metadata\GetCollection,
  9.     ApiPlatform\Metadata\Post,
  10.     ApiPlatform\Metadata\Put,
  11.     ApiPlatform\Metadata\Delete;
  12. use App\Repository\RedactorRepository,
  13.     App\Security\Voter\ArchivableVoter,
  14.     App\Lib\Actions;
  15. #[ApiResource(
  16.     description'Redactors',
  17.     normalizationContext: ['groups' => [
  18.         'read',
  19.         'read:' self::class,
  20.         'read:' self::class . 'Translation',
  21.         'read:' AbstractAuthor::class,
  22.         'read:' AbstractAuthor::class . 'Translation'
  23.     ]],
  24.     denormalizationContext: ['groups' => ['write']],
  25.     security'is_granted("' self::class . '")',
  26.     order: ['ord' => 'desc'],
  27.     operations: [
  28.         new GetCollection(),
  29.         new Post(),
  30.         new Get(),
  31.         new Put(),
  32.         new Delete(
  33.             securityPostDenormalize'is_granted("' Actions::DELETE '", object)',
  34.             securityPostDenormalizeMessageArchivableVoter::MESSAGE
  35.         ),
  36.     ],
  37.     extraProperties: ['standard_put' => false],
  38. )]
  39. #[ORM\Entity(repositoryClassRedactorRepository::class)]
  40. class Redactor extends AbstractAuthor
  41. {
  42.     #[ApiProperty(description'Import id of employee from old database')]
  43.     #[ORM\Column(typeTypes::INTEGERnullabletrue)]
  44.     protected ?int $importEmployeeId null;
  45.     public function getImportEmployeeId(): ?int
  46.     {
  47.         return $this->importEmployeeId;
  48.     }
  49.     public function setImportEmployeeId(?int $importEmployeeId): self
  50.     {
  51.         $this->importEmployeeId $importEmployeeId;
  52.         return $this;
  53.     }
  54.     public function getType(): string
  55.     {
  56.         return 'redactor';
  57.     }
  58. }