src/Entity/Csp.php line 20

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Entity;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\DBAL\Types\Types;
  7. use Symfony\Component\Serializer\Annotation\Groups;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use App\Repository\CspRepository;
  10. /**
  11.  * Csp
  12.  *
  13.  * @ORM\Table(name="csp")
  14.  * @ORM\Entity(repositoryClass=CspRepository::class)
  15.  */
  16. class Csp
  17. {
  18.     public const SERIALIZATION_GROUP_DDL 'csp_ddl';
  19.     /**
  20.      * @var int
  21.      *
  22.      * @ORM\Column(name="id", type="smallint", nullable=false)
  23.      * @ORM\Id
  24.      * @ORM\GeneratedValue(strategy="IDENTITY")
  25.      * @Groups({self::SERIALIZATION_GROUP_DDL})
  26.      */
  27.     private $id;
  28.     /**
  29.      * @var string
  30.      *
  31.      * @ORM\Column(name="name", type="string", length=100, nullable=false)
  32.      * @Groups({
  33.      *     self::SERIALIZATION_GROUP_DDL,
  34.      *     CustomerExcludeCsp::SERIALIZATION_GROUP_EXCLUDED_CSP_COUNTRY
  35.      * })
  36.      */
  37.     private $name;
  38.     /**
  39.      * @var string|null
  40.      *
  41.      * @ORM\Column(name="`group`", type="string", length=80, nullable=true, options={"default"="NULL"})
  42.      */
  43.     private $group null;
  44.     /**
  45.      * @var string|null
  46.      *
  47.      * @ORM\Column(name="history", type="text", length=65535, nullable=true, options={"default"="NULL"})
  48.      */
  49.     private $history null;
  50.     /**
  51.      * @var bool
  52.      *
  53.      * @ORM\Column(name="last_import", type="boolean", nullable=false)
  54.      */
  55.     private $lastImport false;
  56.     /**
  57.      * @var bool
  58.      *
  59.      * @ORM\Column(name="trash", type="boolean", nullable=false)
  60.      */
  61.     private $trash false;
  62.     /**
  63.      * @var Collection
  64.      * 
  65.      * @ORM\OneToMany(targetEntity=CspCountry::class, mappedBy="csp", fetch="EXTRA_LAZY")
  66.      */
  67.     private $country;
  68.     /**
  69.      * @var Collection
  70.      *
  71.      * @ORM\ManyToMany(targetEntity="Csptype", inversedBy="csp")
  72.      * @ORM\JoinTable(name="csp_csptype",
  73.      *   joinColumns={
  74.      *     @ORM\JoinColumn(name="csp_id", referencedColumnName="id")
  75.      *   },
  76.      *   inverseJoinColumns={
  77.      *     @ORM\JoinColumn(name="csptype_id", referencedColumnName="id")
  78.      *   }
  79.      * )
  80.      */
  81.     private $csptype;
  82.     /**
  83.      * @var Collection
  84.      *
  85.      * @ORM\ManyToMany(targetEntity=CompanyType::class, inversedBy="csps")
  86.      * @ORM\JoinTable(name="csp_company_type",
  87.      *   joinColumns={
  88.      *     @ORM\JoinColumn(name="csp_id", referencedColumnName="id")
  89.      *   },
  90.      *   inverseJoinColumns={
  91.      *     @ORM\JoinColumn(name="company_type_id", referencedColumnName="id")
  92.      *   }
  93.      * )
  94.      */
  95.     private $companyTypes;
  96.     /**
  97.      * Constructor
  98.      */
  99.     public function __construct()
  100.     {
  101.         $this->country = new ArrayCollection();
  102.         $this->csptype = new ArrayCollection();
  103.         $this->companyTypes = new ArrayCollection();
  104.     }
  105.     public function getId(): ?int
  106.     {
  107.         return $this->id;
  108.     }
  109.     public function getName(): ?string
  110.     {
  111.         return $this->name;
  112.     }
  113.     public function setName(string $name): self
  114.     {
  115.         $this->name $name;
  116.         return $this;
  117.     }
  118.     public function getGroup(): ?string
  119.     {
  120.         return $this->group;
  121.     }
  122.     public function setGroup(?string $group): self
  123.     {
  124.         $this->group $group;
  125.         return $this;
  126.     }
  127.     public function getHistory(): ?string
  128.     {
  129.         return $this->history;
  130.     }
  131.     public function setHistory(?string $history): self
  132.     {
  133.         $this->history $history;
  134.         return $this;
  135.     }
  136.     public function isLastImport(): ?bool
  137.     {
  138.         return $this->lastImport;
  139.     }
  140.     public function setLastImport(bool $lastImport): self
  141.     {
  142.         $this->lastImport $lastImport;
  143.         return $this;
  144.     }
  145.     public function isTrash(): ?bool
  146.     {
  147.         return $this->trash;
  148.     }
  149.     public function setTrash(bool $trash): self
  150.     {
  151.         $this->trash $trash;
  152.         return $this;
  153.     }
  154.     /**
  155.      * @return Collection<int, CspCountry>
  156.      */
  157.     public function getCountry(): Collection
  158.     {
  159.         return $this->country;
  160.     }
  161.     public function addCountry(CspCountry $country): self
  162.     {
  163.         if (!$this->country->contains($country)) {
  164.             $this->country[] = $country;
  165.         }
  166.         return $this;
  167.     }
  168.     public function removeCountry(CspCountry $country): self
  169.     {
  170.         $this->country->removeElement($country);
  171.         return $this;
  172.     }
  173.     /**
  174.      * @return Collection<int, Csptype>
  175.      */
  176.     public function getCsptype(): Collection
  177.     {
  178.         return $this->csptype;
  179.     }
  180.     public function addCsptype(Csptype $csptype): self
  181.     {
  182.         if (!$this->csptype->contains($csptype)) {
  183.             $this->csptype[] = $csptype;
  184.         }
  185.         return $this;
  186.     }
  187.     public function removeCsptype(Csptype $csptype): self
  188.     {
  189.         $this->csptype->removeElement($csptype);
  190.         return $this;
  191.     }
  192.     /**
  193.      * @return Collection<int, CompanyType>
  194.      */
  195.     public function getCompanyTypes(): Collection
  196.     {
  197.         return $this->companyTypes;
  198.     }
  199.     public function addCompanyType(CompanyType $companyType): self
  200.     {
  201.         if (!$this->companyTypes->contains($companyType)) {
  202.             $this->companyTypes->add($companyType);
  203.         }
  204.         return $this;
  205.     }
  206.     public function removeCompanyType(CompanyType $companyType): self
  207.     {
  208.         $this->companyTypes->removeElement($companyType);
  209.         return $this;
  210.     }
  211. }