<?php
namespace App\Entity;
use App\Repository\CustomerRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
use Symfony\Component\Security\Core\User\UserInterface;
/**
* @ORM\Entity(repositoryClass=CustomerRepository::class)
*/
class Customer implements UserInterface, PasswordAuthenticatedUserInterface
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $customerId;
/**
* @ORM\Column(type="string", length=300, nullable=true)
*/
private $name;
/**
* @ORM\Column(type="string", length=300, nullable=true)
*/
private $email;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $verified_email;
/**
* @ORM\Column(type="string", length=300, nullable=true)
*/
private $status;
/**
* @var string The hashed password
* @ORM\Column(type="string")
*/
private $password;
/**
* @ORM\ManyToOne(targetEntity=Client::class)
* @ORM\JoinColumn(name="client_id", referencedColumnName="client_id", nullable=false)
*/
private $Client;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $created_at;
/**
* @ORM\ManyToOne(targetEntity=User::class)
* @ORM\JoinColumn(name="created_by", referencedColumnName="id", nullable=false)
*/
private $CreatedBy;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $payment_client_token;
public function getCustomerId(): ?int
{
return $this->customerId;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(?string $name): self
{
$this->name = $name;
return $this;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(?string $email): self
{
$this->email = $email;
return $this;
}
public function getVerifiedEmail(): ?bool
{
return $this->verified_email;
}
public function setVerifiedEmail(?bool $verified_email): self
{
$this->verified_email = $verified_email;
return $this;
}
public function getStatus(): ?string
{
return $this->status;
}
public function setStatus(?string $status): self
{
$this->status = $status;
return $this;
}
/**
* @see PasswordAuthenticatedUserInterface
*/
public function getPassword(): ?string
{
return $this->password;
}
public function setPassword(?string $password): self
{
$this->password = $password;
return $this;
}
public function getClient(): ?Client
{
return $this->Client;
}
public function setClient(?Client $Client): self
{
$this->Client = $Client;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->created_at;
}
public function setCreatedAt(?\DateTimeInterface $created_at): self
{
$this->created_at = $created_at;
return $this;
}
public function getCreatedBy(): ?User
{
return $this->CreatedBy;
}
public function setCreatedBy(?User $CreatedBy): self
{
$this->CreatedBy = $CreatedBy;
return $this;
}
/**
* Returning a salt is only needed, if you are not using a modern
* hashing algorithm (e.g. bcrypt or sodium) in your security.yaml.
*
* @see UserInterface
*/
public function getSalt(): ?string
{
return null;
}
/**
* @see UserInterface
*/
public function eraseCredentials()
{
// If you store any temporary, sensitive data on the user, clear it here
// $this->plainPassword = null;
}
public function __toString()
{
return $this->email;
}
/**
* @see UserInterface
*/
public function getRoles(): array
{
//$roles = $this->UserRole;
// guarantee every user at least has ROLE_USER
$roles[] = 'ROLE_USER';
return $roles;
}
/**
* @deprecated since Symfony 5.3, use getUserIdentifier instead
*/
public function getUsername(): string
{
return (string) $this->email;
}
public function getPaymentClientToken(): ?string
{
return $this->payment_client_token;
}
public function setPaymentClientToken(?string $payment_client_token): self
{
$this->payment_client_token = $payment_client_token;
return $this;
}
public function getUserIdentifier(): string
{
return (string) $this->email; // o cualquier campo Ășnico de login
}
}