src/Entity/Federation/Team.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Federation;
  3. use App\Entity\Site\AccessSite;
  4. use App\Entity\Site\Site;
  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. use App\Entity\Media\Document;
  11. /**
  12.  * @ORM\Entity(repositoryClass="App\Repository\Federation\TeamRepository")
  13.  * @ORM\Table(name="teams")
  14.  */
  15. class Team
  16. {
  17.     /**
  18.      * @ORM\Id
  19.      * @ORM\Column(type="integer")
  20.      * @ORM\GeneratedValue(strategy="AUTO")
  21.      */
  22.     private $id;
  23.     /**
  24.      * @ORM\Column(type="string", length=255, nullable=false)
  25.      * @Assert\NotBlank()
  26.      */
  27.     private $name;
  28.     /**
  29.      * @ORM\Column(type="datetime", nullable=false, name="created_date")
  30.      * @Gedmo\Timestampable(on="create")
  31.      */
  32.     private $createdDate;
  33.     /**
  34.      * @ORM\Column(type="datetime", nullable=true, name="updated_date")
  35.      * @Gedmo\Timestampable(on="update")
  36.      */
  37.     private $updatedDate;
  38.     /**
  39.      * @ORM\Column(type="integer", nullable=true, name="status")
  40.      */
  41.     private $status 1;
  42.     /**
  43.      * @ORM\OneToMany(targetEntity="App\Entity\Site\Site", mappedBy="team")
  44.      */
  45.     private $sites;
  46.     /**
  47.      * @ORM\ManyToMany(targetEntity="App\Entity\Site\AccessSite", mappedBy="teams")
  48.      */
  49.     private $accessSites;
  50.     
  51.     /**
  52.      * @ORM\ManyToMany(targetEntity="App\Entity\Federation\Participation", mappedBy="teams", cascade={"remove"})
  53.      */
  54.     private $participations;
  55.     
  56.     /**
  57.      * @ORM\ManyToMany(targetEntity="App\Entity\Media\Document", mappedBy="teams")
  58.      */
  59.     private $documents;
  60.     public function __construct()
  61.     {
  62.         $this->sites = new ArrayCollection();
  63.         $this->accessSites = new ArrayCollection();
  64.         $this->participations = new ArrayCollection();
  65.         $this->documents = new ArrayCollection();
  66.     }
  67.     public function getId(): ?int
  68.     {
  69.         return $this->id;
  70.     }
  71.     public function getName(): ?string
  72.     {
  73.         return $this->name;
  74.     }
  75.     public function setName(string $name): self
  76.     {
  77.         $this->name $name;
  78.         return $this;
  79.     }
  80.     public function getCreatedDate(): ?\DateTimeInterface
  81.     {
  82.         return $this->createdDate;
  83.     }
  84.     public function getUpdatedDate(): ?\DateTimeInterface
  85.     {
  86.         return $this->updatedDate;
  87.     }
  88.     
  89.     public function getStatus(): ?int
  90.     {
  91.         return $this->status;
  92.     }
  93.     public function setStatus(?int $status): self
  94.     {
  95.         $this->status $status;
  96.         return $this;
  97.     }
  98.     /**
  99.      * @return Collection|Site[]
  100.      */
  101.     public function getSites(): Collection
  102.     {
  103.         return $this->sites;
  104.     }
  105.     public function addSite(Site $site): self
  106.     {
  107.         if (!$this->sites->contains($site)) {
  108.             $this->sites[] = $site;
  109.             $site->setTeam($this);
  110.         }
  111.         return $this;
  112.     }
  113.     public function removeSite(Site $site): self
  114.     {
  115.         if ($this->sites->contains($site)) {
  116.             $this->sites->removeElement($site);
  117.             // set the owning side to null (unless already changed)
  118.             if ($site->getTeam() === $this) {
  119.                 $site->setTeam(null);
  120.             }
  121.         }
  122.         return $this;
  123.     }
  124.     /**
  125.      * @return Collection|AccessSite[]
  126.      */
  127.     public function getAccessSites(): Collection
  128.     {
  129.         return $this->accessSites;
  130.     }
  131.     public function addAccessSite(AccessSite $accessSite): self
  132.     {
  133.         if (!$this->accessSites->contains($accessSite)) {
  134.             $this->accessSites[] = $accessSite;
  135.             $accessSite->addTeam($this);
  136.         }
  137.         return $this;
  138.     }
  139.     public function removeAccessSite(AccessSite $accessSite): self
  140.     {
  141.         if ($this->accessSites->contains($accessSite)) {
  142.             $this->accessSites->removeElement($accessSite);
  143.             $accessSite->removeTeam($this);
  144.         }
  145.         return $this;
  146.     }
  147.     /**
  148.      * @return Collection|Participation[]
  149.      */
  150.     public function getParticipations(): Collection
  151.     {
  152.         return $this->participations;
  153.     }
  154.     public function addParticipation(Participation $participation): self
  155.     {
  156.         if (!$this->participations->contains($participation)) {
  157.             $this->participations[] = $participation;
  158.             $participation->addTeam($this);
  159.         }
  160.         return $this;
  161.     }
  162.     public function removeParticipation(Participation $participation): self
  163.     {
  164.         if ($this->participations->contains($participation)) {
  165.             $this->participations->removeElement($participation);
  166.             $participation->removeTeam($this);
  167.         }
  168.         return $this;
  169.     }
  170.     /**
  171.      * @return Collection|Document[]
  172.      */
  173.     public function getDocuments(): Collection
  174.     {
  175.         return $this->documents;
  176.     }
  177.     public function addDocument(Document $document): self
  178.     {
  179.         if (!$this->documents->contains($document)) {
  180.             $this->documents[] = $document;
  181.             $document->addTeam($this);
  182.         }
  183.         return $this;
  184.     }
  185.     public function removeDocument(Document $document): self
  186.     {
  187.         if ($this->documents->contains($document)) {
  188.             $this->documents->removeElement($document);
  189.             $document->removeTeam($this);
  190.         }
  191.         return $this;
  192.     }
  193.     public function __toString(): string
  194.     {
  195.         return $this->name $this->name '';
  196.     }
  197. }