src/Entity/PointsCatalog/CatalogGiftProvider.php line 26

Open in your IDE?
  1. <?php
  2. namespace App\Entity\PointsCatalog;
  3. use App\Annotation\SiteAware;
  4. use App\Entity\AbstractBase;
  5. use App\Entity\Interfaces\SiteInterface;
  6. use App\Entity\MiniAbstractBase;
  7. use App\Entity\Traits\NameTrait;
  8. use App\Entity\Traits\PublishedTrait;
  9. use App\Entity\Traits\SiteTrait;
  10. use App\Enum\SiteEnum;
  11. use App\Repository\PointsCatalog\CatalogGiftProviderRepository;
  12. use Doctrine\Common\Collections\ArrayCollection;
  13. use Doctrine\Common\Collections\Collection;
  14. use Doctrine\ORM\Mapping as ORM;
  15. use Gedmo\Mapping\Annotation as Gedmo;
  16. use Symfony\Component\Validator\Constraints as Assert;
  17. /**
  18.  * @ORM\Table(name="vulco_points_catalog_gift_provider", indexes={@ORM\Index(name="catalog_gift_provider_site_idx", columns={"site"})})
  19.  * @ORM\Entity(repositoryClass=CatalogGiftProviderRepository::class)
  20.  * @Gedmo\SoftDeleteable(fieldName="removedAt", timeAware=false)
  21.  * @SiteAware(siteFieldName="site")
  22.  */
  23. class CatalogGiftProvider extends AbstractBase implements SiteInterface
  24. {
  25.     use NameTrait;
  26.     use PublishedTrait;
  27.     use SiteTrait;
  28.     public const DELIVERY_BLOCK_ORDER 0;
  29.     public const DELIVERY_MIN_POINTS_RESTRICTION 1;
  30.     /**
  31.      * @ORM\Column(type="string", length=255)
  32.      * @Assert\NotBlank()
  33.      */
  34.     private string $name;
  35.     /**
  36.      * @ORM\Column(type="string", length=255, nullable=true)
  37.      */
  38.     private ?string $sapCode null;
  39.     /**
  40.      * @ORM\Column(type="string", length=255, nullable=true)
  41.      */
  42.     private ?string $address null;
  43.     /**
  44.      * @ORM\Column(type="string", length=255, nullable=true)
  45.      */
  46.     private ?string $locality null;
  47.     /**
  48.      * @ORM\Column(type="string", length=255, nullable=true)
  49.      */
  50.     private ?string $zipCode null;
  51.     /**
  52.      * @ORM\Column(type="string", length=255, nullable=true)
  53.      */
  54.     private ?string $province null;
  55.     /**
  56.      * @ORM\Column(type="string", length=255, nullable=true)
  57.      */
  58.     private ?string $country null;
  59.     /**
  60.      * @ORM\Column(type="string", length=255, nullable=true)
  61.      */
  62.     private ?string $phone1 null;
  63.     /**
  64.      * @ORM\Column(type="string", length=255, nullable=true)
  65.      */
  66.     private ?string $phone2 null;
  67.     /**
  68.      * @ORM\Column(type="string", length=255, nullable=true)
  69.      */
  70.     private ?string $fax null;
  71.     /**
  72.      * @ORM\Column(type="string", length=255, nullable=true)
  73.      * @Assert\Email()
  74.      */
  75.     private ?string $contactEmail null;
  76.     /**
  77.      * @ORM\Column(type="string", length=255)
  78.      * @Assert\NotBlank()
  79.      */
  80.     private string $ordersEmail;
  81.     /**
  82.      * @ORM\Column(type="string", length=255, nullable=true)
  83.      * @Assert\Url()
  84.      */
  85.     private ?string $web null;
  86.     /**
  87.      * @ORM\Column(type="string", length=255, nullable=true)
  88.      */
  89.     private ?string $legalName null;
  90.     /**
  91.      * @ORM\Column(type="string", length=255, nullable=true)
  92.      */
  93.     private ?string $cif null;
  94.     /**
  95.      * @ORM\Column(type="integer", nullable=true)
  96.      */
  97.     private ?int $deliveryManagementPoints null;
  98.     /**
  99.      * @ORM\Column(type="integer", nullable=true)
  100.      */
  101.     private ?int $deliveryManagementMinimumPoints null;
  102.     /**
  103.      * @ORM\Column(type="integer", nullable=true)
  104.      */
  105.     private ?int $deliveryManagementMinimumPointsQuestion null;
  106.     /**
  107.      * @ORM\Column(type="string", length=255, nullable=true)
  108.      */
  109.     private ?string $deliveryManagementMinimumPointsHelpText null;
  110.     /**
  111.      * @ORM\Column(type="string", length=255, nullable=true)
  112.      */
  113.     private ?string $contactPersonName null;
  114.     /**
  115.      * @ORM\Column(type="string", length=255, nullable=true)
  116.      */
  117.     private ?string $contactPersonFixPhone null;
  118.     /**
  119.      * @ORM\Column(type="string", length=255, nullable=true)
  120.      */
  121.     private ?string $contactPersonMobilePhone null;
  122.     /**
  123.      * @ORM\Column(type="string", length=255, nullable=true)
  124.      */
  125.     private ?string $contactPersonEmail null;
  126.     /**
  127.      * @ORM\Column(type="string", length=255, nullable=true)
  128.      */
  129.     private ?string $billingPersonName null;
  130.     /**
  131.      * @ORM\Column(type="string", length=255, nullable=true)
  132.      */
  133.     private ?string $billingPersonFixPhone null;
  134.     /**
  135.      * @ORM\Column(type="string", length=255, nullable=true)
  136.      */
  137.     private ?string $billingPersonMobilePhone null;
  138.     /**
  139.      * @ORM\Column(type="string", length=255, nullable=true)
  140.      */
  141.     private ?string $billingPersonEmail null;
  142.     /**
  143.      * @ORM\OneToMany(targetEntity="App\Entity\PointsCatalog\CatalogGiftHasProvider", mappedBy="provider", cascade={"persist"}, orphanRemoval=true)
  144.      */
  145.     private ?Collection $gifts;
  146.     public function __construct()
  147.     {
  148.         $this->gifts = new ArrayCollection();
  149.     }
  150.     public function getSapCode(): ?string
  151.     {
  152.         return $this->sapCode;
  153.     }
  154.     public function setSapCode(?string $sapCode): self
  155.     {
  156.         $this->sapCode $sapCode;
  157.         return $this;
  158.     }
  159.     public function getAddress(): ?string
  160.     {
  161.         return $this->address;
  162.     }
  163.     public function setAddress(?string $address): self
  164.     {
  165.         $this->address $address;
  166.         return $this;
  167.     }
  168.     public function getLocality(): ?string
  169.     {
  170.         return $this->locality;
  171.     }
  172.     public function setLocality(?string $locality): self
  173.     {
  174.         $this->locality $locality;
  175.         return $this;
  176.     }
  177.     public function getZipCode(): ?string
  178.     {
  179.         return $this->zipCode;
  180.     }
  181.     public function setZipCode(?string $zipCode): self
  182.     {
  183.         $this->zipCode $zipCode;
  184.         return $this;
  185.     }
  186.     public function getProvince(): ?string
  187.     {
  188.         return $this->province;
  189.     }
  190.     public function setProvince(?string $province): self
  191.     {
  192.         $this->province $province;
  193.         return $this;
  194.     }
  195.     public function getCountry(): ?string
  196.     {
  197.         return $this->country;
  198.     }
  199.     public function getCountryLanguageTranlatorKey(): string
  200.     {
  201.         $result MiniAbstractBase::DEFAULT_EMPTY_STRING;
  202.         if ($this->getCountry() && array_key_exists(strtolower($this->getCountry()), SiteEnum::getReversedLanguages())) {
  203.             $result SiteEnum::getReversedLanguages()[strtolower($this->getCountry())];
  204.         }
  205.         return $result;
  206.     }
  207.     public function setCountry(?string $country): self
  208.     {
  209.         $this->country $country;
  210.         return $this;
  211.     }
  212.     public function getPhone1(): ?string
  213.     {
  214.         return $this->phone1;
  215.     }
  216.     public function setPhone1(?string $phone1): self
  217.     {
  218.         $this->phone1 $phone1;
  219.         return $this;
  220.     }
  221.     public function getPhone2(): ?string
  222.     {
  223.         return $this->phone2;
  224.     }
  225.     public function setPhone2(?string $phone2): self
  226.     {
  227.         $this->phone2 $phone2;
  228.         return $this;
  229.     }
  230.     public function getFax(): ?string
  231.     {
  232.         return $this->fax;
  233.     }
  234.     public function setFax(?string $fax): self
  235.     {
  236.         $this->fax $fax;
  237.         return $this;
  238.     }
  239.     public function getContactEmail(): ?string
  240.     {
  241.         return $this->contactEmail;
  242.     }
  243.     public function setContactEmail(?string $email): self
  244.     {
  245.         $this->contactEmail $email;
  246.         return $this;
  247.     }
  248.     public function getOrdersEmail(): string
  249.     {
  250.         return $this->ordersEmail;
  251.     }
  252.     public function setOrdersEmail(string $email): self
  253.     {
  254.         $this->ordersEmail $email;
  255.         return $this;
  256.     }
  257.     public function getWeb(): ?string
  258.     {
  259.         return $this->web;
  260.     }
  261.     public function setWeb(?string $web): self
  262.     {
  263.         $this->web $web;
  264.         return $this;
  265.     }
  266.     public function getLegalName(): ?string
  267.     {
  268.         return $this->legalName;
  269.     }
  270.     public function setLegalName(?string $legalName): self
  271.     {
  272.         $this->legalName $legalName;
  273.         return $this;
  274.     }
  275.     public function getCif(): ?string
  276.     {
  277.         return $this->cif;
  278.     }
  279.     public function setCif(?string $cif): self
  280.     {
  281.         $this->cif $cif;
  282.         return $this;
  283.     }
  284.     public function getDeliveryManagementPoints(): ?int
  285.     {
  286.         return $this->deliveryManagementPoints;
  287.     }
  288.     public function setDeliveryManagementPoints(?int $deliveryManagementPoints): self
  289.     {
  290.         $this->deliveryManagementPoints $deliveryManagementPoints;
  291.         return $this;
  292.     }
  293.     public function getDeliveryManagementMinimumPoints(): ?int
  294.     {
  295.         return $this->deliveryManagementMinimumPoints;
  296.     }
  297.     public function setDeliveryManagementMinimumPoints(?int $deliveryManagementMinimumPoints): self
  298.     {
  299.         $this->deliveryManagementMinimumPoints $deliveryManagementMinimumPoints;
  300.         return $this;
  301.     }
  302.     public function getDeliveryManagementMinimumPointsQuestion(): ?int
  303.     {
  304.         return $this->deliveryManagementMinimumPointsQuestion;
  305.     }
  306.     public function setDeliveryManagementMinimumPointsQuestion(?int $deliveryManagementMinimumPointsQuestion): self
  307.     {
  308.         $this->deliveryManagementMinimumPointsQuestion $deliveryManagementMinimumPointsQuestion;
  309.         return $this;
  310.     }
  311.     public function getDeliveryManagementMinimumPointsHelpText(): ?string
  312.     {
  313.         return $this->deliveryManagementMinimumPointsHelpText;
  314.     }
  315.     public function setDeliveryManagementMinimumPointsHelpText(?string $deliveryManagementMinimumPointsHelpText): self
  316.     {
  317.         $this->deliveryManagementMinimumPointsHelpText $deliveryManagementMinimumPointsHelpText;
  318.         return $this;
  319.     }
  320.     public function getContactPersonName(): ?string
  321.     {
  322.         return $this->contactPersonName;
  323.     }
  324.     public function setContactPersonName(?string $contactPersonName): self
  325.     {
  326.         $this->contactPersonName $contactPersonName;
  327.         return $this;
  328.     }
  329.     public function getContactPersonFixPhone(): ?string
  330.     {
  331.         return $this->contactPersonFixPhone;
  332.     }
  333.     public function setContactPersonFixPhone(?string $contactPersonFixPhone): self
  334.     {
  335.         $this->contactPersonFixPhone $contactPersonFixPhone;
  336.         return $this;
  337.     }
  338.     public function getContactPersonMobilePhone(): ?string
  339.     {
  340.         return $this->contactPersonMobilePhone;
  341.     }
  342.     public function setContactPersonMobilePhone(?string $contactPersonMobilePhone): self
  343.     {
  344.         $this->contactPersonMobilePhone $contactPersonMobilePhone;
  345.         return $this;
  346.     }
  347.     public function getContactPersonEmail(): ?string
  348.     {
  349.         return $this->contactPersonEmail;
  350.     }
  351.     public function setContactPersonEmail(?string $contactPersonEmail): self
  352.     {
  353.         $this->contactPersonEmail $contactPersonEmail;
  354.         return $this;
  355.     }
  356.     public function getBillingPersonName(): ?string
  357.     {
  358.         return $this->billingPersonName;
  359.     }
  360.     public function setBillingPersonName(?string $billingPersonName): self
  361.     {
  362.         $this->billingPersonName $billingPersonName;
  363.         return $this;
  364.     }
  365.     public function getBillingPersonFixPhone(): ?string
  366.     {
  367.         return $this->billingPersonFixPhone;
  368.     }
  369.     public function setBillingPersonFixPhone(?string $billingPersonFixPhone): self
  370.     {
  371.         $this->billingPersonFixPhone $billingPersonFixPhone;
  372.         return $this;
  373.     }
  374.     public function getBillingPersonMobilePhone(): ?string
  375.     {
  376.         return $this->billingPersonMobilePhone;
  377.     }
  378.     public function setBillingPersonMobilePhone(?string $billingPersonMobilePhone): self
  379.     {
  380.         $this->billingPersonMobilePhone $billingPersonMobilePhone;
  381.         return $this;
  382.     }
  383.     public function getBillingPersonEmail(): ?string
  384.     {
  385.         return $this->billingPersonEmail;
  386.     }
  387.     public function setBillingPersonEmail(?string $billingPersonEmail): self
  388.     {
  389.         $this->billingPersonEmail $billingPersonEmail;
  390.         return $this;
  391.     }
  392.     public function getGifts(): ?Collection
  393.     {
  394.         return $this->gifts;
  395.     }
  396.     public function setGifts(?Collection $gifts): self
  397.     {
  398.         $this->gifts $gifts;
  399.         return $this;
  400.     }
  401.     public function hasDeliveryBlocked(): bool
  402.     {
  403.         return self::DELIVERY_BLOCK_ORDER === $this->deliveryManagementMinimumPointsQuestion;
  404.     }
  405.     public function hasMinPointsRestriction(): bool
  406.     {
  407.         return self::DELIVERY_MIN_POINTS_RESTRICTION === $this->deliveryManagementMinimumPointsQuestion;
  408.     }
  409.     public function exceedsMinPointsRestriction(int $points): bool
  410.     {
  411.         return $points >= $this->deliveryManagementMinimumPoints;
  412.     }
  413.     public function __toString(): string
  414.     {
  415.         return $this->name $this->getName() : MiniAbstractBase::DEFAULT_EMPTY_STRING;
  416.     }
  417. }