src/Entity/CompanyType.php line 19

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Entity;
  4. use Doctrine\DBAL\Types\Types;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Collection;
  8. use App\Repository\CompanyTypeRepository;
  9. /**
  10.  * CompanyType
  11.  *
  12.  * @ORM\Table(name="company_type")
  13.  * @ORM\Entity(repositoryClass=CompanyTypeRepository::class)
  14.  */
  15. class CompanyType
  16. {
  17.     /**
  18.      * @var int
  19.      *
  20.      * @ORM\Column(name="id", type="smallint", nullable=false)
  21.      * @ORM\Id
  22.      * @ORM\GeneratedValue(strategy="IDENTITY")
  23.      */
  24.     private $id;
  25.     /**
  26.      * @var string
  27.      *
  28.      * @ORM\Column(name="name", type="string", length=80, nullable=false)
  29.      */
  30.     private $name;
  31.     /**
  32.      * @var bool
  33.      *
  34.      * @ORM\Column(name="last_import", type="boolean", nullable=false)
  35.      */
  36.     private $lastImport false;
  37.      /**
  38.      * @var Collection
  39.      *
  40.      * @ORM\ManyToMany(targetEntity=Csp::class, mappedBy="companyTypes")
  41.      */
  42.     private $csps;
  43.     /**
  44.      * Constructor
  45.      */
  46.     public function __construct()
  47.     {
  48.         $this->csps = new ArrayCollection();
  49.     }
  50.     public function getId(): ?int
  51.     {
  52.         return $this->id;
  53.     }
  54.     public function getName(): ?string
  55.     {
  56.         return $this->name;
  57.     }
  58.     public function setName(string $name): self
  59.     {
  60.         $this->name $name;
  61.         return $this;
  62.     }
  63.     public function isLastImport(): ?bool
  64.     {
  65.         return $this->lastImport;
  66.     }
  67.     public function setLastImport(bool $lastImport): self
  68.     {
  69.         $this->lastImport $lastImport;
  70.         return $this;
  71.     }
  72.     /**
  73.      * @return Collection<int, Csp>
  74.      */
  75.     public function getCsps(): Collection
  76.     {
  77.         return $this->csps;
  78.     }
  79.     public function addCsp(Csp $csp): self
  80.     {
  81.         if (!$this->csps->contains($csp)) {
  82.             $this->csps->add($csp);
  83.             $csp->addCompanyType($this);
  84.         }
  85.         return $this;
  86.     }
  87.     public function removeCsp(Csp $csp): self
  88.     {
  89.         if ($this->csps->removeElement($csp)) {
  90.             $csp->removeCompanyType($this);
  91.         }
  92.         return $this;
  93.     }
  94. }