<?phpnamespace App\Entity\Gos;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;/** * @ORM\Entity(repositoryClass="App\Repository\Gos\UserPositionRepository") * @ORM\HasLifecycleCallbacks * @UniqueEntity("name") */class UserPosition{ /** * @ORM\Id() * @ORM\GeneratedValue() * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=255) */ private $name; /** * @ORM\ManyToMany(targetEntity="App\Entity\Gos\PortalSettings", inversedBy="positions") */ private $portalSettings; /** * @ORM\OneToMany(targetEntity="App\Entity\Gos\User", mappedBy="position") */ private $user; /** * @ORM\Column(type="datetime") */ private $createdAt; /** * @ORM\Column(type="datetime", nullable=true) */ private $updatedAt; public function __toString() { return $this->name; } public function __construct() { $this->portalSettings = new ArrayCollection(); $this->user = new ArrayCollection(); } /** @ORM\PrePersist() */ public function prePersist() { $this->createdAt = new \DateTime(); } /** @ORM\PreUpdate() */ public function preUpdate() { $this->updatedAt = new \DateTime(); } public function getId(): ?int { return $this->id; } public function getName(): ?string { return $this->name; } public function setName(string $name): self { $this->name = $name; return $this; } /** * @return Collection|PortalSettings[] */ public function getPortalSettings(): Collection { return $this->portalSettings; } public function addPortalSetting(PortalSettings $portalSetting): self { if (!$this->portalSettings->contains($portalSetting)) { $this->portalSettings[] = $portalSetting; } return $this; } public function removePortalSetting(PortalSettings $portalSetting): self { if ($this->portalSettings->contains($portalSetting)) { $this->portalSettings->removeElement($portalSetting); } return $this; } /** * @return Collection|User[] */ public function getUser(): Collection { return $this->user; } public function addUser(User $user): self { if (!$this->user->contains($user)) { $this->user[] = $user; $user->setPosition($this); } return $this; } public function removeUser(User $user): self { if ($this->user->contains($user)) { $this->user->removeElement($user); // set the owning side to null (unless already changed) if ($user->getPosition() === $this) { $user->setPosition(null); } } return $this; } public function getCreatedAt(): ?\DateTimeInterface { return $this->createdAt; } public function setCreatedAt(\DateTimeInterface $createdAt): self { $this->createdAt = $createdAt; return $this; } public function getUpdatedAt(): ?\DateTimeInterface { return $this->updatedAt; } public function setUpdatedAt(?\DateTimeInterface $updatedAt): self { $this->updatedAt = $updatedAt; return $this; }}