<?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\ExclusionsCategoryRepository;
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=ExclusionsCategoryRepository::class)
* @ApiResource(
* normalizationContext={
* "groups"={"exclusion_category:read"}
* },
* denormalizationContext={
* "groups"={"exclusion_category: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 ExclusionsCategory
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
* @Groups({"exclusion_category:read", "exclusion_category:read:id", "category:read"})
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity=TvCompany::class, inversedBy="exclusionsCategories")
* @ORM\JoinColumn(nullable=true)
*/
private $tvCompany;
/**
* @ORM\ManyToOne(targetEntity=Company::class, inversedBy="exclusionsCategories")
* @ORM\JoinColumn(nullable=true)
* @Assert\NotNull
* @Groups({"exclusion_category:read", "exclusion_category:read:company", "category:read", "category:write"})
*/
private $company;
/**
* @ORM\ManyToOne(targetEntity=Category::class, inversedBy="exclusionsCategories")
* @ORM\JoinColumn(nullable=false)
*/
private $category;
/**
* @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 getCategory(): ?Category
{
return $this->category;
}
public function setCategory(?Category $category): self
{
$this->category = $category;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
}