src/Entity/Organization.php line 11

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. #[ORM\Entity(repositoryClassOrganizationRepository::class)]
  8. class Organization
  9. {
  10.     const TYPE_UNIVERSITY 1;
  11.     const TYPE_OTHER 2;
  12.     const DEFAULT_TYPE self::TYPE_UNIVERSITY;
  13.     const TYPE_ARRAY = [
  14.         'organization.type.university' => self::TYPE_UNIVERSITY,
  15.         'organization.type.other' => self::TYPE_OTHER,
  16.     ];
  17.     #[ORM\Id]
  18.     #[ORM\GeneratedValue]
  19.     #[ORM\Column]
  20.     private ?int $id null;
  21.     #[ORM\Column(length255)]
  22.     private ?string $name null;
  23.     #[ORM\Column(length255nullabletrue)]
  24.     private ?string $domain null;
  25.     #[ORM\Column]
  26.     private ?bool $edugain null;
  27.     #[ORM\Column]
  28.     private ?bool $paidAccess null;
  29.     #[ORM\OneToMany(mappedBy'organization'targetEntityUser::class)]
  30.     private Collection $users;
  31.     #[ORM\Column]
  32.     private ?int $type null;
  33.     #[ORM\Column(length255nullabletrue)]
  34.     private ?string $address null;
  35.     public function __construct()
  36.     {
  37.         $this->users = new ArrayCollection();
  38.     }
  39.     public function __toString()
  40.     {
  41.         return $this->name;
  42.     }
  43.     public function getId(): ?int
  44.     {
  45.         return $this->id;
  46.     }
  47.     public function getName(): ?string
  48.     {
  49.         return $this->name;
  50.     }
  51.     public function setName(string $name): static
  52.     {
  53.         $this->name $name;
  54.         return $this;
  55.     }
  56.     public function getDomain(): ?string
  57.     {
  58.         return $this->domain;
  59.     }
  60.     public function setDomain(?string $domain): static
  61.     {
  62.         $this->domain $domain;
  63.         return $this;
  64.     }
  65.     public function isEdugain(): ?bool
  66.     {
  67.         return $this->edugain;
  68.     }
  69.     public function setEdugain(bool $edugain): static
  70.     {
  71.         $this->edugain $edugain;
  72.         return $this;
  73.     }
  74.     public function isPaidAccess(): ?bool
  75.     {
  76.         return $this->paidAccess;
  77.     }
  78.     public function setPaidAccess(bool $paidAccess): static
  79.     {
  80.         $this->paidAccess $paidAccess;
  81.         return $this;
  82.     }
  83.     /**
  84.      * @return Collection<int, User>
  85.      */
  86.     public function getUsers(): Collection
  87.     {
  88.         return $this->users;
  89.     }
  90.     public function addUser(User $user): static
  91.     {
  92.         if (!$this->users->contains($user)) {
  93.             $this->users->add($user);
  94.             $user->setOrganization($this);
  95.         }
  96.         return $this;
  97.     }
  98.     public function removeUser(User $user): static
  99.     {
  100.         if ($this->users->removeElement($user)) {
  101.             // set the owning side to null (unless already changed)
  102.             if ($user->getOrganization() === $this) {
  103.                 $user->setOrganization(null);
  104.             }
  105.         }
  106.         return $this;
  107.     }
  108.     public function getType(): ?int
  109.     {
  110.         return $this->type;
  111.     }
  112.     public function setType(int $type): static
  113.     {
  114.         $this->type $type;
  115.         return $this;
  116.     }
  117.     public function getAddress(): ?string
  118.     {
  119.         return $this->address;
  120.     }
  121.     public function setAddress(?string $address): static
  122.     {
  123.         $this->address $address;
  124.         return $this;
  125.     }
  126. }