src/Entity/CRM/Customer.php line 15

  1. <?php
  2. namespace App\Entity\CRM;
  3. use App\Entity\CRM\Order;
  4. use App\Entity\CRM\OrderCustomerAddress;
  5. use App\Repository\CustomerRepository;
  6. use DateTime;
  7. use Doctrine\Common\Collections\ArrayCollection;
  8. use Doctrine\Common\Collections\Collection;
  9. use Doctrine\DBAL\Types\Types;
  10. use Doctrine\ORM\Mapping as ORM;
  11. #[ORM\Entity(repositoryClassCustomerRepository::class)]
  12. class Customer
  13. {
  14.     #[ORM\Id]
  15.     #[ORM\GeneratedValue]
  16.     #[ORM\Column]
  17.     private ?int $id null;
  18.     #[ORM\Column(length255)]
  19.     private ?string $name null;
  20.     #[ORM\Column(length255)]
  21.     private ?string $lastName null;
  22.     #[ORM\Column(length255)]
  23.     private ?string $firstName null;
  24.     #[ORM\Column(length255)]
  25.     private ?string $address null;
  26.     #[ORM\Column(length255)]
  27.     private ?string $city null;
  28.     #[ORM\Column(length255)]
  29.     private ?string $zipCode null;
  30.     #[ORM\Column(length255)]
  31.     private ?string $email null;
  32.     #[ORM\Column(length10)]
  33.     private ?string $companyNumber null;
  34.     #[ORM\Column(typeTypes::DATETIME_MUTABLE)]
  35.     private \DateTimeInterface $addedDate;
  36.     #[ORM\Column]
  37.     private ?bool $checkUser null;
  38.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  39.     private ?string $userNote null;
  40.     #[ORM\Column]
  41.     private ?bool $isActive null;
  42.     #[ORM\Column(nullabletrue)]
  43.     private ?int $old_id null;
  44.     #[ORM\OneToMany(mappedBy'customer'targetEntityCustomerAddress::class, cascade: ['persist'], orphanRemovaltrue)]
  45.     private Collection $customerAddresses;
  46.     #[ORM\OneToMany(mappedBy'customer'targetEntityOrder::class)]
  47.     private Collection $orders;
  48.     #[ORM\OneToMany(mappedBy'customer'targetEntityOrderCustomerAddress::class)]
  49.     private Collection $orderCustomerAddresses;
  50.     #[ORM\ManyToOne(inversedBy'customers')]
  51.     private ?Consultant $consultant null;
  52.     #[ORM\Column(length255nullabletrue)]
  53.     private ?string $phone null;
  54.     #[ORM\Column]
  55.     private ?bool $ordersBlock null;
  56.     #[ORM\OneToMany(mappedBy'customer'targetEntityCustomerHistory::class)]
  57.     private Collection $customerHistories;
  58.     #[ORM\Column(nullabletrue)]
  59.     private ?string $regon null;
  60.     public function __construct()
  61.     {
  62.         $this->addedDate = new DateTime();
  63.         $this->customerAddresses = new ArrayCollection();
  64.         $this->orders = new ArrayCollection();
  65.         $this->orderCustomerAddresses = new ArrayCollection();
  66.         $this->customerHistories = new ArrayCollection();
  67.     }
  68.     public function __toString()
  69.     {
  70.         return $this->getFirstName().' '.$this->getLastName();
  71.     }
  72.     public function getId(): ?int
  73.     {
  74.         return $this->id;
  75.     }
  76.     public function getName(): ?string
  77.     {
  78.         return $this->name;
  79.     }
  80.     public function setName(string $name): self
  81.     {
  82.         $this->name $name;
  83.         return $this;
  84.     }
  85.     public function getLastName(): ?string
  86.     {
  87.         return $this->lastName;
  88.     }
  89.     public function setLastName(string $lastName): self
  90.     {
  91.         $this->lastName $lastName;
  92.         return $this;
  93.     }
  94.     public function getFirstName(): ?string
  95.     {
  96.         return $this->firstName;
  97.     }
  98.     public function setFirstName(string $firstName): self
  99.     {
  100.         $this->firstName $firstName;
  101.         return $this;
  102.     }
  103.     public function getAddress(): ?string
  104.     {
  105.         return $this->address;
  106.     }
  107.     public function setAddress(string $address): self
  108.     {
  109.         $this->address $address;
  110.         return $this;
  111.     }
  112.     public function getCity(): ?string
  113.     {
  114.         return $this->city;
  115.     }
  116.     public function setCity(string $city): self
  117.     {
  118.         $this->city $city;
  119.         return $this;
  120.     }
  121.     public function getZipCode(): ?string
  122.     {
  123.         return $this->zipCode;
  124.     }
  125.     public function setZipCode(string $zipCode): self
  126.     {
  127.         $this->zipCode $zipCode;
  128.         return $this;
  129.     }
  130.     public function getEmail(): ?string
  131.     {
  132.         return $this->email;
  133.     }
  134.     public function setEmail(string $email): self
  135.     {
  136.         $this->email $email;
  137.         return $this;
  138.     }
  139.     public function getCompanyNumber(): ?int
  140.     {
  141.         return $this->companyNumber;
  142.     }
  143.     public function setCompanyNumber(int $companyNumber): self
  144.     {
  145.         $this->companyNumber $companyNumber;
  146.         return $this;
  147.     }
  148.     public function getAddedDate(): ?\DateTimeInterface
  149.     {
  150.         return $this->addedDate;
  151.     }
  152.     public function setAddedDate(\DateTimeInterface $addedDate): self
  153.     {
  154.         $this->addedDate $addedDate;
  155.         return $this;
  156.     }
  157.     public function isCheckUser(): ?bool
  158.     {
  159.         return $this->checkUser;
  160.     }
  161.     public function setCheckUser(bool $checkUser): self
  162.     {
  163.         $this->checkUser $checkUser;
  164.         return $this;
  165.     }
  166.     public function getUserNote(): ?string
  167.     {
  168.         return $this->userNote;
  169.     }
  170.     public function setUserNote(?string $userNote): self
  171.     {
  172.         $this->userNote $userNote;
  173.         return $this;
  174.     }
  175.     public function isIsActive(): ?bool
  176.     {
  177.         return $this->isActive;
  178.     }
  179.     public function setIsActive(bool $isActive): self
  180.     {
  181.         $this->isActive $isActive;
  182.         return $this;
  183.     }
  184.     public function getOldId(): ?int
  185.     {
  186.         return $this->old_id;
  187.     }
  188.     public function setOldId(?int $old_id): self
  189.     {
  190.         $this->old_id $old_id;
  191.         return $this;
  192.     }
  193.     /**
  194.      * @return Collection<int, CustomerAddress>
  195.      */
  196.     public function getCustomerAddresses(): Collection
  197.     {
  198.         return $this->customerAddresses;
  199.     }
  200.     public function addCustomerAddress(CustomerAddress $customerAddress): self
  201.     {
  202.         if (!$this->customerAddresses->contains($customerAddress)) {
  203.             $this->customerAddresses->add($customerAddress);
  204.             $customerAddress->setCustomer($this);
  205.         }
  206.         return $this;
  207.     }
  208.     public function removeCustomerAddress(CustomerAddress $customerAddress): self
  209.     {
  210.         if ($this->customerAddresses->removeElement($customerAddress)) {
  211.             // set the owning side to null (unless already changed)
  212.             if ($customerAddress->getCustomer() === $this) {
  213.                 $customerAddress->setCustomer(null);
  214.             }
  215.         }
  216.         return $this;
  217.     }
  218.     /**
  219.      * @return Collection<int, Order>
  220.      */
  221.     public function getOrders(): Collection
  222.     {
  223.         return $this->orders;
  224.     }
  225.     public function addOrder(Order $order): self
  226.     {
  227.         if (!$this->orders->contains($order)) {
  228.             $this->orders->add($order);
  229.             $order->setCustomer($this);
  230.         }
  231.         return $this;
  232.     }
  233.     public function removeOrder(Order $order): self
  234.     {
  235.         if ($this->orders->removeElement($order)) {
  236.             // set the owning side to null (unless already changed)
  237.             if ($order->getCustomer() === $this) {
  238.                 $order->setCustomer(null);
  239.             }
  240.         }
  241.         return $this;
  242.     }
  243.     /**
  244.      * @return Collection<int, OrderCustomerAddress>
  245.      */
  246.     public function getOrderCustomerAddresses(): Collection
  247.     {
  248.         return $this->orderCustomerAddresses;
  249.     }
  250.     public function addOrderCustomerAddress(OrderCustomerAddress $orderCustomerAddress): self
  251.     {
  252.         if (!$this->orderCustomerAddresses->contains($orderCustomerAddress)) {
  253.             $this->orderCustomerAddresses->add($orderCustomerAddress);
  254.             $orderCustomerAddress->setCustomer($this);
  255.         }
  256.         return $this;
  257.     }
  258.     public function removeOrderCustomerAddress(OrderCustomerAddress $orderCustomerAddress): self
  259.     {
  260.         if ($this->orderCustomerAddresses->removeElement($orderCustomerAddress)) {
  261.             // set the owning side to null (unless already changed)
  262.             if ($orderCustomerAddress->getCustomer() === $this) {
  263.                 $orderCustomerAddress->setCustomer(null);
  264.             }
  265.         }
  266.         return $this;
  267.     }
  268.     public function getConsultant(): ?Consultant
  269.     {
  270.         return $this->consultant;
  271.     }
  272.     public function setConsultant(?Consultant $consultant): static
  273.     {
  274.         $this->consultant $consultant;
  275.         return $this;
  276.     }
  277.     public function getPhone(): ?string
  278.     {
  279.         return $this->phone;
  280.     }
  281.     public function setPhone(?string $phone): static
  282.     {
  283.         $this->phone $phone;
  284.         return $this;
  285.     }
  286.     public function isOrdersBlock(): ?bool
  287.     {
  288.         return $this->ordersBlock;
  289.     }
  290.     public function setOrdersBlock(bool $ordersBlock): static
  291.     {
  292.         $this->ordersBlock $ordersBlock;
  293.         return $this;
  294.     }
  295.     /**
  296.      * @return Collection<int, CustomerHistory>
  297.      */
  298.     public function getCustomerHistories(): Collection
  299.     {
  300.         return $this->customerHistories;
  301.     }
  302.     public function addCustomerHistory(CustomerHistory $customerHistory): static
  303.     {
  304.         if (!$this->customerHistories->contains($customerHistory)) {
  305.             $this->customerHistories->add($customerHistory);
  306.             $customerHistory->setCustomer($this);
  307.         }
  308.         return $this;
  309.     }
  310.     public function removeCustomerHistory(CustomerHistory $customerHistory): static
  311.     {
  312.         if ($this->customerHistories->removeElement($customerHistory)) {
  313.             // set the owning side to null (unless already changed)
  314.             if ($customerHistory->getCustomer() === $this) {
  315.                 $customerHistory->setCustomer(null);
  316.             }
  317.         }
  318.         return $this;
  319.     }
  320.     public function getRegon(): ?string
  321.     {
  322.         return $this->regon;
  323.     }
  324.     public function setRegon(?string $regon): static
  325.     {
  326.         $this->regon $regon;
  327.         return $this;
  328.     }
  329. }