Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace App\Entity;
- use Doctrine\ORM\Mapping as ORM;
- use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
- use Symfony\Component\Security\Core\User\UserInterface;
- /**
- * @ORM\Entity(repositoryClass="App\Repository\UserRepository")
- * @UniqueEntity(fields={"username"}, message="Istnieje już konto o podanym loginie.")
- */
- class User implements UserInterface
- {
- /**
- * @ORM\Id()
- * @ORM\GeneratedValue()
- * @ORM\Column(type="integer")
- */
- private $id;
- /**
- * @ORM\Column(type="string", length=180, unique=true)
- */
- private $username;
- /**
- * @ORM\Column(type="json")
- */
- private $roles = [];
- /**
- * @var string The hashed password
- * @ORM\Column(type="string")
- */
- private $password;
- /**
- * @ORM\Column(type="string")
- */
- private $email;
- /**
- * @ORM\Column(type="boolean", nullable=true)
- */
- private $activated;
- /**
- * @ORM\Column(type="datetime", nullable=true)
- */
- private $created;
- /**
- * @ORM\Column(type="integer", nullable=true)
- */
- private $char_1;
- /**
- * @ORM\Column(type="integer", nullable=true)
- */
- private $char_2;
- /**
- * @ORM\Column(type="integer", nullable=true)
- */
- private $char_3;
- public function getId(): ?int
- {
- return $this->id;
- }
- /**
- * A visual identifier that represents this user.
- *
- * @see UserInterface
- */
- public function getUsername(): string
- {
- return (string) $this->username;
- }
- public function setUsername(string $username): self
- {
- $this->username = $username;
- return $this;
- }
- /**
- * @see UserInterface
- */
- public function getRoles(): array
- {
- $roles = $this->roles;
- // guarantee every user at least has ROLE_USER
- $roles[] = 'ROLE_USER';
- return array_unique($roles);
- }
- public function setRoles(array $roles): self
- {
- $this->roles = $roles;
- return $this;
- }
- /**
- * @see UserInterface
- */
- public function getPassword(): string
- {
- return (string) $this->password;
- }
- public function setPassword(string $password): self
- {
- $this->password = $password;
- return $this;
- }
- /**
- * @see UserInterface
- */
- public function getSalt()
- {
- // not needed when using the "bcrypt" algorithm in security.yaml
- }
- /**
- * @see UserInterface
- */
- public function eraseCredentials()
- {
- // If you store any temporary, sensitive data on the user, clear it here
- // $this->plainPassword = null;
- }
- /**
- * @see UserInterface
- */
- public function getEmail(): string
- {
- return (string) $this->email;
- }
- public function setEmail(string $email): self
- {
- $this->email = $email;
- return $this;
- }
- public function getActivated(): ?bool
- {
- return $this->activated;
- }
- public function setActivated(?bool $activated): self
- {
- $this->activated = $activated;
- return $this;
- }
- public function getCreated(): ?\DateTimeInterface
- {
- return $this->created;
- }
- public function setCreated(\DateTimeInterface $created): self
- {
- $this->created = $created;
- return $this;
- }
- public function getChar1(): ?int
- {
- return $this->char_1;
- }
- public function setChar1(?int $char_1): self
- {
- $this->char_1 = $char_1;
- return $this;
- }
- public function getChar2(): ?int
- {
- return $this->char_2;
- }
- public function setChar2(?int $char_2): self
- {
- $this->char_2 = $char_2;
- return $this;
- }
- public function getChar3(): ?int
- {
- return $this->char_3;
- }
- public function setChar3(?int $char_3): self
- {
- $this->char_3 = $char_3;
- return $this;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement