src/Entity/System/Address.php line 23

Open in your IDE?
  1. <?php
  2. namespace App\Entity\System;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Symfony\Component\Validator\Constraints as Assert;
  5. use Symfony\Component\Validator\Context\ExecutionContextInterface;
  6. /**
  7.  * @ORM\Entity(repositoryClass="App\Repository\System\AddressRepository")
  8.  *
  9.  * @ORM\Table(name="ps_address", indexes={
  10.  *
  11.  *     @ORM\Index(name="ps_address_iso_vat_number", columns={"iso_vat_number"}),
  12.  *     @ORM\Index(name="iso_code", columns={"iso_code"}),
  13.  *     @ORM\Index(name="vat_number", columns={"vat_number"}),
  14.  *     @ORM\Index(name="active", columns={"active"}),
  15.  *     @ORM\Index(name="ps_address_id_customer_default_invoice_address_index", columns={"id_customer", "default_invoice_address"}),
  16.  *     @ORM\Index(name="id_manufacturer", columns={"id_manufacturer"}),
  17.  *     @ORM\Index(name="default_invoice_address", columns={"default_invoice_address"})
  18.  * })
  19.  */
  20. class Address
  21. {
  22.     public const TYPE_INDIVIDUAL 1;
  23.     public const TYPE_SELF_EMPLOYED 2;
  24.     public const TYPE_COMPANY 3;
  25.     public const CUSTOMER_TYPE_IDS_INDEXED_BY_TYPE_VALUES = [
  26.         'INDIVIDUAL' => self::TYPE_INDIVIDUAL,
  27.         'SELF_EMPLOYED' => self::TYPE_SELF_EMPLOYED,
  28.         'COMPANY' => self::TYPE_COMPANY,
  29.     ];
  30.     /**
  31.      * @var int
  32.      *
  33.      * @ORM\Id
  34.      *
  35.      * @ORM\GeneratedValue(strategy="AUTO")
  36.      *
  37.      * @ORM\Column(type="integer", name="id_address")
  38.      */
  39.     private $id;
  40.     /**
  41.      * @var Country
  42.      *
  43.      * @ORM\ManyToOne(targetEntity="App\Entity\System\Country", inversedBy="addresses")
  44.      *
  45.      * @ORM\JoinColumn(referencedColumnName="id_country", name="id_country", nullable=false)
  46.      */
  47.     private $country;
  48.     /**
  49.      * @var State|null
  50.      *
  51.      * @ORM\ManyToOne(targetEntity="App\Entity\System\State")
  52.      *
  53.      * @ORM\JoinColumn(referencedColumnName="id_state", name="id_state", nullable=true)
  54.      */
  55.     private $state;
  56.     /**
  57.      * @var string|null
  58.      *
  59.      * @ORM\Column(type="string", length=50, name="state_name", nullable=true)
  60.      */
  61.     private $stateName;
  62.     /**
  63.      * @var int|null
  64.      *
  65.      * @ORM\Column(type="integer", name="id_manufacturer", length=10, options={"default" : 0})
  66.      */
  67.     private $manufacturer;
  68.     /**
  69.      * @var string|null
  70.      *
  71.      * @ORM\Column(type="string", length=32, nullable=true)
  72.      */
  73.     private $alias;
  74.     /**
  75.      * @var string|null
  76.      *
  77.      * @ORM\Column(type="string", length=64, nullable=true)
  78.      */
  79.     private $company;
  80.     /**
  81.      * @var string|null
  82.      *
  83.      * @ORM\Column(type="string", length=32, nullable=true)
  84.      */
  85.     private $name;
  86.     /**
  87.      * @var string
  88.      *
  89.      * @ORM\Column(type="string", length=128)
  90.      */
  91.     private $email;
  92.     /**
  93.      * @var string|null
  94.      *
  95.      * @ORM\Column(type="string", length=32, nullable=true)
  96.      */
  97.     private $surnames;
  98.     /**
  99.      * @var string
  100.      *
  101.      * @ORM\Column(type="string", length=128)
  102.      */
  103.     private $address1;
  104.     /**
  105.      * @var string|null
  106.      *
  107.      * @ORM\Column(type="string", length=128, nullable=true)
  108.      */
  109.     private $address2;
  110.     /**
  111.      * @var string|null
  112.      *
  113.      * @ORM\Column(type="string", length=12, nullable=true)
  114.      */
  115.     private $postcode;
  116.     /**
  117.      * @var string
  118.      *
  119.      * @ORM\Column(type="string", length=64)
  120.      */
  121.     private $city;
  122.     /**
  123.      * @var string|null
  124.      *
  125.      * @ORM\Column(type="text", nullable=true)
  126.      */
  127.     private $other;
  128.     /**
  129.      * @var string|null
  130.      *
  131.      * @ORM\Column(type="string", length=32, nullable=true)
  132.      */
  133.     private $phone;
  134.     /**
  135.      * @var string|null
  136.      *
  137.      * @ORM\Column(type="string", length=32, nullable=true)
  138.      */
  139.     private $phoneMobile;
  140.     /**
  141.      * @var string|null
  142.      *
  143.      * @ORM\Column(type="string", length=32, nullable=true)
  144.      */
  145.     private $vatNumber;
  146.     /**
  147.      * @var \DateTime
  148.      *
  149.      * @ORM\Column(type="datetime")
  150.      */
  151.     private $dateAdd;
  152.     /**
  153.      * @var \DateTime
  154.      *
  155.      * @ORM\Column(type="datetime")
  156.      */
  157.     private $dateUpd;
  158.     /**
  159.      * @var bool
  160.      *
  161.      * @ORM\Column(type="boolean", options={"default" : 1})
  162.      */
  163.     private $active;
  164.     /**
  165.      * @var bool
  166.      *
  167.      * @ORM\Column(type="boolean", options={"default" : 0})
  168.      */
  169.     private $invoiceAddress;
  170.     /**
  171.      * @var bool
  172.      *
  173.      * @ORM\Column(type="boolean", options={"default" : 0})
  174.      */
  175.     private $defaultInvoiceAddress;
  176.     /**
  177.      * @var bool
  178.      *
  179.      * @ORM\Column(type="boolean", options={"default" : 0})
  180.      */
  181.     private $defaultShippingAddress;
  182.     /**
  183.      * @ORM\Column(type="boolean", nullable=true, options={"default" : 0})
  184.      */
  185.     private bool $vise;
  186.     /**
  187.      * @var bool|null
  188.      *
  189.      * @ORM\Column(type="boolean", length=4, nullable=true, options={"default" : 0})
  190.      */
  191.     private $re;
  192.     /**
  193.      * @var string|null
  194.      *
  195.      * @ORM\Column(type="string", length=3, nullable=true)
  196.      */
  197.     private $isoCode;
  198.     /**
  199.      * @var string|null
  200.      *
  201.      * @ORM\Column(type="string", length=128, nullable=true)
  202.      */
  203.     private $comercialName;
  204.     /**
  205.      * @var int|null
  206.      *
  207.      * @ORM\Column(type="integer",length=1, nullable=true, options={"default" : 1}))
  208.      */
  209.     private $typeCustomer;
  210.     /**
  211.      * @var string|null
  212.      *
  213.      * @ORM\Column(type="string", length=50, nullable=true, options={"default" : "1"})
  214.      */
  215.     private $contactName;
  216.     /**
  217.      * @var string|null
  218.      *
  219.      * @ORM\Column(type="string", length=50, nullable=true, options={"default" : "1"})
  220.      */
  221.     private $url;
  222.     /**
  223.      * @var int
  224.      *
  225.      * @ORM\Column(type="integer", length=10, options={"default" : 0})
  226.      */
  227.     private $phonePrefix;
  228.     /**
  229.      * @var int
  230.      *
  231.      * @ORM\Column(type="integer", length=10, options={"default" : 0})
  232.      */
  233.     private $phoneMobilePrefix;
  234.     /**
  235.      * @var int|null
  236.      *
  237.      * @ORM\Column(type="integer", length=4, nullable=true)
  238.      */
  239.     private $favorite;
  240.     /**
  241.      * @var string|null
  242.      *
  243.      * @ORM\Column(type="string", length=64, nullable=true)
  244.      */
  245.     private $companyName;
  246.     /**
  247.      * @var string|null
  248.      *
  249.      * @ORM\Column(type="string", length=3, nullable=true)
  250.      */
  251.     private $isoVatNumber;
  252.     /**
  253.      * @var Customer
  254.      *
  255.      * @ORM\ManyToOne(targetEntity="App\Entity\System\Customer", inversedBy="addresses")
  256.      *
  257.      * @ORM\JoinColumn(name="id_customer", referencedColumnName="id_customer", nullable=false)
  258.      */
  259.     private $customer;
  260.     /**
  261.      * @ORM\Column(type="boolean", nullable=true, options={"default" : 0})
  262.      */
  263.     private bool $companyVerified false;
  264.     /**
  265.      * @var string|null
  266.      *
  267.      * @ORM\Column(type="string", length=64, nullable=true)
  268.      */
  269.     private $eori;
  270.     /**
  271.      * @var string|null
  272.      *
  273.      * @ORM\Column(type="string", length=64, nullable=true)
  274.      */
  275.     private $voec;
  276.     public function __construct()
  277.     {
  278.         $this->dateUpd = new \DateTime();
  279.         $this->active true;
  280.         $this->invoiceAddress true;
  281.         $this->defaultInvoiceAddress false;
  282.         $this->defaultShippingAddress false;
  283.         $this->vise false;
  284.         $this->re false;
  285.         $this->typeCustomer true;
  286.         $this->contactName '1';
  287.         $this->phonePrefix 0;
  288.         $this->phoneMobilePrefix 0;
  289.         $this->favorite 0;
  290.         $this->manufacturer 0;
  291.     }
  292.     public static function createEmptyInvoiceAddress(string $customerEmail, \DateTime $dateTime, ?State $state): Address
  293.     {
  294.         $address = new self();
  295.         $address->email $customerEmail;
  296.         $address->address1 '';
  297.         $address->city '';
  298.         $address->dateAdd $dateTime;
  299.         $address->state $state;
  300.         $address->defaultInvoiceAddress true;
  301.         $address->invoiceAddress true;
  302.         return $address;
  303.     }
  304.     /**
  305.      * @return int
  306.      */
  307.     public function getId(): int
  308.     {
  309.         return $this->id;
  310.     }
  311.     /**
  312.      * @param int $id
  313.      *
  314.      * @return Address
  315.      */
  316.     public function setId(int $id): Address
  317.     {
  318.         $this->id $id;
  319.         return $this;
  320.     }
  321.     /**
  322.      * @return Country
  323.      */
  324.     public function getCountry(): Country
  325.     {
  326.         return $this->country;
  327.     }
  328.     /**
  329.      * @param Country $country
  330.      *
  331.      * @return Address
  332.      */
  333.     public function setCountry(Country $country): Address
  334.     {
  335.         $this->country $country;
  336.         return $this;
  337.     }
  338.     /**
  339.      * @return State|null
  340.      */
  341.     public function getState(): ?State
  342.     {
  343.         if ($this->state && $this->state->getId() === 0) {
  344.             return null;
  345.         }
  346.         return $this->state;
  347.     }
  348.     /**
  349.      * @param State|null $state
  350.      *
  351.      * @return Address
  352.      */
  353.     public function setState(?State $state): Address
  354.     {
  355.         $this->state $state;
  356.         return $this;
  357.     }
  358.     /**
  359.      * @return string|null
  360.      */
  361.     public function getStateName(): ?string
  362.     {
  363.         return $this->stateName;
  364.     }
  365.     /**
  366.      * @param string|null $stateName
  367.      *
  368.      * @return Address
  369.      */
  370.     public function setStateName(?string $stateName): Address
  371.     {
  372.         $this->stateName $stateName;
  373.         return $this;
  374.     }
  375.     /**
  376.      * @return string|null
  377.      */
  378.     public function getAlias(): ?string
  379.     {
  380.         return $this->alias;
  381.     }
  382.     /**
  383.      * @param string|null $alias
  384.      *
  385.      * @return Address
  386.      */
  387.     public function setAlias(?string $alias): Address
  388.     {
  389.         $this->alias $alias;
  390.         return $this;
  391.     }
  392.     /**
  393.      * @return string|null
  394.      */
  395.     public function getCompany(): ?string
  396.     {
  397.         return $this->company;
  398.     }
  399.     /**
  400.      * @param string|null $company
  401.      *
  402.      * @return Address
  403.      */
  404.     public function setCompany(?string $company): Address
  405.     {
  406.         $this->company $company;
  407.         return $this;
  408.     }
  409.     /**
  410.      * @return string|null
  411.      */
  412.     public function getName(): ?string
  413.     {
  414.         return $this->name;
  415.     }
  416.     /**
  417.      * @param string|null $name
  418.      *
  419.      * @return Address
  420.      */
  421.     public function setName(?string $name): Address
  422.     {
  423.         $this->name $name;
  424.         return $this;
  425.     }
  426.     /**
  427.      * @return string
  428.      */
  429.     public function getEmail(): string
  430.     {
  431.         return $this->email;
  432.     }
  433.     /**
  434.      * @param string $email
  435.      *
  436.      * @return Address
  437.      */
  438.     public function setEmail(string $email): Address
  439.     {
  440.         $this->email $email;
  441.         return $this;
  442.     }
  443.     /**
  444.      * @return string|null
  445.      */
  446.     public function getSurnames(): ?string
  447.     {
  448.         return $this->surnames;
  449.     }
  450.     /**
  451.      * @param string|null $surnames
  452.      *
  453.      * @return Address
  454.      */
  455.     public function setSurnames(?string $surnames): Address
  456.     {
  457.         $this->surnames $surnames;
  458.         return $this;
  459.     }
  460.     /**
  461.      * @return string
  462.      */
  463.     public function getAddress1(): string
  464.     {
  465.         return $this->address1;
  466.     }
  467.     /**
  468.      * @param string $address1
  469.      *
  470.      * @return Address
  471.      */
  472.     public function setAddress1(string $address1): Address
  473.     {
  474.         $this->address1 $address1;
  475.         return $this;
  476.     }
  477.     /**
  478.      * @return string|null
  479.      */
  480.     public function getAddress2(): ?string
  481.     {
  482.         return $this->address2;
  483.     }
  484.     /**
  485.      * @param string|null $address2
  486.      *
  487.      * @return Address
  488.      */
  489.     public function setAddress2(?string $address2): Address
  490.     {
  491.         $this->address2 $address2;
  492.         return $this;
  493.     }
  494.     /**
  495.      * @return string|null
  496.      */
  497.     public function getPostcode(): ?string
  498.     {
  499.         return $this->postcode;
  500.     }
  501.     /**
  502.      * @param string|null $postcode
  503.      *
  504.      * @return Address
  505.      */
  506.     public function setPostcode(?string $postcode): Address
  507.     {
  508.         $this->postcode $postcode;
  509.         return $this;
  510.     }
  511.     /**
  512.      * @return string
  513.      */
  514.     public function getCity(): string
  515.     {
  516.         return $this->city;
  517.     }
  518.     /**
  519.      * @param string $city
  520.      *
  521.      * @return Address
  522.      */
  523.     public function setCity(string $city): Address
  524.     {
  525.         $this->city $city;
  526.         return $this;
  527.     }
  528.     /**
  529.      * @return string|null
  530.      */
  531.     public function getOther(): ?string
  532.     {
  533.         return $this->other;
  534.     }
  535.     /**
  536.      * @param string|null $other
  537.      *
  538.      * @return Address
  539.      */
  540.     public function setOther(?string $other): Address
  541.     {
  542.         $this->other $other;
  543.         return $this;
  544.     }
  545.     /**
  546.      * @return string|null
  547.      */
  548.     public function getPhone(): ?string
  549.     {
  550.         return $this->phone;
  551.     }
  552.     /**
  553.      * @param string|null $phone
  554.      *
  555.      * @return Address
  556.      */
  557.     public function setPhone(?string $phone): Address
  558.     {
  559.         $this->phone $phone;
  560.         return $this;
  561.     }
  562.     /**
  563.      * @return string|null
  564.      */
  565.     public function getPhoneMobile(): ?string
  566.     {
  567.         return $this->phoneMobile;
  568.     }
  569.     /**
  570.      * @param string|null $phoneMobile
  571.      *
  572.      * @return Address
  573.      */
  574.     public function setPhoneMobile(?string $phoneMobile): Address
  575.     {
  576.         $this->phoneMobile $phoneMobile;
  577.         return $this;
  578.     }
  579.     /**
  580.      * @return string|null
  581.      */
  582.     public function getVatNumber(): ?string
  583.     {
  584.         return $this->vatNumber;
  585.     }
  586.     /**
  587.      * @param string|null $vatNumber
  588.      *
  589.      * @return Address
  590.      */
  591.     public function setVatNumber(?string $vatNumber): Address
  592.     {
  593.         $this->vatNumber preg_replace('/[^A-Za-z0-9]/i'''$vatNumber);
  594.         return $this;
  595.     }
  596.     /**
  597.      * @return \DateTime
  598.      */
  599.     public function getDateAdd(): \DateTime
  600.     {
  601.         return $this->dateAdd;
  602.     }
  603.     /**
  604.      * @param \DateTime $dateAdd
  605.      *
  606.      * @return Address
  607.      */
  608.     public function setDateAdd(\DateTime $dateAdd): Address
  609.     {
  610.         $this->dateAdd $dateAdd;
  611.         return $this;
  612.     }
  613.     /**
  614.      * @return \DateTime
  615.      */
  616.     public function getDateUpd(): \DateTime
  617.     {
  618.         return $this->dateUpd;
  619.     }
  620.     /**
  621.      * @param \DateTime $dateUpd
  622.      *
  623.      * @return Address
  624.      */
  625.     public function setDateUpd(\DateTime $dateUpd): Address
  626.     {
  627.         $this->dateUpd $dateUpd;
  628.         return $this;
  629.     }
  630.     /**
  631.      * @return bool
  632.      */
  633.     public function isActive(): bool
  634.     {
  635.         return $this->active;
  636.     }
  637.     /**
  638.      * @param bool $active
  639.      *
  640.      * @return Address
  641.      */
  642.     public function setActive(bool $active): Address
  643.     {
  644.         $this->active $active;
  645.         return $this;
  646.     }
  647.     /**
  648.      * @return bool
  649.      */
  650.     public function isInvoiceAddress(): bool
  651.     {
  652.         return $this->invoiceAddress;
  653.     }
  654.     /**
  655.      * @param bool $invoiceAddress
  656.      *
  657.      * @return Address
  658.      */
  659.     public function setInvoiceAddress(bool $invoiceAddress): Address
  660.     {
  661.         $this->invoiceAddress $invoiceAddress;
  662.         return $this;
  663.     }
  664.     /**
  665.      * @return bool
  666.      */
  667.     public function isDefaultInvoiceAddress(): bool
  668.     {
  669.         return $this->defaultInvoiceAddress;
  670.     }
  671.     /**
  672.      * @param bool $defaultInvoiceAddress
  673.      *
  674.      * @return Address
  675.      */
  676.     public function setDefaultInvoiceAddress(bool $defaultInvoiceAddress): Address
  677.     {
  678.         $this->defaultInvoiceAddress $defaultInvoiceAddress;
  679.         return $this;
  680.     }
  681.     /**
  682.      * @return bool
  683.      */
  684.     public function isDefaultShippingAddress(): bool
  685.     {
  686.         return $this->defaultShippingAddress;
  687.     }
  688.     /**
  689.      * @param bool $defaultShippingAddress
  690.      *
  691.      * @return Address
  692.      */
  693.     public function setDefaultShippingAddress(bool $defaultShippingAddress): Address
  694.     {
  695.         $this->defaultShippingAddress $defaultShippingAddress;
  696.         return $this;
  697.     }
  698.     /**
  699.      * @return bool|null
  700.      */
  701.     public function getVise(): ?bool
  702.     {
  703.         return $this->vise;
  704.     }
  705.     /**
  706.      * @param bool|null $vise
  707.      *
  708.      * @return Address
  709.      */
  710.     public function setVise(?bool $vise): Address
  711.     {
  712.         $this->vise $vise;
  713.         return $this;
  714.     }
  715.     public function getRe(): ?bool
  716.     {
  717.         return $this->re;
  718.     }
  719.     public function setRe(?bool $re): Address
  720.     {
  721.         $this->re $re;
  722.         return $this;
  723.     }
  724.     /**
  725.      * @return string|null
  726.      */
  727.     public function getIsoCode(): ?string
  728.     {
  729.         return $this->isoCode;
  730.     }
  731.     /**
  732.      * @param string|null $isoCode
  733.      *
  734.      * @return Address
  735.      */
  736.     public function setIsoCode(?string $isoCode): Address
  737.     {
  738.         $this->isoCode $isoCode;
  739.         return $this;
  740.     }
  741.     /**
  742.      * @return string|null
  743.      */
  744.     public function getComercialName(): ?string
  745.     {
  746.         return $this->comercialName;
  747.     }
  748.     /**
  749.      * @param string|null $comercialName
  750.      *
  751.      * @return Address
  752.      */
  753.     public function setComercialName(?string $comercialName): Address
  754.     {
  755.         $this->comercialName $comercialName;
  756.         return $this;
  757.     }
  758.     /**
  759.      * @return int|null
  760.      */
  761.     public function getTypeCustomer(): ?int
  762.     {
  763.         return $this->typeCustomer;
  764.     }
  765.     /**
  766.      * @param int $typeCustomer
  767.      *
  768.      * @return Address
  769.      */
  770.     public function setTypeCustomer(int $typeCustomer): Address
  771.     {
  772.         $this->typeCustomer $typeCustomer;
  773.         return $this;
  774.     }
  775.     /**
  776.      * @return string|null
  777.      */
  778.     public function getContactName(): ?string
  779.     {
  780.         return $this->contactName;
  781.     }
  782.     /**
  783.      * @param string|null $contactName
  784.      *
  785.      * @return Address
  786.      */
  787.     public function setContactName(?string $contactName): Address
  788.     {
  789.         $this->contactName $contactName;
  790.         return $this;
  791.     }
  792.     /**
  793.      * @return string|null
  794.      */
  795.     public function getUrl(): ?string
  796.     {
  797.         return $this->url;
  798.     }
  799.     /**
  800.      * @param string|null $url
  801.      *
  802.      * @return Address
  803.      */
  804.     public function setUrl(?string $url): Address
  805.     {
  806.         $this->url $url;
  807.         return $this;
  808.     }
  809.     /**
  810.      * @return int
  811.      */
  812.     public function getPhonePrefix(): int
  813.     {
  814.         return $this->phonePrefix;
  815.     }
  816.     /**
  817.      * @param int $phonePrefix
  818.      *
  819.      * @return Address
  820.      */
  821.     public function setPhonePrefix(int $phonePrefix): Address
  822.     {
  823.         $this->phonePrefix $phonePrefix;
  824.         return $this;
  825.     }
  826.     /**
  827.      * @return int
  828.      */
  829.     public function getPhoneMobilePrefix(): int
  830.     {
  831.         return $this->phoneMobilePrefix;
  832.     }
  833.     /**
  834.      * @param int $phoneMobilePrefix
  835.      *
  836.      * @return Address
  837.      */
  838.     public function setPhoneMobilePrefix(int $phoneMobilePrefix): Address
  839.     {
  840.         $this->phoneMobilePrefix $phoneMobilePrefix;
  841.         return $this;
  842.     }
  843.     /**
  844.      * @return int|null
  845.      */
  846.     public function getFavorite(): ?int
  847.     {
  848.         return $this->favorite;
  849.     }
  850.     /**
  851.      * @param int|null $favorite
  852.      *
  853.      * @return Address
  854.      */
  855.     public function setFavorite(?int $favorite): Address
  856.     {
  857.         $this->favorite $favorite;
  858.         return $this;
  859.     }
  860.     /**
  861.      * @return string|null
  862.      */
  863.     public function getCompanyName(): ?string
  864.     {
  865.         return $this->companyName;
  866.     }
  867.     /**
  868.      * @param string|null $companyName
  869.      *
  870.      * @return Address
  871.      */
  872.     public function setCompanyName(?string $companyName): Address
  873.     {
  874.         $this->companyName $companyName;
  875.         return $this;
  876.     }
  877.     public function getCustomer(): Customer
  878.     {
  879.         return $this->customer;
  880.     }
  881.     public function setCustomer(Customer $customer): self
  882.     {
  883.         $this->customer $customer;
  884.         return $this;
  885.     }
  886.     /**
  887.      * @return int|null
  888.      */
  889.     public function getManufacturer(): ?int
  890.     {
  891.         return $this->manufacturer;
  892.     }
  893.     /**
  894.      * @param int|null $manufacturer
  895.      *
  896.      * @return Address
  897.      */
  898.     public function setManufacturer(?int $manufacturer): self
  899.     {
  900.         $this->manufacturer $manufacturer;
  901.         return $this;
  902.     }
  903.     /**
  904.      * @return string|null
  905.      */
  906.     public function getIsoVatNumber(): ?string
  907.     {
  908.         return $this->isoVatNumber;
  909.     }
  910.     /**
  911.      * @param string|null $isoVatNumber
  912.      *
  913.      * @return Address
  914.      */
  915.     public function setIsoVatNumber(?string $isoVatNumber): self
  916.     {
  917.         $this->isoVatNumber $isoVatNumber;
  918.         return $this;
  919.     }
  920.     public function isCompanyVerified(): bool
  921.     {
  922.         return $this->companyVerified;
  923.     }
  924.     public function setCompanyVerified(bool $companyVerified): Address
  925.     {
  926.         $this->companyVerified $companyVerified;
  927.         return $this;
  928.     }
  929.     public function getFullName(): ?string
  930.     {
  931.         return $this->name.' '.$this->surnames;
  932.     }
  933.     public function getEori(): ?string
  934.     {
  935.         return $this->eori;
  936.     }
  937.     public function setEori(?string $eori): void
  938.     {
  939.         $this->eori $eori;
  940.     }
  941.     public function getVoec(): ?string
  942.     {
  943.         return $this->voec;
  944.     }
  945.     public function setVoec(?string $voec): void
  946.     {
  947.         $this->voec $voec;
  948.     }
  949.     /**
  950.      * @Assert\Callback
  951.      */
  952.     public function validateRequiredFieldsByCustomerType(ExecutionContextInterface $context): void
  953.     {
  954.         if ($this->typeCustomer) {
  955.             if ($this->typeCustomer === self::TYPE_INDIVIDUAL && (empty($this->name) || empty($this->surnames))) {
  956.                 $context
  957.                     ->buildViolation('Name and surnames are required for individual customers.')
  958.                     ->addViolation();
  959.             }
  960.             if (($this->typeCustomer === self::TYPE_SELF_EMPLOYED || $this->typeCustomer === self::TYPE_COMPANY) && empty($this->company)) {
  961.                 $context
  962.                     ->buildViolation('Company is required for self-employed and companies.')
  963.                     ->addViolation();
  964.             }
  965.         }
  966.     }
  967.     public function isB2C(): bool
  968.     {
  969.         return $this->typeCustomer === self::TYPE_INDIVIDUAL;
  970.     }
  971. }