src/Entity/MafoPublisher.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Symfony\Component\Security\Core\User\UserInterface;
  5. use Symfony\Component\Validator\Constraints as Assert;
  6. /**
  7.  * @ORM\Entity(repositoryClass="App\Repository\MafoPublisherRepository")
  8.  */
  9. class MafoPublisher implements UserInterface\Serializable
  10. {
  11.     /**
  12.      * @ORM\Id
  13.      * @ORM\GeneratedValue
  14.      * @ORM\Column(type="integer")
  15.      */
  16.     private $id;
  17.     /**
  18.      * @ORM\Column(type="string", unique=true)
  19.      * @Assert\NotBlank
  20.      * @Assert\Email
  21.      */
  22.     private $email;
  23.     /**
  24.      * @ORM\Column(type="string")
  25.      * @Assert\NotBlank
  26.      */
  27.     private $firstName;
  28.     /**
  29.      * @ORM\Column(type="string", nullable=true)
  30.      */
  31.     private $lastName;
  32.     /**
  33.      * @ORM\Column(type="string", nullable=true)
  34.      */
  35.     private $password;
  36.     /**
  37.      * @ORM\Column(type="string")
  38.      * @Assert\NotBlank
  39.      */
  40.     private $status;
  41.     /**
  42.      * @ORM\Column(type="datetime", nullable=true)
  43.      */
  44.     private $lastLoginAt;
  45.     /**
  46.      * @ORM\Column(type="datetime")
  47.      * @Assert\NotBlank
  48.      */
  49.     private $dateUpdated;
  50.     /**
  51.      * @ORM\Column(type="datetime")
  52.      * @Assert\NotBlank
  53.      */
  54.     private $dateInserted;
  55.     // Getters
  56.     public function getId(): ?int
  57.     {
  58.         return $this->id;
  59.     }
  60.     public function getEmail(): ?string
  61.     {
  62.         return $this->email;
  63.     }
  64.     public function getFirstName(): ?string
  65.     {
  66.         return $this->firstName;
  67.     }
  68.     public function getLastName(): ?string
  69.     {
  70.         return $this->lastName;
  71.     }
  72.     public function getPassword(): ?string
  73.     {
  74.         return $this->password;
  75.     }
  76.     public function getRoles(): array
  77.     {
  78.         return array('ROLE_MAFO_PUBLISHER');
  79.     }
  80.     public function getStatus(): ?string
  81.     {
  82.         return $this->status;
  83.     }
  84.     public function getLastLoginAt(): ?\DateTimeInterface
  85.     {
  86.         return $this->lastLoginAt;
  87.     }
  88.     public function getDateUpdated(): \DateTimeInterface
  89.     {
  90.         return $this->dateUpdated;
  91.     }
  92.     public function getDateInserted(): \DateTimeInterface
  93.     {
  94.         return $this->dateInserted;
  95.     }
  96.     // Setters
  97.     public function setEmail(string $email): self
  98.     {
  99.         $this->email $email;
  100.         return $this;
  101.     }
  102.     public function setFirstName(string $firstName): self
  103.     {
  104.         $this->firstName $firstName;
  105.         return $this;
  106.     }
  107.     public function setLastName(?string $lastName): self
  108.     {
  109.         $this->lastName $lastName;
  110.         return $this;
  111.     }
  112.     public function setPassword(?string $password): self
  113.     {
  114.         $this->password $password;
  115.         return $this;
  116.     }
  117.     public function setStatus(string $status): self
  118.     {
  119.         $this->status $status;
  120.         return $this;
  121.     }
  122.     public function setLastLoginAt(?\DateTimeInterface $lastLoginAt): self
  123.     {
  124.         $this->lastLoginAt $lastLoginAt;
  125.         return $this;
  126.     }
  127.     public function setDateUpdated(\DateTimeInterface $dateUpdated): self
  128.     {
  129.         $this->dateUpdated $dateUpdated;
  130.         return $this;
  131.     }
  132.     public function setDateInserted(\DateTimeInterface $dateInserted): self
  133.     {
  134.         $this->dateInserted $dateInserted;
  135.         return $this;
  136.     }
  137.     // Add this method if it's not already implemented
  138.     public function getUserIdentifier(): string
  139.     {
  140.         // Ensure email is not null
  141.         return $this->email ?? '';
  142.     }
  143.     public function getSalt()
  144.     {
  145.         // TODO: Implement getSalt() method.
  146.     }
  147.     public function eraseCredentials()
  148.     {
  149.         // TODO: Implement eraseCredentials() method.
  150.     }
  151.     public function getUsername()
  152.     {
  153.         // TODO: Implement getUsername() method.
  154.     }
  155.     /** @see \Serializable::serialize() */
  156.     public function serialize(): string
  157.     {
  158.         return serialize([
  159.             $this->id,
  160.             $this->email,
  161.             $this->firstName,
  162.             $this->lastName,
  163.             $this->password,
  164.             $this->status,
  165.             $this->lastLoginAt $this->lastLoginAt->format('c') : null// ISO 8601 date format
  166.         ]);
  167.     }
  168.     /** @see \Serializable::unserialize() */
  169.     public function unserialize($serialized): void
  170.     {
  171.         list (
  172.             $this->id,
  173.             $this->email,
  174.             $this->firstName,
  175.             $this->lastName,
  176.             $this->password,
  177.             $this->status,
  178.             $lastLoginAtSerialized
  179.             ) = unserialize($serialized, ['allowed_classes' => false]);
  180.         $this->lastLoginAt $lastLoginAtSerialized \DateTime::createFromFormat('c'$lastLoginAtSerialized) : null;
  181.     }
  182.     public function __call(string $name, array $arguments)
  183.     {
  184.         // TODO: Implement @method string getUserIdentifier()
  185.     }
  186. }