<?php
namespace App\Entity;
use ApiPlatform\Core\Annotation\ApiFilter;
use ApiPlatform\Core\Annotation\ApiResource;
use ApiPlatform\Core\Serializer\Filter\PropertyFilter;
use ApiPlatform\Core\Serializer\Filter\GroupFilter;
use App\Repository\ExclusionsVideoRepository;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity(repositoryClass=ExclusionsVideoRepository::class)
* @ApiResource(
* normalizationContext={
* "groups"={"exclusion_video:read"}
* },
* denormalizationContext={
* "groups"={"exclusion_video:write"}
* },
* collectionOperations={
* "get"={
* "security"="is_granted('ROLE_ADMIN')"
* },
* "post"={
* "security"="is_granted('ROLE_ADMIN')"
* }
* },
* itemOperations={
* "get"={
* "security"="is_granted('ROLE_ADMIN')"
* },
* "delete"={
* "security"="is_granted('ROLE_ADMIN')"
* }
* }
* )
* @ApiFilter(GroupFilter::class,
* arguments={
* "overrideDefaultGroups": true
* }
* )
* @ApiFilter(PropertyFilter::class,
* arguments={
* "parameterName"="fields",
* "overrideDefaultProperties"=true
* }
* )
*/
class ExclusionsVideo
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
* @Groups({"exclusion_video:read", "exclusion_video:read:id"})
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity=TvCompany::class, inversedBy="exclusionsVideos")
* @ORM\JoinColumn(nullable=true)
*/
private $tvCompany;
/**
* @ORM\ManyToOne(targetEntity=Company::class, inversedBy="exclusionsVideos")
* @ORM\JoinColumn(nullable=true)
* @Assert\NotNull
* @Groups({"exclusion_video:write", "exclusion_video:read:company", "exclusion_video:read", "video:write", "video:read", "video_form_complete"})
*/
private $company;
/**
* @ORM\ManyToOne(targetEntity=Video::class, inversedBy="exclusionsVideos")
* @ORM\JoinColumn(nullable=false)
* @Groups({"exclusion_video:write", "exclusion_video:read:video", "exclusion_video:read"})
*/
private $video;
/**
* @ORM\Column(type="datetime")
* @Gedmo\Timestampable(on="create")
* @Groups({"exclusion_video:read", "exclusion_video:write", "exclusion_video:read:createdAt", "video:write"})
*/
private $createdAt;
public function getId(): ?int
{
return $this->id;
}
public function getTvCompany(): ?TvCompany
{
return $this->tvCompany;
}
public function setTvCompany(?TvCompany $tvCompany): self
{
$this->tvCompany = $tvCompany;
return $this;
}
public function getCompany(): ?Company
{
return $this->company;
}
public function setCompany(?Company $company): self
{
$this->company = $company;
return $this;
}
public function getVideo(): ?Video
{
return $this->video;
}
public function setVideo(?Video $video): self
{
$this->video = $video;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
}