src/Entity/Federation/Skipper.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\SkipperRepository")
  12.  * @ORM\Table(name="skippers")
  13.  */
  14. class Skipper
  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\Participation", mappedBy="skipper", cascade={"remove"})
  43.      */
  44.     private $participations;
  45.     /**
  46.      * @ORM\ManyToMany(targetEntity="App\Entity\Site\AccessSite", mappedBy="skippers")
  47.      */
  48.     private $accessSites;
  49.     /**
  50.      * @ORM\ManyToMany(targetEntity="App\Entity\Media\Document", mappedBy="skippers")
  51.      */
  52.     private $documents;
  53.     public function __construct()
  54.     {
  55.         $this->participations = new ArrayCollection();
  56.         $this->accessSites = new ArrayCollection();
  57.         $this->documents = 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.     public function setUpdatedDate(?\DateTimeInterface $updatedDate): self
  82.     {
  83.         $this->updatedDate $updatedDate;
  84.         return $this;
  85.     }
  86.     public function getStatus(): ?int
  87.     {
  88.         return $this->status;
  89.     }
  90.     public function setStatus(?int $status): self
  91.     {
  92.         $this->status $status;
  93.         return $this;
  94.     }
  95.     /**
  96.      * @return Collection|Participation[]
  97.      */
  98.     public function getParticipations(): Collection
  99.     {
  100.         return $this->participations;
  101.     }
  102.     public function addParticipation(Participation $participation): self
  103.     {
  104.         if (!$this->participations->contains($participation)) {
  105.             $this->participations[] = $participation;
  106.             $participation->setSkipper($this);
  107.         }
  108.         return $this;
  109.     }
  110.     public function removeParticipation(Participation $participation): self
  111.     {
  112.         if ($this->participations->contains($participation)) {
  113.             $this->participations->removeElement($participation);
  114.             // set the owning side to null (unless already changed)
  115.             if ($participation->getSkipper() === $this) {
  116.                 $participation->setSkipper(null);
  117.             }
  118.         }
  119.         return $this;
  120.     }
  121.     /**
  122.      * @return Collection|AccessSite[]
  123.      */
  124.     public function getAccessSites(): Collection
  125.     {
  126.         return $this->accessSites;
  127.     }
  128.     public function addAccessSite(AccessSite $accessSite): self
  129.     {
  130.         if (!$this->accessSites->contains($accessSite)) {
  131.             $this->accessSites[] = $accessSite;
  132.             $accessSite->addSkipper($this);
  133.         }
  134.         return $this;
  135.     }
  136.     public function removeAccessSite(AccessSite $accessSite): self
  137.     {
  138.         if ($this->accessSites->contains($accessSite)) {
  139.             $this->accessSites->removeElement($accessSite);
  140.             $accessSite->removeSkipper($this);
  141.         }
  142.         return $this;
  143.     }
  144.     /**
  145.      * @return Collection|Document[]
  146.      */
  147.     public function getDocuments(): Collection
  148.     {
  149.         return $this->documents;
  150.     }
  151.     public function addDocument(Document $document): self
  152.     {
  153.         if (!$this->documents->contains($document)) {
  154.             $this->documents[] = $document;
  155.             $document->addSkipper($this);
  156.         }
  157.         return $this;
  158.     }
  159.     public function removeDocument(Document $document): self
  160.     {
  161.         if ($this->documents->contains($document)) {
  162.             $this->documents->removeElement($document);
  163.             $document->removeSkipper($this);
  164.         }
  165.         return $this;
  166.     }
  167.     public function __toString(): string
  168.     {
  169.         return $this->name $this->name '';
  170.     }
  171. }