src/Entity/User.php line 21
<?phpnamespace App\Entity;use App\Entity\Mapped\Entity;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\ORM\Mapping as ORM;use Gedmo\Mapping\Annotation as Gedmo;use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;use Symfony\Component\Security\Core\User\EquatableInterface;use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;use Symfony\Component\Security\Core\User\UserInterface;use Symfony\Component\Validator\Constraints as Assert;/*** @ORM\Entity()* @ORM\Table(name="user")* @ORM\Entity(repositoryClass="App\Repository\UserRepository")* @UniqueEntity(fields="email", message="registracija.emailVecPostoji", groups={"registration"})*/class User extends Entity implements EquatableInterface,UserInterface,PasswordAuthenticatedUserInterface{/*** @ORM\Column(type="string", length=180, name="first_name", nullable=true)* @Assert\NotBlank(groups={"registration", "update"})* @Assert\Length(max="100", groups={"registration", "update"})*/private $firstName;/*** @ORM\Column(type="string", length=180, name="last_name", nullable=true)* @Assert\NotBlank(groups={"registration", "update"})* @Assert\Length(max="100", groups={"registration", "update"})*/private $lastName;/*** @ORM\Column(type="simple_array")*/private $roles = [];/*** @var string The hashed password* @ORM\Column(type="string" , nullable=false, name="password")*/private $password;/*** @Assert\Length(max="4096", groups={"registration", "password-reset", "update"})* @Assert\NotBlank(groups={"registration", "password-reset"})*/private $plainPassword;/*** @ORM\Column(type="string", length=100, unique=true)* @Assert\Email(groups={"registration"}, message = "registracija.neispravanEmail")* @Assert\NotBlank(groups={"registration"})* @Assert\Length(max="100", groups={"registration"})*/private $email;/*** @Gedmo\Slug(fields={"email"})* @ORM\Column(name="slug", length=128)*/private $slug;/*** @var $token* @ORM\Column(name="token", type="string", length=191, nullable=true)*/private $token = null;/*** @var $registrationToken* @ORM\Column(name="registration_token", type="string", length=191, nullable=true)*/private $registrationToken = null;/*** @ORM\Column(name="menu_visibility", type="boolean")*/private $menuVisibility = false;/*** @ORM\ManyToOne(targetEntity="App\Entity\City")* @ORM\JoinColumn(name="city")*/private $city;/*** @ORM\OneToMany(* targetEntity="App\Entity\NotificationSystem",* mappedBy="recipient",* fetch="EXTRA_LAZY",* orphanRemoval=true,* cascade={"persist"}* )*/private $notification;/*** @ORM\OneToMany(* targetEntity="App\Entity\TenderUser",* mappedBy="user",* fetch="EXTRA_LAZY",* orphanRemoval=true,* cascade={"persist"}* )*/private $tenderUser;public function __construct(){$this->tenderUser = new ArrayCollection();}/*** @return mixed*/public function getFirstName(){return $this->firstName;}/*** @param mixed $firstName* @return User*/public function setFirstName($firstName): self{$this->firstName = $firstName;return $this;}/*** @return mixed*/public function getLastName(){return $this->lastName;}/*** @param mixed $lastName* @return User*/public function setLastName($lastName): self{$this->lastName = $lastName;return $this;}/*** @return mixed*/public function getSlug(){return $this->slug;}/*** @param mixed $slug* @return User*/public function setSlug($slug): self{$this->slug = $slug;return $this;}/*** @return mixed*/public function getPlainPassword(){return $this->plainPassword;}/*** @param mixed $plainPassword* @return User*/public function setPlainPassword($plainPassword): self{$this->plainPassword = $plainPassword;$this->password = null;return $this;}public function getPassword(): ?string{return $this->password;}/*** @param string $password* @return User*/public function setPassword(string $password): self{$this->password = $password;return $this;}/*** @return mixed*/public function getEmail(){return $this->email;}/*** @param mixed $email* @return User*/public function setEmail($email): self{$this->email = $email;return $this;}public function getUsername(){return $this->email;}public function getRoles() :array{$roles = $this->roles;// guarantee every user at least has ROLE_USER$roles[] = 'ROLE_USER';return array_unique($roles);}/*** @param array $roles* @return $this*/public function setRoles(array $roles): self{$this->roles = $roles;return $this;}/*** @return mixed*/public function getToken(){return $this->token;}/*** @param mixed $token* @return User*/public function setToken($token): self{$this->token = $token;return $this;}/*** @return mixed*/public function getRegistrationToken(){return $this->registrationToken;}/*** @param mixed $registrationToken* @return User*/public function setRegistrationToken($registrationToken): self{$this->registrationToken = $registrationToken;return $this;}/*** @return string*/public function getFullName(): string{return $this->getFirstName() . ' ' . $this->getLastName();}/*** @return bool*/public function isMenuVisibility(): bool{return $this->menuVisibility;}/*** @param bool $menuVisibility*/public function setMenuVisibility(bool $menuVisibility): void{$this->menuVisibility = $menuVisibility;}/*** @return mixed*/public function getNotification(){return $this->notification;}/*** @param mixed $notification*/public function setNotification($notification): void{$this->notification = $notification;}/*** @return ArrayCollection*/public function getTenderUser(): ArrayCollection{return $this->tenderUser;}/*** @return mixed*/public function getCity(){return $this->city;}/*** @param mixed $city*/public function setCity($city): void{$this->city = $city;}/*** @return int*/public function isNotificationsUnread(){/** @var NotificationSystem $n */foreach ($this->getNotification() as $n) {if (null === $n->getReadDate()) {return true;}}return false;}/*** @return bool|int*/public function getReference(){}public function getSalt(){}public function eraseCredentials(){}/*** The equality comparison should neither be done by referential equality* nor by comparing identities (i.e. getId() === getId()).** However, you do not need to compare every attribute, but only those that* are relevant for assessing whether re-authentication is required.** Also implementation should consider that $user instance may implement* the extended user interface `AdvancedUserInterface`.** @param UserInterface $user** @return bool*/public function isEqualTo(UserInterface $user): bool{return $user->getPassword() === $this->getPassword();}/*** @return string*/public function getUserIdentifier():string{return $this->getUsername();}}