src/Entity/System/Address.php line 22

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