src/Domain/Entity/ArticleLocale.php line 29

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Domain\Entity;
  4. use ApiPlatform\Metadata\ApiResource;
  5. use ApiPlatform\Metadata\Delete;
  6. use ApiPlatform\Metadata\Get;
  7. use ApiPlatform\Metadata\GetCollection;
  8. use ApiPlatform\Metadata\Post;
  9. use ApiPlatform\Metadata\Put;
  10. use App\Domain\Entity\Behavior\Identifiable;
  11. use Gedmo\SoftDeleteable\Traits\SoftDeleteable;
  12. use Gedmo\Timestampable\Traits\Timestampable;
  13. #[ApiResource(
  14.     operations: [
  15.         new Delete(security"is_granted('ROLE_ADMIN')"),
  16.         new GetCollection(),
  17.         new Get(),
  18.         new Post(security"is_granted('ROLE_ADMIN')"),
  19.         new Put(security"is_granted('ROLE_ADMIN')"),
  20.     ],
  21.     normalizationContext: ['groups' => ['article_locale_read']],
  22.     denormalizationContext: ['groups' => ['article_locale_write']],
  23.     filters: ['translation.groups'],
  24. )]
  25. class ArticleLocale
  26. {
  27.     use Identifiable;
  28.     use SoftDeleteable;
  29.     use Timestampable;
  30.     private ?Article $article null;
  31.     private ?Locale $locale null;
  32.     private ?string $url null;
  33.     public function __construct() {}
  34.     public function getArticle(): Article
  35.     {
  36.         return $this->article;
  37.     }
  38.     public function setArticle(Article $article): self
  39.     {
  40.         $this->article $article;
  41.         return $this;
  42.     }
  43.     public function getLocale(): Locale
  44.     {
  45.         return $this->locale;
  46.     }
  47.     public function setLocale(Locale $locale): self
  48.     {
  49.         $this->locale $locale;
  50.         return $this;
  51.     }
  52.     public function getUrl(): string
  53.     {
  54.         return $this->url;
  55.     }
  56.     public function setUrl(string $url): self
  57.     {
  58.         $this->url $url;
  59.         return $this;
  60.     }
  61. }