<?phpnamespace App\Entity;use App\Entity\Traits\Auditable;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use FOS\UserBundle\Model\User as BaseUser;/** * @ORM\Entity(repositoryClass="App\Repository\UserRepository") * @ORM\Table(name="fos_user") */class User extends BaseUser{ use Auditable; /** * @ORM\Id() * @ORM\GeneratedValue() * @ORM\Column(type="integer") */ protected $id; /** * @ORM\ManyToOne(targetEntity="App\Entity\OrganizationUnit", inversedBy="users") */ protected $organizationUnit; /** * @ORM\Column(type="string", nullable=true) */ protected $firstName; /** * @ORM\Column(type="string", nullable=true) */ protected $lastName; /** * @ORM\Column(type="string", nullable=true) */ protected $telephone; /** * @ORM\Column(type="text", nullable=true) */ protected $additionalNotes; /** * @ORM\OneToMany(targetEntity="App\Entity\Booking", mappedBy="user") */ private $bookings; /** * @ORM\Column(type="string", length=64) */ private $settingTimeZone = 'Europe/London'; public function __construct() { parent::__construct(); $this->bookings = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getOrganizationUnit(): ?OrganizationUnit { return $this->organizationUnit; } public function setOrganizationUnit(?OrganizationUnit $organizationUnit): self { $this->organizationUnit = $organizationUnit; return $this; } /** * @return mixed */ public function getAdditionalNotes() { return $this->additionalNotes; } /** * @param mixed $additionalNotes * @return User */ public function setAdditionalNotes($additionalNotes) { $this->additionalNotes = $additionalNotes; return $this; } /** * @return mixed */ public function getFirstName() { return $this->firstName; } /** * @param mixed $firstName * @return User */ public function setFirstName($firstName) { $this->firstName = $firstName; return $this; } /** * @return mixed */ public function getLastName() { return $this->lastName; } /** * @param mixed $lastName * @return User */ public function setLastName($lastName) { $this->lastName = $lastName; return $this; } /** * @return mixed */ public function getTelephone() { return $this->telephone; } /** * @param mixed $telephone * @return User */ public function setTelephone($telephone) { $this->telephone = $telephone; return $this; } /** * @return mixed */ public function getFullName() { return trim($this->firstName . ' ' . $this->lastName); } /** * @return mixed */ public function getDisplayName() { $name = $this->getFullName(); if (empty($name)) { $name=$this->username; } return $name; } /** * @return Collection|Booking[] */ public function getBookings(): Collection { return $this->bookings; } public function addBooking(Booking $booking): self { if (!$this->bookings->contains($booking)) { $this->bookings[] = $booking; $booking->setUser($this); } return $this; } public function removeBooking(Booking $booking): self { if ($this->bookings->contains($booking)) { $this->bookings->removeElement($booking); // set the owning side to null (unless already changed) if ($booking->getUser() === $this) { $booking->setUser(null); } } return $this; } public function getSettingTimeZone(): ?string { return $this->settingTimeZone; } public function setSettingTimeZone(string $settingTimeZone): self { $this->settingTimeZone = $settingTimeZone; return $this; }}