<?php
declare(strict_types=1);
namespace App\Entity;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
use App\Repository\CustomerRepository;
/**
* Customer
*
* @ORM\Table(name="customer")
* @ORM\Entity(repositoryClass=CustomerRepository::class)
*/
class Customer implements UserInterface, PasswordAuthenticatedUserInterface
{
public const SERIALIZATION_GROUP_LISTING = 'customer_listing';
/**
* @var int
*
* @ORM\Column(name="id", type="smallint", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
* @Groups({self::SERIALIZATION_GROUP_LISTING})
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="name", type="string", length=100, nullable=false)
* @Groups({self::SERIALIZATION_GROUP_LISTING})
*/
private $name;
/**
* @var string|null
*
* @ORM\Column(name="contact_1", type="string", length=80, nullable=true, options={"default"="NULL"})
* @Groups({self::SERIALIZATION_GROUP_LISTING})
*/
private $contact1 = null;
/**
* @var string|null
*
* @ORM\Column(name="email_1", type="string", length=80, nullable=true, options={"default"="NULL"})
*/
private $email1 = null;
/**
* @var string|null
*
* @ORM\Column(name="phone_1", type="string", length=40, nullable=true, options={"default"="NULL"})
* @Groups({self::SERIALIZATION_GROUP_LISTING})
*/
private $phone1 = null;
/**
* @var string|null
*
* @ORM\Column(name="contact_2", type="string", length=80, nullable=true, options={"default"="NULL"})
* @Groups({self::SERIALIZATION_GROUP_LISTING})
*/
private $contact2 = null;
/**
* @var string|null
*
* @ORM\Column(name="email_2", type="string", length=80, nullable=true, options={"default"="NULL"})
*/
private $email2 = null;
/**
* @var string|null
*
* @ORM\Column(name="phone_2", type="string", length=40, nullable=true, options={"default"="NULL"})
* @Groups({self::SERIALIZATION_GROUP_LISTING})
*/
private $phone2 = null;
/**
* @var string|null
*
* @ORM\Column(name="logo", type="string", length=100, nullable=true, options={"default"="NULL"})
*/
private $logo = null;
/**
* @var string|null
*
* @ORM\Column(name="username", type="string", length=40, nullable=true, options={"default"="NULL"})
*/
private $username = null;
/**
* @var string|null
*
* @ORM\Column(name="password", type="string", length=250, nullable=true, options={"default"="NULL"})
*/
private $password = null;
/**
* @var string|null
*
* @ORM\Column(name="path", type="string", length=20, nullable=true, options={"default"="NULL"})
*/
private $path = null;
/**
* @var bool
*
* @ORM\Column(name="is_active", type="boolean", nullable=false)
*/
private $isActive = true;
/**
* @var Collection
*
* @ORM\OneToMany(targetEntity=CustomerExcludeCsp::class, mappedBy="customer")
*/
private $excludedCsps;
private $plainPassword;
/**
* Constructor
*/
public function __construct()
{
$this->excludedCsps = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getContact1(): ?string
{
return $this->contact1;
}
public function setContact1(?string $contact1): self
{
$this->contact1 = $contact1;
return $this;
}
public function getEmail1(): ?string
{
return $this->email1;
}
public function setEmail1(?string $email1): self
{
$this->email1 = $email1;
return $this;
}
public function getPhone1(): ?string
{
return $this->phone1;
}
public function setPhone1(?string $phone1): self
{
$this->phone1 = $phone1;
return $this;
}
public function getContact2(): ?string
{
return $this->contact2;
}
public function setContact2(?string $contact2): self
{
$this->contact2 = $contact2;
return $this;
}
public function getEmail2(): ?string
{
return $this->email2;
}
public function setEmail2(?string $email2): self
{
$this->email2 = $email2;
return $this;
}
public function getPhone2(): ?string
{
return $this->phone2;
}
public function setPhone2(?string $phone2): self
{
$this->phone2 = $phone2;
return $this;
}
public function getLogo(): ?string
{
return $this->logo;
}
public function setLogo(?string $logo): self
{
$this->logo = $logo;
return $this;
}
public function getUsername(): ?string
{
return $this->username;
}
public function setUsername(?string $username): self
{
$this->username = $username;
return $this;
}
public function getPassword(): ?string
{
return $this->password;
}
public function setPassword(?string $password): self
{
$this->password = $password;
return $this;
}
public function getPath(): ?string
{
return $this->path;
}
public function setPath(?string $path): self
{
$this->path = $path;
return $this;
}
public function isIsActive(): ?bool
{
return $this->isActive;
}
public function setIsActive(bool $isActive): self
{
$this->isActive = $isActive;
return $this;
}
public function getPlainPassword(): ?string
{
return $this->plainPassword;
}
public function setPlainPassword(?string $plainPassword): self
{
$this->plainPassword = $plainPassword;
return $this;
}
/**
* @see UserInterface
*/
public function getUserIdentifier(): string
{
return (string) $this->username;
}
/**
* @see UserInterface
*/
public function getRoles(): array
{
return ['ROLE_CUSTOMER'];
}
/**
* @see UserInterface
*/
public function eraseCredentials()
{
// If you store any temporary, sensitive data on the user, clear it here
// $this->plainPassword = null;
}
/**
* @return Collection<int, CustomerExcludeCsp>
*/
public function getExcludedCsps(): Collection
{
return $this->excludedCsps;
}
public function addExcludedCsp(CustomerExcludeCsp $excludedCsp): self
{
if (!$this->excludedCsps->contains($excludedCsp)) {
$this->excludedCsps[] = $excludedCsp;
$excludedCsp->setCustomer($this);
}
return $this;
}
public function removeExcludedCsp(CustomerExcludeCsp $excludedCsp): self
{
if ($this->excludedCsps->removeElement($excludedCsp)) {
// set the owning side to null (unless already changed)
if ($excludedCsp->getCustomer() === $this) {
$excludedCsp->setCustomer(null);
}
}
return $this;
}
}