<?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\ExclusionsChannelRepository;
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=ExclusionsChannelRepository::class)
* @ApiResource(
* normalizationContext={
* "groups"={"exclusion_channel:read"}
* },
* denormalizationContext={
* "groups"={"exclusion_channel: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 ExclusionsChannel
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
* @Groups({"exclusion_channel:read", "exclusion_channel:read:id", "channel:read"})
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity=TvCompany::class, inversedBy="exclusionsChannels")
* @ORM\JoinColumn(nullable=true)
*/
private $tvCompany;
/**
* @ORM\ManyToOne(targetEntity=Company::class, inversedBy="exclusionsChannels")
* @ORM\JoinColumn(nullable=true)
* @Assert\NotNull
* @Groups({"exclusion_channel:read", "exclusion_channel:read:company", "channel:read", "channel:write"})
*/
private $company;
/**
* @ORM\ManyToOne(targetEntity=Channel::class, inversedBy="exclusionsChannels")
* @ORM\JoinColumn(nullable=false)
*/
private $channel;
/**
* @ORM\Column(type="datetime")
* @Gedmo\Timestampable(on="create")
*/
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 getChannel(): ?Channel
{
return $this->channel;
}
public function setChannel(?Channel $channel): self
{
$this->channel = $channel;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
}