src/Entity/Author.php line 42
<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use ApiPlatform\Metadata\ApiResource,
ApiPlatform\Metadata\Get,
ApiPlatform\Metadata\GetCollection,
ApiPlatform\Metadata\Post,
ApiPlatform\Metadata\Put,
ApiPlatform\Metadata\Delete;
use App\Repository\AuthorRepository,
App\Security\Voter\ArchivableVoter,
App\Lib\Actions;
#[ApiResource(
description: 'Authors',
normalizationContext: ['groups' => [
'read',
'read:' . self::class,
'read:' . self::class . 'Translation',
'read:' . AbstractAuthor::class,
'read:' . AbstractAuthor::class . 'Translation'
]],
denormalizationContext: ['groups' => ['write']],
security: 'is_granted("' . self::class . '")',
order: ['ord' => 'desc'],
operations: [
new GetCollection(),
new Post(),
new Get(),
new Put(),
new Delete(
securityPostDenormalize: 'is_granted("' . Actions::DELETE . '", object)',
securityPostDenormalizeMessage: ArchivableVoter::MESSAGE
),
],
extraProperties: ['standard_put' => false],
)]
#[ORM\Entity(repositoryClass: AuthorRepository::class)]
class Author extends AbstractAuthor
{
public function getType(): string
{
return 'author';
}
}