src/Entity/Csptype.php line 18

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\ORM\Mapping as ORM;
  7. use App\Repository\CsptypeRepository;
  8. /**
  9.  * Csptype
  10.  *
  11.  * @ORM\Table(name="csptype")
  12.  * @ORM\Entity(repositoryClass=CsptypeRepository::class)
  13.  */
  14. class Csptype
  15. {
  16.     /**
  17.      * @var int
  18.      *
  19.      * @ORM\Column(name="id", type="smallint", nullable=false)
  20.      * @ORM\Id
  21.      * @ORM\GeneratedValue(strategy="IDENTITY")
  22.      */
  23.     private $id;
  24.     /**
  25.      * @var string
  26.      *
  27.      * @ORM\Column(name="name", type="string", length=80, nullable=false)
  28.      */
  29.     private $name;
  30.     /**
  31.      * @var bool
  32.      *
  33.      * @ORM\Column(name="last_import", type="boolean", nullable=false)
  34.      */
  35.     private $lastImport false;
  36.     /**
  37.      * @var Collection
  38.      *
  39.      * @ORM\ManyToMany(targetEntity="Csp", mappedBy="csptype")
  40.      */
  41.     private $csp;
  42.     /**
  43.      * Constructor
  44.      */
  45.     public function __construct()
  46.     {
  47.         $this->csp = new ArrayCollection();
  48.     }
  49.     public function getId(): ?int
  50.     {
  51.         return $this->id;
  52.     }
  53.     public function getName(): ?string
  54.     {
  55.         return $this->name;
  56.     }
  57.     public function setName(string $name): self
  58.     {
  59.         $this->name $name;
  60.         return $this;
  61.     }
  62.     public function isLastImport(): ?bool
  63.     {
  64.         return $this->lastImport;
  65.     }
  66.     public function setLastImport(bool $lastImport): self
  67.     {
  68.         $this->lastImport $lastImport;
  69.         return $this;
  70.     }
  71.     /**
  72.      * @return Collection<int, Csp>
  73.      */
  74.     public function getCsp(): Collection
  75.     {
  76.         return $this->csp;
  77.     }
  78.     public function addCsp(Csp $csp): self
  79.     {
  80.         if (!$this->csp->contains($csp)) {
  81.             $this->csp[] = $csp;
  82.             $csp->addCsptype($this);
  83.         }
  84.         return $this;
  85.     }
  86.     public function removeCsp(Csp $csp): self
  87.     {
  88.         if ($this->csp->removeElement($csp)) {
  89.             $csp->removeCsptype($this);
  90.         }
  91.         return $this;
  92.     }
  93. }