src/Entity/Customer.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Traits\EntityTrait;
  4. use App\Repository\CustomerRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. /**
  9.  * @ORM\Entity(repositoryClass=CustomerRepository::class)
  10.  */
  11. class Customer
  12. {
  13.     use EntityTrait{
  14.         EntityTrait::__construct as private __entityConstruct;
  15.     }
  16.     /**
  17.      * @ORM\Id
  18.      * @ORM\GeneratedValue
  19.      * @ORM\Column(type="integer")
  20.      */
  21.     private $id;
  22.     /**
  23.      * @ORM\Column(type="string", length=255)
  24.      */
  25.     private $type;
  26.     /**
  27.      * @ORM\Column(type="string", length=255, nullable=true)
  28.      */
  29.     private $code_lockup;
  30.     /**
  31.      * @ORM\Column(type="string", length=255)
  32.      */ 
  33.     private $company;
  34.     /**
  35.      * @ORM\Column(type="string", length=255, nullable=true)
  36.      */
  37.     private $email;
  38.     /**
  39.      * @ORM\Column(type="string", length=255)
  40.      */
  41.     private $address;
  42.     /**
  43.      * @ORM\Column(type="string", length=255)
  44.      */
  45.     private $postal_code;
  46.     /**
  47.      * @ORM\Column(type="string", length=255)
  48.      */
  49.     private $city;
  50.     /**
  51.      * @ORM\Column(type="string", length=255, nullable=true)
  52.      */
  53.     private $phone;
  54.     /**
  55.      * @ORM\ManyToOne(targetEntity=User::class, inversedBy="customers")
  56.      * @ORM\JoinColumn(nullable=true)
  57.      */
  58.     private $user;
  59.     /**
  60.      * @ORM\OneToMany(targetEntity=CustomerContact::class, mappedBy="customer", cascade={"persist", "remove"})
  61.      */
  62.     private $customerContacts;
  63.     public function __construct()
  64.     {
  65.         $this->__entityConstruct();
  66.         $this->customerContacts = new ArrayCollection();
  67.     }
  68.     public function getId(): ?int
  69.     {
  70.         return $this->id;
  71.     }
  72.     public function getType(): ?string
  73.     {
  74.         return $this->type;
  75.     }
  76.     public function setType(string $type): self
  77.     {
  78.         $this->type $type;
  79.         return $this;
  80.     }
  81.     public function getCodeLockup(): ?string
  82.     {
  83.         return $this->code_lockup;
  84.     }
  85.     public function setCodeLockup(?string $code_lockup): self
  86.     {
  87.         $this->code_lockup $code_lockup;
  88.         return $this;
  89.     }
  90.     public function getCompany(): ?string
  91.     {
  92.         return $this->company;
  93.     }
  94.     public function setCompany(string $company): self
  95.     {
  96.         $this->company $company;
  97.         return $this;
  98.     }
  99.     public function getEmail(): ?string
  100.     {
  101.         return $this->email;
  102.     }
  103.     public function setEmail(?string $email): self
  104.     {
  105.         $this->email $email;
  106.         return $this;
  107.     }
  108.     public function getPhone(): ?string
  109.     {
  110.         return $this->phone;
  111.     }
  112.     public function setPhone(?string $phone): self
  113.     {
  114.         $this->phone $phone;
  115.         return $this;
  116.     }
  117.     public function getUser(): ?User
  118.     {
  119.         return $this->user;
  120.     }
  121.     public function setUser(?User $user): self
  122.     {
  123.         $this->user $user;
  124.         return $this;
  125.     }
  126.     /**
  127.      * @return Collection|CustomerContact[]
  128.      */
  129.     public function getCustomerContacts(): Collection
  130.     {
  131.         return $this->customerContacts;
  132.     }
  133.     public function addCustomerContact(CustomerContact $customerContact): self
  134.     {
  135.         if (!$this->customerContacts->contains($customerContact)) {
  136.             $this->customerContacts[] = $customerContact;
  137.             $customerContact->setCustomer($this);
  138.         }
  139.         return $this;
  140.     }
  141.     public function removeCustomerContact(CustomerContact $customerContact): self
  142.     {
  143.         if ($this->customerContacts->removeElement($customerContact)) {
  144.             // set the owning side to null (unless already changed)
  145.             if ($customerContact->getCustomer() === $this) {
  146.                 $customerContact->setCustomer(null);
  147.             }
  148.         }
  149.         return $this;
  150.     }
  151.     public function getAddress(): ?string
  152.     {
  153.         return $this->address;
  154.     }
  155.     public function setAddress(string $address): self
  156.     {
  157.         $this->address $address;
  158.         return $this;
  159.     }
  160.     public function getPostalCode(): ?string
  161.     {
  162.         return $this->postal_code;
  163.     }
  164.     public function setPostalCode(string $postal_code): self
  165.     {
  166.         $this->postal_code $postal_code;
  167.         return $this;
  168.     }
  169.     public function getCity(): ?string
  170.     {
  171.         return $this->city;
  172.     }
  173.     public function setCity(string $city): self
  174.     {
  175.         $this->city $city;
  176.         return $this;
  177.     }
  178. }