src/Entity/Client.php line 19

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Constants\Typology;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Validator\Constraints as Assert;
  8. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  9. /**
  10.  * Clientes
  11.  *
  12.  * @ORM\Table(name="clients")
  13.  * @ORM\Entity(repositoryClass="App\Repository\ClientRepository")
  14.  * @ORM\HasLifecycleCallbacks()
  15.  */
  16. class Client
  17. {
  18.     /**
  19.      * @ORM\Column(name="id", type="integer")
  20.      * @ORM\Id
  21.      * @ORM\GeneratedValue(strategy="AUTO")
  22.      */
  23.     private ?int $id null;
  24.     /**
  25.      * @ORM\Column(name="type", type="string", length=255)
  26.      * @Assert\NotBlank()
  27.      */
  28.     private ?string $type null;
  29.     /**
  30.      * @ORM\Column(name="name", type="string", length=255)
  31.      * @Assert\NotBlank()
  32.      */
  33.     private ?string $name null;
  34.     /**
  35.      * @ORM\Column(name="title", type="string", length=255, nullable=true)
  36.      */
  37.     private ?string $title null;
  38.     /**
  39.      * @ORM\Column(name="address", type="string", length=255)
  40.      * @Assert\NotBlank()
  41.      */
  42.     private ?string $address null;
  43.     /**
  44.      * @ORM\Column(name="address_number", type="string", length=255)
  45.      * @Assert\NotBlank()
  46.      */
  47.     private ?string $addressNumber null;
  48.     /**
  49.      * @ORM\Column(name="zip_code", type="string", length=255)
  50.      * @Assert\NotBlank()
  51.      */
  52.     private ?string $zipCode null;
  53.     /**
  54.      * @ORM\Column(name="population", type="string", length=255, nullable=true)
  55.      */
  56.     private ?string $population null;
  57.     /**
  58.      * @ORM\Column(name="province", type="string", length=255, nullable=true)
  59.      */
  60.     private ?string $province null;
  61.     /**
  62.      * @ORM\Column(name="region", type="string", length=255)
  63.      * @Assert\NotBlank()
  64.      */
  65.     private ?string $region null;
  66.     /**
  67.      * @ORM\Column(name="country", type="string", length=255)
  68.      * @Assert\NotBlank()
  69.      */
  70.     private ?string $country null;
  71.     /**
  72.      * @ORM\Column(name="telephone", type="string", length=255)
  73.      * @Assert\NotBlank()
  74.      */
  75.     private ?string $telephone null;
  76.     /**
  77.      * @ORM\Column(name="fax", type="string", length=255, nullable=true)
  78.      */
  79.     private ?string $fax null;
  80.     /**
  81.      * @ORM\Column(name="email", type="string", length=255, nullable=true)
  82.      */
  83.     private ?string $email null;
  84.     /**
  85.      * @ORM\Column(name="gds", type="string", length=255, nullable=true)
  86.      */
  87.     private ?string $gds null;
  88.     /**
  89.      * @ORM\Column(name="type_document", type="string", length=255, nullable=true)
  90.      */
  91.     private ?string $typeDocument null;
  92.     /**
  93.      * @ORM\Column(name="id_document", type="string", length=255, nullable=true)
  94.      */
  95.     private ?string $idDocument null;
  96.     /**
  97.      * @ORM\Column(name="observation", type="text", nullable=true)
  98.      */
  99.     private ?string $observation null;
  100.     /**
  101.      * @ORM\Column(name="created_at", type="datetime")
  102.      */
  103.     private ?\DateTime $createdAt null;
  104.     /**
  105.      * @ORM\Column(name="created_id", type="integer", nullable=true)
  106.      */
  107.     private ?int $createdId null;
  108.     /**
  109.      * @ORM\Column(name="updated_at", type="datetime")
  110.      */
  111.     private ?\DateTime $updatedAt null;
  112.     /**
  113.      * @ORM\Column(name="updated_id", type="integer", nullable=true)
  114.      */
  115.     private ?int $updatedId null;
  116.     /**
  117.      * @ORM\Column(name="status", type="boolean")
  118.      */
  119.     private ?bool $state null;
  120.     /**
  121.      * @ORM\Column(name="picture", type="string", length=255, nullable=true)
  122.      */
  123.     private ?string $picture null;
  124.     /**
  125.      * @ORM\Column(name="competency", type="string", length=255, nullable=true)
  126.      */
  127.     private ?string $competency null;
  128.     /**
  129.      * @ORM\Column(name="action", type="string", length=255, nullable=true)
  130.      * @Assert\NotBlank()
  131.      */
  132.     private ?string $action null;
  133.     /**
  134.      * @ORM\Column(name="return_investment", type="string", length=255, nullable=true)
  135.      */
  136.     private ?string $returnInvestment null;
  137.     /**
  138.      * @ORM\Column(type="string", length=100, nullable=true)
  139.      */
  140.     private ?string $typology null;
  141.     /**
  142.      * @ORM\Column(type="string", length=20, nullable=true)
  143.      */
  144.     private ?string $sageCode null;
  145.     /**
  146.      * @ORM\Column(type="string", length=34, nullable=true)
  147.      */
  148.     private ?string $iban null;
  149.     /**
  150.      * @ORM\Column(type="string", length=20, nullable=true)
  151.      */
  152.     private ?string $swift null;
  153.     /**
  154.      * @ORM\Column(type="string", length=100, nullable=true)
  155.      */
  156.     private ?string $bankName null;
  157.     /**
  158.      * @ORM\Column(type="boolean", nullable=true)
  159.      */
  160.     private ?bool $sentToSage null;
  161.     /**
  162.      * @ORM\Column(type="datetime", nullable=true)
  163.      */
  164.     private ?\DateTime $syncDate null;
  165.     /**
  166.      * @ORM\OneToMany(targetEntity=ClientAccountingAccount::class, mappedBy="client", orphanRemoval=true)
  167.      */
  168.     private Collection $clientAccountingAccounts;
  169.     /**
  170.      * @ORM\OneToMany(targetEntity=DeliveryNote::class, mappedBy="client")
  171.      */
  172.     private Collection $deliveryNotes;
  173.     /**
  174.      * @ORM\ManyToOne(targetEntity=SagePaymentMethod::class)
  175.      */
  176.     private ?SagePaymentMethod $sagePaymentMethod null;
  177.     /**
  178.      * @ORM\OneToMany(targetEntity=SagePayment::class, mappedBy="client")
  179.      */
  180.     private Collection $sagePayments;
  181.     /**
  182.      * @ORM\ManyToMany(targetEntity=SettingsCompany::class, inversedBy="clients")
  183.      */
  184.     private Collection $settingsCompany;
  185.     public function __construct()
  186.     {
  187.         $this->clientAccountingAccounts = new ArrayCollection();
  188.         $this->deliveryNotes = new ArrayCollection();
  189.         $this->sagePayments = new ArrayCollection();
  190.         $this->settingsCompany = new ArrayCollection();
  191.     }
  192.     public function getId(): ?int
  193.     {
  194.         return $this->id;
  195.     }
  196.     public function setType(string $type): self
  197.     {
  198.         $this->type $type;
  199.         return $this;
  200.     }
  201.     public function getType(): ?string
  202.     {
  203.         return $this->type;
  204.     }
  205.     public function setName(string $name): self
  206.     {
  207.         $this->name $name;
  208.         return $this;
  209.     }
  210.     public function getName(): ?string
  211.     {
  212.         return $this->name;
  213.     }
  214.     public function setTitle(?string $title): self
  215.     {
  216.         $this->title $title;
  217.         return $this;
  218.     }
  219.     public function getTitle(): ?string
  220.     {
  221.         return $this->title;
  222.     }
  223.     public function setAddress(string $address): self
  224.     {
  225.         $this->address $address;
  226.         return $this;
  227.     }
  228.     public function getAddress(): ?string
  229.     {
  230.         return $this->address;
  231.     }
  232.     public function setAddressNumber(string $addressNumber): self
  233.     {
  234.         $this->addressNumber $addressNumber;
  235.         return $this;
  236.     }
  237.     public function getAddressNumber(): ?string
  238.     {
  239.         return $this->addressNumber;
  240.     }
  241.     public function setZipCode(string $zipCode): self
  242.     {
  243.         $this->zipCode $zipCode;
  244.         return $this;
  245.     }
  246.     public function getZipCode(): ?string
  247.     {
  248.         return $this->zipCode;
  249.     }
  250.     public function setPopulation(?string $population): self
  251.     {
  252.         $this->population $population;
  253.         return $this;
  254.     }
  255.     public function getPopulation(): ?string
  256.     {
  257.         return $this->population;
  258.     }
  259.     public function setProvince(?string $province): self
  260.     {
  261.         $this->province $province;
  262.         return $this;
  263.     }
  264.     public function getProvince(): ?string
  265.     {
  266.         return $this->province;
  267.     }
  268.     public function setCountry(string $country): self
  269.     {
  270.         $this->country $country;
  271.         return $this;
  272.     }
  273.     public function getCountry(): ?string
  274.     {
  275.         return $this->country;
  276.     }
  277.     public function setTelephone(string $telephone): self
  278.     {
  279.         $this->telephone $telephone;
  280.         return $this;
  281.     }
  282.     public function getTelephone(): ?string
  283.     {
  284.         return $this->telephone;
  285.     }
  286.     public function setFax(?string $fax): self
  287.     {
  288.         $this->fax $fax;
  289.         return $this;
  290.     }
  291.     public function getFax(): ?string
  292.     {
  293.         return $this->fax;
  294.     }
  295.     public function setEmail(?string $email): self
  296.     {
  297.         $this->email $email;
  298.         return $this;
  299.     }
  300.     public function getEmail(): ?string
  301.     {
  302.         return $this->email;
  303.     }
  304.     public function setGds(?string $gds): self
  305.     {
  306.         $this->gds $gds;
  307.         return $this;
  308.     }
  309.     public function getGds(): ?string
  310.     {
  311.         return $this->gds;
  312.     }
  313.     public function setIdDocument(?string $idDocument): self
  314.     {
  315.         $this->idDocument $idDocument;
  316.         return $this;
  317.     }
  318.     public function getIdDocument(): ?string
  319.     {
  320.         return $this->idDocument;
  321.     }
  322.     public function setObservation(?string $observation): self
  323.     {
  324.         $this->observation $observation;
  325.         return $this;
  326.     }
  327.     public function getObservation(): ?string
  328.     {
  329.         return $this->observation;
  330.     }
  331.     public function setCreatedAt(\Datetime $createdAt): self
  332.     {
  333.         $this->createdAt $createdAt;
  334.         return $this;
  335.     }
  336.     public function getCreatedAt(): ?\DateTime
  337.     {
  338.         return $this->createdAt;
  339.     }
  340.     public function setCreatedId(?int $createdId): self
  341.     {
  342.         $this->createdId $createdId;
  343.         return $this;
  344.     }
  345.     public function getCreatedId(): ?int
  346.     {
  347.         return $this->createdId;
  348.     }
  349.     public function setUpdatedAt(\Datetime $updatedAt): self
  350.     {
  351.         $this->updatedAt $updatedAt;
  352.         return $this;
  353.     }
  354.     public function getUpdatedAt(): ?\DateTime
  355.     {
  356.         return $this->updatedAt;
  357.     }
  358.     public function setUpdatedId(?int $updatedId): self
  359.     {
  360.         $this->updatedId $updatedId;
  361.         return $this;
  362.     }
  363.     public function getUpdatedId(): ?int
  364.     {
  365.         return $this->updatedId;
  366.     }
  367.     public function setState(bool $state): self
  368.     {
  369.         $this->state $state;
  370.         return $this;
  371.     }
  372.     /**
  373.      * Get state
  374.      *
  375.      * @return bool
  376.      */
  377.     public function getState(): ?bool
  378.     {
  379.         return $this->state;
  380.     }
  381.     public function setPicture(?string $picture): self
  382.     {
  383.         $this->picture $picture;
  384.         return $this;
  385.     }
  386.     public function getPicture(): ?string
  387.     {
  388.         return $this->picture;
  389.     }
  390.     /**
  391.      * @ORM\PrePersist
  392.      */
  393.     public function setCreatedAtValue(): void
  394.     {
  395.         $this->createdAt = new \Datetime();
  396.     }
  397.     /**
  398.      * @ORM\PrePersist
  399.      * @ORM\PreUpdate
  400.      */
  401.     public function setUpdatedAtValue(): void
  402.     {
  403.         $this->updatedAt = new \Datetime();
  404.     }
  405.     public function setCompetency(?string $competency): self
  406.     {
  407.         $this->competency $competency;
  408.         return $this;
  409.     }
  410.     public function getCompetency(): ?string
  411.     {
  412.         return $this->competency;
  413.     }
  414.     public function setAction(string $action): self
  415.     {
  416.         $this->action $action;
  417.         return $this;
  418.     }
  419.     public function getAction(): ?string
  420.     {
  421.         return $this->action;
  422.     }
  423.     public function setTypeDocument(?string $typeDocument): self
  424.     {
  425.         $this->typeDocument $typeDocument;
  426.         return $this;
  427.     }
  428.     public function getTypeDocument(): ?string
  429.     {
  430.         return $this->typeDocument;
  431.     }
  432.     public function setReturnInvestment(?string $returnInvestment): self
  433.     {
  434.         $this->returnInvestment $returnInvestment;
  435.         return $this;
  436.     }
  437.     public function getReturnInvestment(): ?string
  438.     {
  439.         return $this->returnInvestment;
  440.     }
  441.     public function setRegion(string $region): self
  442.     {
  443.         $this->region $region;
  444.         return $this;
  445.     }
  446.     public function getRegion(): ?string
  447.     {
  448.         return $this->region;
  449.     }
  450.     public function getTypology(): ?string
  451.     {
  452.         return $this->typology;
  453.     }
  454.     public function setTypology(?string $typology): self
  455.     {
  456.         if (!Typology::isValid($typology) && $typology !== null) {
  457.             throw new \InvalidArgumentException("Sector inválido: $typology");
  458.         }
  459.         $this->typology $typology;
  460.         return $this;
  461.     }
  462.     public function getSageCode(): ?string
  463.     {
  464.         return $this->sageCode;
  465.     }
  466.     public function setSageCode(?string $sageCode): self
  467.     {
  468.         $this->sageCode $sageCode;
  469.         return $this;
  470.     }
  471.     public function getIban(): ?string
  472.     {
  473.         return $this->iban;
  474.     }
  475.     public function setIban(?string $iban): self
  476.     {
  477.         $this->iban $iban;
  478.         return $this;
  479.     }
  480.     public function getSwift(): ?string
  481.     {
  482.         return $this->swift;
  483.     }
  484.     public function setSwift(?string $swift): self
  485.     {
  486.         $this->swift $swift;
  487.         return $this;
  488.     }
  489.     public function getBankName(): ?string
  490.     {
  491.         return $this->bankName;
  492.     }
  493.     public function setBankName(?string $bankName): self
  494.     {
  495.         $this->bankName $bankName;
  496.         return $this;
  497.     }
  498.     public function isSentToSage(): ?bool
  499.     {
  500.         return $this->sentToSage;
  501.     }
  502.     public function setSentToSage(bool $sentToSage): self
  503.     {
  504.         $this->sentToSage $sentToSage;
  505.         return $this;
  506.     }
  507.     public function getSyncDate(): ?\DateTimeInterface
  508.     {
  509.         return $this->syncDate;
  510.     }
  511.     public function setSyncDate(?\DateTimeInterface $syncDate): self
  512.     {
  513.         $this->syncDate $syncDate;
  514.         return $this;
  515.     }
  516.     /**
  517.      * @return Collection<int, ClientAccountingAccount>
  518.      */
  519.     public function getClientAccountingAccounts(): Collection
  520.     {
  521.         return $this->clientAccountingAccounts;
  522.     }
  523.     public function addClientAccountingAccount(ClientAccountingAccount $clientAccountingAccount): self
  524.     {
  525.         if (!$this->clientAccountingAccounts->contains($clientAccountingAccount)) {
  526.             $this->clientAccountingAccounts[] = $clientAccountingAccount;
  527.             $clientAccountingAccount->setClient($this);
  528.         }
  529.         return $this;
  530.     }
  531.     public function removeClientAccountingAccount(ClientAccountingAccount $clientAccountingAccount): self
  532.     {
  533.         if ($this->clientAccountingAccounts->removeElement($clientAccountingAccount)) {
  534.             // set the owning side to null (unless already changed)
  535.             if ($clientAccountingAccount->getClient() === $this) {
  536.                 $clientAccountingAccount->setClient(null);
  537.             }
  538.         }
  539.         return $this;
  540.     }
  541.     /**
  542.      * @return Collection<int, DeliveryNote>
  543.      */
  544.     public function getDeliveryNotes(): Collection
  545.     {
  546.         return $this->deliveryNotes;
  547.     }
  548.     public function addDeliveryNote(DeliveryNote $deliveryNote): self
  549.     {
  550.         if (!$this->deliveryNotes->contains($deliveryNote)) {
  551.             $this->deliveryNotes[] = $deliveryNote;
  552.             $deliveryNote->setClient($this);
  553.         }
  554.         return $this;
  555.     }
  556.     public function removeDeliveryNote(DeliveryNote $deliveryNote): self
  557.     {
  558.         if ($this->deliveryNotes->removeElement($deliveryNote)) {
  559.             // set the owning side to null (unless already changed)
  560.             if ($deliveryNote->getClient() === $this) {
  561.                 $deliveryNote->setClient(null);
  562.             }
  563.         }
  564.         return $this;
  565.     }
  566.     public function getSagePaymentMethod(): ?SagePaymentMethod
  567.     {
  568.         return $this->sagePaymentMethod;
  569.     }
  570.     public function setSagePaymentMethod(?SagePaymentMethod $sagePaymentMethod): self
  571.     {
  572.         $this->sagePaymentMethod $sagePaymentMethod;
  573.         return $this;
  574.     }
  575.     /**
  576.      * @return Collection<int, SagePayment>
  577.      */
  578.     public function getSagePayments(): Collection
  579.     {
  580.         return $this->sagePayments;
  581.     }
  582.     public function addSagePayment(SagePayment $payment): self
  583.     {
  584.         if (!$this->sagePayments->contains($payment)) {
  585.             $this->sagePayments[] = $payment;
  586.             $payment->setClient($this);
  587.         }
  588.         return $this;
  589.     }
  590.     public function removeSagePayment(SagePayment $payment): self
  591.     {
  592.         if ($this->sagePayments->removeElement($payment)) {
  593.             // set the owning side to null (unless already changed)
  594.             if ($payment->getClient() === $this) {
  595.                 $payment->setClient(null);
  596.             }
  597.         }
  598.         return $this;
  599.     }
  600.     /**
  601.      * @return Collection<int, SettingsCompany>
  602.      */
  603.     public function getSettingsCompany(): Collection
  604.     {
  605.         return $this->settingsCompany;
  606.     }
  607.     public function addSettingsCompany(SettingsCompany $settingsCompany): self
  608.     {
  609.         if (!$this->settingsCompany->contains($settingsCompany)) {
  610.             $this->settingsCompany[] = $settingsCompany;
  611.         }
  612.         return $this;
  613.     }
  614.     public function removeSettingsCompany(SettingsCompany $settingsCompany): self
  615.     {
  616.         $this->settingsCompany->removeElement($settingsCompany);
  617.         return $this;
  618.     }
  619. }