src/Entity/Federation/Classe.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Federation;
  3. use App\Entity\Media\Document;
  4. use App\Entity\Site\AccessSite;
  5. use Gedmo\Mapping\Annotation as Gedmo;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Collection;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use Symfony\Component\Validator\Constraints as Assert;
  10. /**
  11.  * @ORM\Entity(repositoryClass="App\Repository\Federation\ClassesRepository")
  12.  * @ORM\Table(name="classes")
  13.  */
  14. class Classe
  15. {
  16.     /**
  17.      * @ORM\Id
  18.      * @ORM\Column(type="integer")
  19.      * @ORM\GeneratedValue(strategy="AUTO")
  20.      */
  21.     private $id;
  22.     /**
  23.      * @ORM\Column(type="string", length=255, nullable=false)
  24.      * @Assert\NotBlank()
  25.      */
  26.     private $name;
  27.     /**
  28.      * @ORM\Column(type="datetime", nullable=false, name="created_date")
  29.      * @Gedmo\Timestampable(on="create")
  30.      */
  31.     private $createdDate;
  32.     /**
  33.      * @ORM\Column(type="datetime", nullable=true, name="updated_date")
  34.      * @Gedmo\Timestampable(on="update")
  35.      */
  36.     private $updatedDate;
  37.     /**
  38.      * @ORM\Column(type="integer", nullable=true, name="status")
  39.      */
  40.     private $status 1;
  41.     /**
  42.      * @ORM\OneToMany(targetEntity="App\Entity\Federation\Boat", mappedBy="classe", cascade={"remove"})
  43.      */
  44.     private $boats;
  45.     /**
  46.      * @ORM\ManyToMany(targetEntity="App\Entity\Media\Document", mappedBy="classes")
  47.      */
  48.     private $documents;
  49.     /**
  50.      * @ORM\ManyToMany(targetEntity="App\Entity\Site\AccessSite", mappedBy="classes")
  51.      */
  52.     private $accessSites;
  53.     public function __construct()
  54.     {
  55.         $this->boats = new ArrayCollection();
  56.         $this->documents = new ArrayCollection();
  57.         $this->accessSites = new ArrayCollection();
  58.     }
  59.     public function getId(): ?int
  60.     {
  61.         return $this->id;
  62.     }
  63.     public function getName(): ?string
  64.     {
  65.         return $this->name;
  66.     }
  67.     public function setName(string $name): self
  68.     {
  69.         $this->name $name;
  70.         return $this;
  71.     }
  72.     public function getCreatedDate(): ?\DateTimeInterface
  73.     {
  74.         return $this->createdDate;
  75.     }
  76.    
  77.     public function getUpdatedDate(): ?\DateTimeInterface
  78.     {
  79.         return $this->updatedDate;
  80.     }
  81.   
  82.     public function getStatus(): ?int
  83.     {
  84.         return $this->status;
  85.     }
  86.     public function setStatus(?int $status): self
  87.     {
  88.         $this->status $status;
  89.         return $this;
  90.     }
  91.     /**
  92.      * @return Collection|Boat[]
  93.      */
  94.     public function getBoats(): Collection
  95.     {
  96.         return $this->boats;
  97.     }
  98.     public function addBoat(Boat $boat): self
  99.     {
  100.         if (!$this->boats->contains($boat)) {
  101.             $this->boats[] = $boat;
  102.             $boat->setClasse($this);
  103.         }
  104.         return $this;
  105.     }
  106.     public function removeBoat(Boat $boat): self
  107.     {
  108.         if ($this->boats->contains($boat)) {
  109.             $this->boats->removeElement($boat);
  110.             // set the owning side to null (unless already changed)
  111.             if ($boat->getClasse() === $this) {
  112.                 $boat->setClasse(null);
  113.             }
  114.         }
  115.         return $this;
  116.     }
  117.     /**
  118.      * @return Collection|Document[]
  119.      */
  120.     public function getDocuments(): Collection
  121.     {
  122.         return $this->documents;
  123.     }
  124.     public function addDocument(Document $document): self
  125.     {
  126.         if (!$this->documents->contains($document)) {
  127.             $this->documents[] = $document;
  128.             $document->addClass($this);
  129.         }
  130.         return $this;
  131.     }
  132.     public function removeDocument(Document $document): self
  133.     {
  134.         if ($this->documents->contains($document)) {
  135.             $this->documents->removeElement($document);
  136.             $document->removeClass($this);
  137.         }
  138.         return $this;
  139.     }
  140.     /**
  141.      * @return Collection|AccessSite[]
  142.      */
  143.     public function getAccessSites(): Collection
  144.     {
  145.         return $this->accessSites;
  146.     }
  147.     public function addAccessSite(AccessSite $accessSite): self
  148.     {
  149.         if (!$this->accessSites->contains($accessSite)) {
  150.             $this->accessSites[] = $accessSite;
  151.             $accessSite->addClass($this);
  152.         }
  153.         return $this;
  154.     }
  155.     public function removeAccessSite(AccessSite $accessSite): self
  156.     {
  157.         if ($this->accessSites->contains($accessSite)) {
  158.             $this->accessSites->removeElement($accessSite);
  159.             $accessSite->removeClass($this);
  160.         }
  161.         return $this;
  162.     }
  163.     public function __toString(): string
  164.     {
  165.         return $this->name $this->name '';
  166.     }
  167. }