src/Entity/Customer.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\CustomerRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
  6. use Symfony\Component\Security\Core\User\UserInterface;
  7. /**
  8.  * @ORM\Entity(repositoryClass=CustomerRepository::class)
  9.  */
  10. class Customer implements UserInterfacePasswordAuthenticatedUserInterface
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $customerId;
  18.     /**
  19.      * @ORM\Column(type="string", length=300, nullable=true)
  20.      */
  21.     private $name;
  22.     /**
  23.      * @ORM\Column(type="string", length=300, nullable=true)
  24.      */
  25.     private $email;
  26.     /**
  27.      * @ORM\Column(type="boolean", nullable=true)
  28.      */
  29.     private $verified_email;
  30.     /**
  31.      * @ORM\Column(type="string", length=300, nullable=true)
  32.      */
  33.     private $status;
  34.     /**
  35.      * @var string The hashed password
  36.      * @ORM\Column(type="string")
  37.      */
  38.     private $password;
  39.     /**
  40.      * @ORM\ManyToOne(targetEntity=Client::class)
  41.      * @ORM\JoinColumn(name="client_id", referencedColumnName="client_id", nullable=false)
  42.      */
  43.     private $Client;
  44.     /**
  45.      * @ORM\Column(type="datetime", nullable=true)
  46.      */
  47.     private $created_at;
  48.     /**
  49.      * @ORM\ManyToOne(targetEntity=User::class)
  50.      * @ORM\JoinColumn(name="created_by", referencedColumnName="id", nullable=false)
  51.      */
  52.     private $CreatedBy;
  53.     /**
  54.      * @ORM\Column(type="string", length=255, nullable=true)
  55.      */
  56.     private $payment_client_token;
  57.     public function getCustomerId(): ?int
  58.     {
  59.         return $this->customerId;
  60.     }
  61.     public function getName(): ?string
  62.     {
  63.         return $this->name;
  64.     }
  65.     public function setName(?string $name): self
  66.     {
  67.         $this->name $name;
  68.         return $this;
  69.     }
  70.     public function getEmail(): ?string
  71.     {
  72.         return $this->email;
  73.     }
  74.     public function setEmail(?string $email): self
  75.     {
  76.         $this->email $email;
  77.         return $this;
  78.     }
  79.     public function getVerifiedEmail(): ?bool
  80.     {
  81.         return $this->verified_email;
  82.     }
  83.     public function setVerifiedEmail(?bool $verified_email): self
  84.     {
  85.         $this->verified_email $verified_email;
  86.         return $this;
  87.     }
  88.     public function getStatus(): ?string
  89.     {
  90.         return $this->status;
  91.     }
  92.     public function setStatus(?string $status): self
  93.     {
  94.         $this->status $status;
  95.         return $this;
  96.     }
  97.     
  98.     /**
  99.      * @see PasswordAuthenticatedUserInterface
  100.      */
  101.     public function getPassword(): ?string
  102.     {
  103.         return $this->password;
  104.     }
  105.     public function setPassword(?string $password): self
  106.     {
  107.         $this->password $password;
  108.         return $this;
  109.     }
  110.     public function getClient(): ?Client
  111.     {
  112.         return $this->Client;
  113.     }
  114.     public function setClient(?Client $Client): self
  115.     {
  116.         $this->Client $Client;
  117.         return $this;
  118.     }
  119.     public function getCreatedAt(): ?\DateTimeInterface
  120.     {
  121.         return $this->created_at;
  122.     }
  123.     public function setCreatedAt(?\DateTimeInterface $created_at): self
  124.     {
  125.         $this->created_at $created_at;
  126.         return $this;
  127.     }
  128.     public function getCreatedBy(): ?User
  129.     {
  130.         return $this->CreatedBy;
  131.     }
  132.     public function setCreatedBy(?User $CreatedBy): self
  133.     {
  134.         $this->CreatedBy $CreatedBy;
  135.         return $this;
  136.     }
  137.     
  138.     /**
  139.      * Returning a salt is only needed, if you are not using a modern
  140.      * hashing algorithm (e.g. bcrypt or sodium) in your security.yaml.
  141.      *
  142.      * @see UserInterface
  143.      */
  144.     public function getSalt(): ?string
  145.     {
  146.         return null;
  147.     }
  148.     
  149.     /**
  150.      * @see UserInterface
  151.      */
  152.     public function eraseCredentials()
  153.     {
  154.         // If you store any temporary, sensitive data on the user, clear it here
  155.         // $this->plainPassword = null;
  156.     }
  157.     
  158.     public function __toString()
  159.     {
  160.         return $this->email;
  161.     }
  162.     
  163.     /**
  164.      * @see UserInterface
  165.      */
  166.     public function getRoles(): array
  167.     {
  168.         //$roles = $this->UserRole;
  169.         // guarantee every user at least has ROLE_USER
  170.         $roles[] = 'ROLE_USER';
  171.     
  172.         return $roles;
  173.     }
  174.     
  175.     /**
  176.      * @deprecated since Symfony 5.3, use getUserIdentifier instead
  177.      */
  178.     public function getUsername(): string
  179.     {
  180.         return (string) $this->email;
  181.     }
  182.     public function getPaymentClientToken(): ?string
  183.     {
  184.         return $this->payment_client_token;
  185.     }
  186.     public function setPaymentClientToken(?string $payment_client_token): self
  187.     {
  188.         $this->payment_client_token $payment_client_token;
  189.         return $this;
  190.     }
  191.     public function getUserIdentifier(): string
  192.     {
  193.         return (string) $this->email;   // o cualquier campo Ășnico de login
  194.     }
  195. }