src/Entity/Organization.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\OrganizationRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=OrganizationRepository::class)
  9.  */
  10. class Organization
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="string", length=255)
  20.      */
  21.     private $name;
  22.     /**
  23.      * @ORM\OneToMany(targetEntity=OrganizationUnit::class, mappedBy="organization")
  24.      */
  25.     private $organizationUnits;
  26.     /**
  27.      * @ORM\Column(type="string", length=15, nullable=true)
  28.      */
  29.     private $acronym;
  30.     /**
  31.      * @ORM\Column(type="string", length=255, nullable=true)
  32.      */
  33.     private $logo;
  34.     public function __construct()
  35.     {
  36.         $this->organizationUnits = new ArrayCollection();
  37.     }
  38.     public function getId(): ?int
  39.     {
  40.         return $this->id;
  41.     }
  42.     public function getName(): ?string
  43.     {
  44.         return $this->name;
  45.     }
  46.     public function setName(string $name): self
  47.     {
  48.         $this->name $name;
  49.         return $this;
  50.     }
  51.     /**
  52.      * @return Collection|OrganizationUnit[]
  53.      */
  54.     public function getOrganizationUnits(): Collection
  55.     {
  56.         return $this->organizationUnits;
  57.     }
  58.     public function addOrganizationUnit(OrganizationUnit $organizationUnit): self
  59.     {
  60.         if (!$this->organizationUnits->contains($organizationUnit)) {
  61.             $this->organizationUnits[] = $organizationUnit;
  62.             $organizationUnit->setOrganization($this);
  63.         }
  64.         return $this;
  65.     }
  66.     public function removeOrganizationUnit(OrganizationUnit $organizationUnit): self
  67.     {
  68.         if ($this->organizationUnits->removeElement($organizationUnit)) {
  69.             // set the owning side to null (unless already changed)
  70.             if ($organizationUnit->getOrganization() === $this) {
  71.                 $organizationUnit->setOrganization(null);
  72.             }
  73.         }
  74.         return $this;
  75.     }
  76.     public function getAcronym(): ?string
  77.     {
  78.         return $this->acronym;
  79.     }
  80.     public function setAcronym(?string $acronym): self
  81.     {
  82.         $this->acronym $acronym;
  83.         return $this;
  84.     }
  85.     public function getLogo(): ?string
  86.     {
  87.         return $this->logo;
  88.     }
  89.     public function setLogo(?string $logo): self
  90.     {
  91.         $this->logo $logo;
  92.         return $this;
  93.     }
  94.     public function __toString()
  95.     {
  96.         return $this->name;
  97.     }
  98. }