src/Entity/CRM/Customer.php line 15

  1. <?php
  2. namespace App\Entity\CRM;
  3. use App\Repository\CustomerRepository;
  4. use DateTime;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\DBAL\Types\Types;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  10. #[ORM\Entity(repositoryClassCustomerRepository::class)]
  11. #[UniqueEntity(fields: ['companyNumber'], message'Klient o takim NIP już istnieje.')]
  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(length10uniquetrue)]
  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.     #[ORM\Column(typeTypes::JSONnullabletrue)]
  61.     private ?array $salesProfile null;
  62.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  63.     private ?\DateTimeInterface $salesProfileUpdatedAt null;
  64.     #[ORM\Column(typeTypes::JSONnullabletrue)]
  65.     private ?array $gusReport null;
  66.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  67.     private ?\DateTimeInterface $gusReportUpdatedAt null;
  68.     public function __construct()
  69.     {
  70.         $this->addedDate = new DateTime();
  71.         $this->customerAddresses = new ArrayCollection();
  72.         $this->orders = new ArrayCollection();
  73.         $this->orderCustomerAddresses = new ArrayCollection();
  74.         $this->customerHistories = new ArrayCollection();
  75.     }
  76.     public function __toString()
  77.     {
  78.         return $this->getFirstName().' '.$this->getLastName();
  79.     }
  80.     public function getId(): ?int
  81.     {
  82.         return $this->id;
  83.     }
  84.     public function getName(): ?string
  85.     {
  86.         return $this->name;
  87.     }
  88.     public function setName(string $name): self
  89.     {
  90.         $this->name $name;
  91.         return $this;
  92.     }
  93.     public function getLastName(): ?string
  94.     {
  95.         return $this->lastName;
  96.     }
  97.     public function setLastName(string $lastName): self
  98.     {
  99.         $this->lastName $lastName;
  100.         return $this;
  101.     }
  102.     public function getFirstName(): ?string
  103.     {
  104.         return $this->firstName;
  105.     }
  106.     public function setFirstName(string $firstName): self
  107.     {
  108.         $this->firstName $firstName;
  109.         return $this;
  110.     }
  111.     public function getAddress(): ?string
  112.     {
  113.         return $this->address;
  114.     }
  115.     public function setAddress(string $address): self
  116.     {
  117.         $this->address $address;
  118.         return $this;
  119.     }
  120.     public function getCity(): ?string
  121.     {
  122.         return $this->city;
  123.     }
  124.     public function setCity(string $city): self
  125.     {
  126.         $this->city $city;
  127.         return $this;
  128.     }
  129.     public function getZipCode(): ?string
  130.     {
  131.         return $this->zipCode;
  132.     }
  133.     public function setZipCode(string $zipCode): self
  134.     {
  135.         $this->zipCode $zipCode;
  136.         return $this;
  137.     }
  138.     public function getEmail(): ?string
  139.     {
  140.         return $this->email;
  141.     }
  142.     public function setEmail(string $email): self
  143.     {
  144.         $this->email $email;
  145.         return $this;
  146.     }
  147.     public function getCompanyNumber(): ?string
  148.     {
  149.         return $this->companyNumber;
  150.     }
  151.     public function setCompanyNumber(string $companyNumber): self
  152.     {
  153.         $this->companyNumber $companyNumber;
  154.         return $this;
  155.     }
  156.     public function getAddedDate(): ?\DateTimeInterface
  157.     {
  158.         return $this->addedDate;
  159.     }
  160.     public function setAddedDate(\DateTimeInterface $addedDate): self
  161.     {
  162.         $this->addedDate $addedDate;
  163.         return $this;
  164.     }
  165.     public function isCheckUser(): ?bool
  166.     {
  167.         return $this->checkUser;
  168.     }
  169.     public function setCheckUser(bool $checkUser): self
  170.     {
  171.         $this->checkUser $checkUser;
  172.         return $this;
  173.     }
  174.     public function getUserNote(): ?string
  175.     {
  176.         return $this->userNote;
  177.     }
  178.     public function setUserNote(?string $userNote): self
  179.     {
  180.         $this->userNote $userNote;
  181.         return $this;
  182.     }
  183.     public function isIsActive(): ?bool
  184.     {
  185.         return $this->isActive;
  186.     }
  187.     public function setIsActive(bool $isActive): self
  188.     {
  189.         $this->isActive $isActive;
  190.         return $this;
  191.     }
  192.     public function getOldId(): ?int
  193.     {
  194.         return $this->old_id;
  195.     }
  196.     public function setOldId(?int $old_id): self
  197.     {
  198.         $this->old_id $old_id;
  199.         return $this;
  200.     }
  201.     /**
  202.      * @return Collection<int, CustomerAddress>
  203.      */
  204.     public function getCustomerAddresses(): Collection
  205.     {
  206.         return $this->customerAddresses;
  207.     }
  208.     public function addCustomerAddress(CustomerAddress $customerAddress): self
  209.     {
  210.         if (!$this->customerAddresses->contains($customerAddress)) {
  211.             $this->customerAddresses->add($customerAddress);
  212.             $customerAddress->setCustomer($this);
  213.         }
  214.         return $this;
  215.     }
  216.     public function removeCustomerAddress(CustomerAddress $customerAddress): self
  217.     {
  218.         if ($this->customerAddresses->removeElement($customerAddress)) {
  219.             // set the owning side to null (unless already changed)
  220.             if ($customerAddress->getCustomer() === $this) {
  221.                 $customerAddress->setCustomer(null);
  222.             }
  223.         }
  224.         return $this;
  225.     }
  226.     /**
  227.      * @return Collection<int, Order>
  228.      */
  229.     public function getOrders(): Collection
  230.     {
  231.         return $this->orders;
  232.     }
  233.     public function addOrder(Order $order): self
  234.     {
  235.         if (!$this->orders->contains($order)) {
  236.             $this->orders->add($order);
  237.             $order->setCustomer($this);
  238.         }
  239.         return $this;
  240.     }
  241.     public function removeOrder(Order $order): self
  242.     {
  243.         if ($this->orders->removeElement($order)) {
  244.             // set the owning side to null (unless already changed)
  245.             if ($order->getCustomer() === $this) {
  246.                 $order->setCustomer(null);
  247.             }
  248.         }
  249.         return $this;
  250.     }
  251.     /**
  252.      * @return Collection<int, OrderCustomerAddress>
  253.      */
  254.     public function getOrderCustomerAddresses(): Collection
  255.     {
  256.         return $this->orderCustomerAddresses;
  257.     }
  258.     public function addOrderCustomerAddress(OrderCustomerAddress $orderCustomerAddress): self
  259.     {
  260.         if (!$this->orderCustomerAddresses->contains($orderCustomerAddress)) {
  261.             $this->orderCustomerAddresses->add($orderCustomerAddress);
  262.             $orderCustomerAddress->setCustomer($this);
  263.         }
  264.         return $this;
  265.     }
  266.     public function removeOrderCustomerAddress(OrderCustomerAddress $orderCustomerAddress): self
  267.     {
  268.         if ($this->orderCustomerAddresses->removeElement($orderCustomerAddress)) {
  269.             // set the owning side to null (unless already changed)
  270.             if ($orderCustomerAddress->getCustomer() === $this) {
  271.                 $orderCustomerAddress->setCustomer(null);
  272.             }
  273.         }
  274.         return $this;
  275.     }
  276.     public function getConsultant(): ?Consultant
  277.     {
  278.         return $this->consultant;
  279.     }
  280.     public function setConsultant(?Consultant $consultant): static
  281.     {
  282.         $this->consultant $consultant;
  283.         return $this;
  284.     }
  285.     public function getPhone(): ?string
  286.     {
  287.         return $this->phone;
  288.     }
  289.     public function setPhone(?string $phone): static
  290.     {
  291.         $this->phone $phone;
  292.         return $this;
  293.     }
  294.     public function isOrdersBlock(): ?bool
  295.     {
  296.         return $this->ordersBlock;
  297.     }
  298.     public function setOrdersBlock(bool $ordersBlock): static
  299.     {
  300.         $this->ordersBlock $ordersBlock;
  301.         return $this;
  302.     }
  303.     /**
  304.      * @return Collection<int, CustomerHistory>
  305.      */
  306.     public function getCustomerHistories(): Collection
  307.     {
  308.         return $this->customerHistories;
  309.     }
  310.     public function addCustomerHistory(CustomerHistory $customerHistory): static
  311.     {
  312.         if (!$this->customerHistories->contains($customerHistory)) {
  313.             $this->customerHistories->add($customerHistory);
  314.             $customerHistory->setCustomer($this);
  315.         }
  316.         return $this;
  317.     }
  318.     public function removeCustomerHistory(CustomerHistory $customerHistory): static
  319.     {
  320.         if ($this->customerHistories->removeElement($customerHistory)) {
  321.             // set the owning side to null (unless already changed)
  322.             if ($customerHistory->getCustomer() === $this) {
  323.                 $customerHistory->setCustomer(null);
  324.             }
  325.         }
  326.         return $this;
  327.     }
  328.     public function getRegon(): ?string
  329.     {
  330.         return $this->regon;
  331.     }
  332.     public function setRegon(?string $regon): static
  333.     {
  334.         $this->regon $regon;
  335.         return $this;
  336.     }
  337.     public function getSalesProfile(): ?array
  338.     {
  339.         return $this->salesProfile;
  340.     }
  341.     public function setSalesProfile(?array $salesProfile): void
  342.     {
  343.         $this->salesProfile $salesProfile;
  344.     }
  345.     public function getSalesProfileUpdatedAt(): ?\DateTimeInterface
  346.     {
  347.         return $this->salesProfileUpdatedAt;
  348.     }
  349.     public function setSalesProfileUpdatedAt(?\DateTimeInterface $salesProfileUpdatedAt): void
  350.     {
  351.         $this->salesProfileUpdatedAt $salesProfileUpdatedAt;
  352.     }
  353.     public function getGusReport(): ?array
  354.     {
  355.         return $this->gusReport;
  356.     }
  357.     public function setGusReport(?array $gusReport): void
  358.     {
  359.         $this->gusReport $gusReport;
  360.     }
  361.     public function getGusReportUpdatedAt(): ?\DateTimeInterface
  362.     {
  363.         return $this->gusReportUpdatedAt;
  364.     }
  365.     public function setGusReportUpdatedAt(?\DateTimeInterface $gusReportUpdatedAt): void
  366.     {
  367.         $this->gusReportUpdatedAt $gusReportUpdatedAt;
  368.     }
  369. }