<?php
declare(strict_types=1);
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Symfony\Component\Serializer\Annotation\Groups;
use Doctrine\ORM\Mapping as ORM;
use App\Repository\CspRepository;
/**
* Csp
*
* @ORM\Table(name="csp")
* @ORM\Entity(repositoryClass=CspRepository::class)
*/
class Csp
{
public const SERIALIZATION_GROUP_DDL = 'csp_ddl';
/**
* @var int
*
* @ORM\Column(name="id", type="smallint", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
* @Groups({self::SERIALIZATION_GROUP_DDL})
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="name", type="string", length=100, nullable=false)
* @Groups({
* self::SERIALIZATION_GROUP_DDL,
* CustomerExcludeCsp::SERIALIZATION_GROUP_EXCLUDED_CSP_COUNTRY
* })
*/
private $name;
/**
* @var string|null
*
* @ORM\Column(name="`group`", type="string", length=80, nullable=true, options={"default"="NULL"})
*/
private $group = null;
/**
* @var string|null
*
* @ORM\Column(name="history", type="text", length=65535, nullable=true, options={"default"="NULL"})
*/
private $history = null;
/**
* @var bool
*
* @ORM\Column(name="last_import", type="boolean", nullable=false)
*/
private $lastImport = false;
/**
* @var bool
*
* @ORM\Column(name="trash", type="boolean", nullable=false)
*/
private $trash = false;
/**
* @var Collection
*
* @ORM\OneToMany(targetEntity=CspCountry::class, mappedBy="csp", fetch="EXTRA_LAZY")
*/
private $country;
/**
* @var Collection
*
* @ORM\ManyToMany(targetEntity="Csptype", inversedBy="csp")
* @ORM\JoinTable(name="csp_csptype",
* joinColumns={
* @ORM\JoinColumn(name="csp_id", referencedColumnName="id")
* },
* inverseJoinColumns={
* @ORM\JoinColumn(name="csptype_id", referencedColumnName="id")
* }
* )
*/
private $csptype;
/**
* @var Collection
*
* @ORM\ManyToMany(targetEntity=CompanyType::class, inversedBy="csps")
* @ORM\JoinTable(name="csp_company_type",
* joinColumns={
* @ORM\JoinColumn(name="csp_id", referencedColumnName="id")
* },
* inverseJoinColumns={
* @ORM\JoinColumn(name="company_type_id", referencedColumnName="id")
* }
* )
*/
private $companyTypes;
/**
* Constructor
*/
public function __construct()
{
$this->country = new ArrayCollection();
$this->csptype = new ArrayCollection();
$this->companyTypes = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getGroup(): ?string
{
return $this->group;
}
public function setGroup(?string $group): self
{
$this->group = $group;
return $this;
}
public function getHistory(): ?string
{
return $this->history;
}
public function setHistory(?string $history): self
{
$this->history = $history;
return $this;
}
public function isLastImport(): ?bool
{
return $this->lastImport;
}
public function setLastImport(bool $lastImport): self
{
$this->lastImport = $lastImport;
return $this;
}
public function isTrash(): ?bool
{
return $this->trash;
}
public function setTrash(bool $trash): self
{
$this->trash = $trash;
return $this;
}
/**
* @return Collection<int, CspCountry>
*/
public function getCountry(): Collection
{
return $this->country;
}
public function addCountry(CspCountry $country): self
{
if (!$this->country->contains($country)) {
$this->country[] = $country;
}
return $this;
}
public function removeCountry(CspCountry $country): self
{
$this->country->removeElement($country);
return $this;
}
/**
* @return Collection<int, Csptype>
*/
public function getCsptype(): Collection
{
return $this->csptype;
}
public function addCsptype(Csptype $csptype): self
{
if (!$this->csptype->contains($csptype)) {
$this->csptype[] = $csptype;
}
return $this;
}
public function removeCsptype(Csptype $csptype): self
{
$this->csptype->removeElement($csptype);
return $this;
}
/**
* @return Collection<int, CompanyType>
*/
public function getCompanyTypes(): Collection
{
return $this->companyTypes;
}
public function addCompanyType(CompanyType $companyType): self
{
if (!$this->companyTypes->contains($companyType)) {
$this->companyTypes->add($companyType);
}
return $this;
}
public function removeCompanyType(CompanyType $companyType): self
{
$this->companyTypes->removeElement($companyType);
return $this;
}
}