Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace AppBundle\Entity;
- use Doctrine\ORM\Mapping as ORM;
- use Symfony\Component\Security\Core\User\UserInterface;
- use Symfony\Component\Validator\Constraints as Assert;
- /**
- * A user.
- *
- * @ORM\Entity(repositoryClass="AppBundle\Repository\UserRepository")
- */
- class User implements UserInterface, \Serializable
- {
- /**
- * @var integer
- *
- * @ORM\Column(type="integer")
- * @ORM\Id
- * @ORM\GeneratedValue(strategy="AUTO")
- */
- private $id;
- /**
- * @var string
- *
- * @ORM\Column(type="string", unique=true)
- * @Assert\NotBlank
- * @AssertLength(max=255)
- */
- private $username;
- /**
- * @var string
- *
- * @ORM\Column(type="string")
- */
- private $password;
- /**
- * @var string
- *
- * @ORM\Column(type="string", length=60, unique=true)
- * @Assert\NotBlank
- * @Assert\Email
- */
- private $email;
- /**
- * @var boolean
- *
- * @ORM\Column(name="is_active", type="boolean")
- */
- private $active = true;
- public function getUsername(): ?string
- {
- return $this->username;
- }
- public function getSalt(): ?string
- {
- return null;
- }
- public function getPassword(): ?string
- {
- return $this->password;
- }
- public function getRoles(): array
- {
- return ['ROLE_USER'];
- }
- public function eraseCredentials(): void
- {
- }
- public function serialize(): string
- {
- return serialize([
- $this->id,
- $this->username,
- $this->password
- ]);
- }
- public function unserialize(string $serialized)
- {
- [$this->id, $this->username, $this->password] = unserialize($serialized);
- }
- public function getId(): ?int
- {
- return $this->id;
- }
- public function setId(int $id)
- {
- $this->id = $id;
- }
- public function getEmail(): ?string
- {
- return $this->email;
- }
- public function setEmail(string $email)
- {
- $this->email = $email;
- }
- public function isActive(): bool
- {
- return $this->active;
- }
- public function setActive(bool $isActive): void
- {
- $this->isActive = $isActive;
- }
- public function setUsername(string $username): void
- {
- $this->username = $username;
- }
- public function setPassword(string $password): void
- {
- $this->password = $password;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement