*/ #[ORM\OneToMany(mappedBy: 'parent', targetEntity: self::class)] private Collection $organizationalUnits; #[ORM\ManyToOne(targetEntity: NetworkSettings::class, inversedBy: 'organizationalUnits', cascade: ['persist'])] #[ORM\JoinColumn(nullable: true)] private ?NetworkSettings $networkSettings = null; /** * @var Collection */ #[ORM\ManyToMany(targetEntity: User::class, mappedBy: 'allowedOrganizationalUnits')] private Collection $users; /** * @var Collection */ #[ORM\OneToMany(mappedBy: 'organizationalUnit', targetEntity: Client::class)] private Collection $clients; #[ORM\Column(length: 255)] private ?string $type = null; #[ORM\Column(length: 255, nullable: true)] private ?string $location = null; #[ORM\Column(nullable: true)] private ?bool $projector = null; #[ORM\Column(nullable: true)] private ?bool $board = null; #[ORM\Column(nullable: true)] private ?int $capacity = null; /** * @var Collection */ #[ORM\OneToMany(mappedBy: 'organizationalUnit', targetEntity: SoftwareProfile::class)] private Collection $softwareProfiles; #[ORM\ManyToOne(inversedBy: 'organizationalUnits')] private ?Subnet $subnet = null; #[ORM\ManyToOne(targetEntity: RemoteCalendar::class, cascade: ['persist'], inversedBy: 'organizationalUnits')] #[ORM\JoinColumn(nullable: true)] private ?RemoteCalendar $remoteCalendar = null; #[ORM\Column] private ?bool $remotePc = false; #[ORM\Column] private ?bool $reserved = false; /** * @var Collection */ #[ORM\OneToMany(mappedBy: 'organizationalUnit', targetEntity: Image::class)] private Collection $images; public function __construct() { parent::__construct(); $this->organizationalUnits = new ArrayCollection(); $this->users = new ArrayCollection(); $this->clients = new ArrayCollection(); $this->softwareProfiles = new ArrayCollection(); $this->images = new ArrayCollection(); } public function getDescription(): ?string { return $this->description; } public function setDescription(?string $description): static { $this->description = $description; return $this; } public function getComments(): ?string { return $this->comments; } public function setComments(?string $comments): static { $this->comments = $comments; return $this; } public function getPath(): ?string { return $this->path; } public function setPath(?string $path): static { $this->path = $path; return $this; } public function getLevel(): ?int { return $this->level; } public function setLevel(?int $level): static { $this->level = $level; return $this; } public function getSlug(): ?string { return $this->slug; } public function setSlug(?string $slug): static { $this->slug = $slug; return $this; } public function getParent(): ?self { return $this->parent; } public function setParent(?self $parent): static { $this->parent = $parent; return $this; } /** * @return Collection */ public function getOrganizationalUnits(): Collection { return $this->organizationalUnits; } public function addOrganizationalUnit(self $organizationalUnit): static { if (!$this->organizationalUnits->contains($organizationalUnit)) { $this->organizationalUnits->add($organizationalUnit); $organizationalUnit->setParent($this); } return $this; } public function removeOrganizationalUnit(self $organizationalUnit): static { if ($this->organizationalUnits->removeElement($organizationalUnit)) { // set the owning side to null (unless already changed) if ($organizationalUnit->getParent() === $this) { $organizationalUnit->setParent(null); } } return $this; } public function getNetworkSettings(): ?NetworkSettings { return $this->networkSettings; } public function setNetworkSettings(?NetworkSettings $networkSettings): static { $this->networkSettings = $networkSettings; return $this; } /** * @return Collection */ public function getUsers(): Collection { return $this->users; } public function addUser(User $user): static { if (!$this->users->contains($user)) { $this->users->add($user); $user->addAllowedOrganizationalUnit($this); } return $this; } public function removeUser(User $user): static { if ($this->users->removeElement($user)) { $user->removeAllowedOrganizationalUnit($this); } return $this; } /** * @return Collection */ public function getClients(): Collection { return $this->clients; } public function addClient(Client $client): static { if (!$this->clients->contains($client)) { $this->clients->add($client); $client->setOrganizationalUnit($this); } return $this; } public function removeClient(Client $client): static { if ($this->clients->removeElement($client)) { if ($client->getOrganizationalUnit() === $this) { $client->setOrganizationalUnit(null); } } return $this; } public function getType(): ?string { return $this->type; } public function setType(string $type): static { $this->type = $type; return $this; } public function getLocation(): ?string { return $this->location; } public function setLocation(?string $location): static { $this->location = $location; return $this; } public function isProjector(): ?bool { return $this->projector; } public function setProjector(?bool $projector): static { $this->projector = $projector; return $this; } public function isBoard(): ?bool { return $this->board; } public function setBoard(?bool $board): static { $this->board = $board; return $this; } public function getCapacity(): ?int { return $this->capacity; } public function setCapacity(?int $capacity): static { $this->capacity = $capacity; return $this; } public function updateNetworkSettingsRecursively(?NetworkSettings $networkSettings): void { $this->setNetworkSettings($networkSettings); /** @var Client $client */ foreach ($this->getClients() as $client) { $client->setMenu($networkSettings->getMenu()); $client->setHardwareProfile($networkSettings->getHardwareProfile()); $client->setValidation($networkSettings->getValidation()); } foreach ($this->getOrganizationalUnits() as $childUnit) { $childUnit->updateNetworkSettingsRecursively($networkSettings); } } /** * @return Collection */ public function getSoftwareProfiles(): Collection { return $this->softwareProfiles; } public function addSoftwareProfile(SoftwareProfile $softwareProfile): static { if (!$this->softwareProfiles->contains($softwareProfile)) { $this->softwareProfiles->add($softwareProfile); $softwareProfile->setOrganizationalUnit($this); } return $this; } public function removeSoftwareProfile(SoftwareProfile $softwareProfile): static { if ($this->softwareProfiles->removeElement($softwareProfile)) { // set the owning side to null (unless already changed) if ($softwareProfile->getOrganizationalUnit() === $this) { $softwareProfile->setOrganizationalUnit(null); } } return $this; } public function getSubnet(): ?Subnet { return $this->subnet; } public function setSubnet(?Subnet $subnet): static { $this->subnet = $subnet; return $this; } public function getRemoteCalendar(): ?RemoteCalendar { return $this->remoteCalendar; } public function setRemoteCalendar(?RemoteCalendar $remoteCalendar): static { $this->remoteCalendar = $remoteCalendar; return $this; } public function isRemotePc(): ?bool { return $this->remotePc; } public function setRemotePc(bool $remotePc): static { $this->remotePc = $remotePc; return $this; } public function isReserved(): ?bool { return $this->reserved; } public function setReserved(bool $reserved): static { $this->reserved = $reserved; return $this; } /** * @return Collection */ public function getImages(): Collection { return $this->images; } public function addImage(Image $image): static { if (!$this->images->contains($image)) { $this->images->add($image); $image->setOrganizationalUnit($this); } return $this; } public function removeImage(Image $image): static { if ($this->images->removeElement($image)) { // set the owning side to null (unless already changed) if ($image->getOrganizationalUnit() === $this) { $image->setOrganizationalUnit(null); } } return $this; } }