<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity(repositoryClass="App\Repository\MafoPublisherRepository")
*/
class MafoPublisher implements UserInterface, \Serializable
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", unique=true)
* @Assert\NotBlank
* @Assert\Email
*/
private $email;
/**
* @ORM\Column(type="string")
* @Assert\NotBlank
*/
private $firstName;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $lastName;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $password;
/**
* @ORM\Column(type="string")
* @Assert\NotBlank
*/
private $status;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $lastLoginAt;
/**
* @ORM\Column(type="datetime")
* @Assert\NotBlank
*/
private $dateUpdated;
/**
* @ORM\Column(type="datetime")
* @Assert\NotBlank
*/
private $dateInserted;
// Getters
public function getId(): ?int
{
return $this->id;
}
public function getEmail(): ?string
{
return $this->email;
}
public function getFirstName(): ?string
{
return $this->firstName;
}
public function getLastName(): ?string
{
return $this->lastName;
}
public function getPassword(): ?string
{
return $this->password;
}
public function getRoles(): array
{
return array('ROLE_MAFO_PUBLISHER');
}
public function getStatus(): ?string
{
return $this->status;
}
public function getLastLoginAt(): ?\DateTimeInterface
{
return $this->lastLoginAt;
}
public function getDateUpdated(): \DateTimeInterface
{
return $this->dateUpdated;
}
public function getDateInserted(): \DateTimeInterface
{
return $this->dateInserted;
}
// Setters
public function setEmail(string $email): self
{
$this->email = $email;
return $this;
}
public function setFirstName(string $firstName): self
{
$this->firstName = $firstName;
return $this;
}
public function setLastName(?string $lastName): self
{
$this->lastName = $lastName;
return $this;
}
public function setPassword(?string $password): self
{
$this->password = $password;
return $this;
}
public function setStatus(string $status): self
{
$this->status = $status;
return $this;
}
public function setLastLoginAt(?\DateTimeInterface $lastLoginAt): self
{
$this->lastLoginAt = $lastLoginAt;
return $this;
}
public function setDateUpdated(\DateTimeInterface $dateUpdated): self
{
$this->dateUpdated = $dateUpdated;
return $this;
}
public function setDateInserted(\DateTimeInterface $dateInserted): self
{
$this->dateInserted = $dateInserted;
return $this;
}
// Add this method if it's not already implemented
public function getUserIdentifier(): string
{
// Ensure email is not null
return $this->email ?? '';
}
public function getSalt()
{
// TODO: Implement getSalt() method.
}
public function eraseCredentials()
{
// TODO: Implement eraseCredentials() method.
}
public function getUsername()
{
// TODO: Implement getUsername() method.
}
/** @see \Serializable::serialize() */
public function serialize(): string
{
return serialize([
$this->id,
$this->email,
$this->firstName,
$this->lastName,
$this->password,
$this->status,
$this->lastLoginAt ? $this->lastLoginAt->format('c') : null, // ISO 8601 date format
]);
}
/** @see \Serializable::unserialize() */
public function unserialize($serialized): void
{
list (
$this->id,
$this->email,
$this->firstName,
$this->lastName,
$this->password,
$this->status,
$lastLoginAtSerialized
) = unserialize($serialized, ['allowed_classes' => false]);
$this->lastLoginAt = $lastLoginAtSerialized ? \DateTime::createFromFormat('c', $lastLoginAtSerialized) : null;
}
public function __call(string $name, array $arguments)
{
// TODO: Implement @method string getUserIdentifier()
}
}