src/Entity/ExclusionsVideo.php line 53

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Core\Annotation\ApiFilter;
  4. use ApiPlatform\Core\Annotation\ApiResource;
  5. use ApiPlatform\Core\Serializer\Filter\PropertyFilter;
  6. use ApiPlatform\Core\Serializer\Filter\GroupFilter;
  7. use App\Repository\ExclusionsVideoRepository;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use Gedmo\Mapping\Annotation as Gedmo;
  10. use Symfony\Component\Serializer\Annotation\Groups;
  11. use Symfony\Component\Validator\Constraints as Assert;
  12. /**
  13.  * @ORM\Entity(repositoryClass=ExclusionsVideoRepository::class)
  14.  * @ApiResource(
  15.  *      normalizationContext={
  16.  *          "groups"={"exclusion_video:read"}
  17.  *      },
  18.  *      denormalizationContext={
  19.  *          "groups"={"exclusion_video:write"}
  20.  *      },
  21.  *      collectionOperations={
  22.  *          "get"={
  23.  *              "security"="is_granted('ROLE_ADMIN')"
  24.  *          }, 
  25.  *          "post"={
  26.  *              "security"="is_granted('ROLE_ADMIN')"
  27.  *          }
  28.  *      },
  29.  *      itemOperations={
  30.  *          "get"={
  31.  *              "security"="is_granted('ROLE_ADMIN')"
  32.  *          }, 
  33.  *          "delete"={
  34.  *              "security"="is_granted('ROLE_ADMIN')"
  35.  *          }
  36.  *      }
  37.  * )
  38.  * @ApiFilter(GroupFilter::class, 
  39.  *      arguments={
  40.  *          "overrideDefaultGroups": true
  41.  *      }
  42.  * )
  43.  * @ApiFilter(PropertyFilter::class, 
  44.  *      arguments={
  45.  *          "parameterName"="fields", 
  46.  *          "overrideDefaultProperties"=true
  47.  *     }
  48.  * )
  49.  */
  50. class ExclusionsVideo
  51. {
  52.     /**
  53.      * @ORM\Id
  54.      * @ORM\GeneratedValue
  55.      * @ORM\Column(type="integer")
  56.      * @Groups({"exclusion_video:read", "exclusion_video:read:id"})
  57.      */
  58.     private $id;
  59.     /**
  60.      * @ORM\ManyToOne(targetEntity=TvCompany::class, inversedBy="exclusionsVideos")
  61.      * @ORM\JoinColumn(nullable=true)
  62.      */
  63.     private $tvCompany;
  64.     /**
  65.      * @ORM\ManyToOne(targetEntity=Company::class, inversedBy="exclusionsVideos")
  66.      * @ORM\JoinColumn(nullable=true)
  67.      * @Assert\NotNull
  68.      * @Groups({"exclusion_video:write", "exclusion_video:read:company", "exclusion_video:read", "video:write", "video:read", "video_form_complete"})
  69.      */
  70.     private $company;
  71.     /**
  72.      * @ORM\ManyToOne(targetEntity=Video::class, inversedBy="exclusionsVideos")
  73.      * @ORM\JoinColumn(nullable=false)
  74.      * @Groups({"exclusion_video:write", "exclusion_video:read:video", "exclusion_video:read"})
  75.      */
  76.     private $video;
  77.     /**
  78.      * @ORM\Column(type="datetime")
  79.      * @Gedmo\Timestampable(on="create")
  80.      * @Groups({"exclusion_video:read", "exclusion_video:write", "exclusion_video:read:createdAt", "video:write"})
  81.      */
  82.     private $createdAt;
  83.     public function getId(): ?int
  84.     {
  85.         return $this->id;
  86.     }
  87.     public function getTvCompany(): ?TvCompany
  88.     {
  89.         return $this->tvCompany;
  90.     }
  91.     public function setTvCompany(?TvCompany $tvCompany): self
  92.     {
  93.         $this->tvCompany $tvCompany;
  94.         return $this;
  95.     }
  96.     public function getCompany(): ?Company
  97.     {
  98.         return $this->company;
  99.     }
  100.     public function setCompany(?Company $company): self
  101.     {
  102.         $this->company $company;
  103.         return $this;
  104.     }
  105.     public function getVideo(): ?Video
  106.     {
  107.         return $this->video;
  108.     }
  109.     public function setVideo(?Video $video): self
  110.     {
  111.         $this->video $video;
  112.         return $this;
  113.     }
  114.     public function getCreatedAt(): ?\DateTimeInterface
  115.     {
  116.         return $this->createdAt;
  117.     }
  118.     public function setCreatedAt(\DateTimeInterface $createdAt): self
  119.     {
  120.         $this->createdAt $createdAt;
  121.         return $this;
  122.     }
  123. }