<?php
namespace App\Entity;
use App\Entity\Traits\EntityTrait;
use App\Repository\CustomerRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=CustomerRepository::class)
*/
class Customer
{
use EntityTrait{
EntityTrait::__construct as private __entityConstruct;
}
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $type;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $code_lockup;
/**
* @ORM\Column(type="string", length=255)
*/
private $company;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $email;
/**
* @ORM\Column(type="string", length=255)
*/
private $address;
/**
* @ORM\Column(type="string", length=255)
*/
private $postal_code;
/**
* @ORM\Column(type="string", length=255)
*/
private $city;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $phone;
/**
* @ORM\ManyToOne(targetEntity=User::class, inversedBy="customers")
* @ORM\JoinColumn(nullable=true)
*/
private $user;
/**
* @ORM\OneToMany(targetEntity=CustomerContact::class, mappedBy="customer", cascade={"persist", "remove"})
*/
private $customerContacts;
public function __construct()
{
$this->__entityConstruct();
$this->customerContacts = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getType(): ?string
{
return $this->type;
}
public function setType(string $type): self
{
$this->type = $type;
return $this;
}
public function getCodeLockup(): ?string
{
return $this->code_lockup;
}
public function setCodeLockup(?string $code_lockup): self
{
$this->code_lockup = $code_lockup;
return $this;
}
public function getCompany(): ?string
{
return $this->company;
}
public function setCompany(string $company): self
{
$this->company = $company;
return $this;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(?string $email): self
{
$this->email = $email;
return $this;
}
public function getPhone(): ?string
{
return $this->phone;
}
public function setPhone(?string $phone): self
{
$this->phone = $phone;
return $this;
}
public function getUser(): ?User
{
return $this->user;
}
public function setUser(?User $user): self
{
$this->user = $user;
return $this;
}
/**
* @return Collection|CustomerContact[]
*/
public function getCustomerContacts(): Collection
{
return $this->customerContacts;
}
public function addCustomerContact(CustomerContact $customerContact): self
{
if (!$this->customerContacts->contains($customerContact)) {
$this->customerContacts[] = $customerContact;
$customerContact->setCustomer($this);
}
return $this;
}
public function removeCustomerContact(CustomerContact $customerContact): self
{
if ($this->customerContacts->removeElement($customerContact)) {
// set the owning side to null (unless already changed)
if ($customerContact->getCustomer() === $this) {
$customerContact->setCustomer(null);
}
}
return $this;
}
public function getAddress(): ?string
{
return $this->address;
}
public function setAddress(string $address): self
{
$this->address = $address;
return $this;
}
public function getPostalCode(): ?string
{
return $this->postal_code;
}
public function setPostalCode(string $postal_code): self
{
$this->postal_code = $postal_code;
return $this;
}
public function getCity(): ?string
{
return $this->city;
}
public function setCity(string $city): self
{
$this->city = $city;
return $this;
}
}