src/Entity/XmlApi.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\XmlApiRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Symfony\Component\Validator\Constraints as Asserts;
  7. use Doctrine\Common\Collections\Collection;
  8. #[ORM\Entity(repositoryClassXmlApiRepository::class)]
  9. class XmlApi extends Product
  10. {
  11.     const XMLAPI_DEFAULT_MARGIN 10;
  12.     #[ORM\Column(length255)]
  13.     private ?string $name null;
  14.     #[ORM\Column(length128)]
  15.     private ?string $gdsCode null;
  16.     #[ORM\Column(length32nullabletrue)]
  17.     private ?string $color null;
  18.     #[ORM\Column]
  19.     private ?bool $payAtHotelAuthorized null;
  20.     #[ORM\Column(nullabletrue)]
  21.     #[Asserts\LessThanOrEqual(100message'The value should be between 1 and 100!')]
  22.     private ?float $immediatePaymentPercent null;
  23.     #[ORM\ManyToOne]
  24.     private ?CreditCard $creditCard null;
  25.     #[ORM\Column]
  26.     private ?int $source null;
  27.     #[ORM\Column]
  28.     private ?float $marginB2C null;
  29.     #[ORM\Column]
  30.     private ?float $marginB2B null;
  31.     #[ORM\OneToMany(mappedBy'xmlApi'targetEntityCustomerXmlApi::class)]
  32.     private  $customerXmlApis;
  33.     #[ORM\Column]
  34.     private ?bool $active null;
  35.     #[ORM\Column(length45nullabletrue)]
  36.     private ?string $xmlApiType null;
  37.     #[ORM\ManyToOne(inversedBy'b2cXmlApis')]
  38.     private ?MarkupStrategy $b2cMarkupStrategy null;
  39.     #[ORM\ManyToOne(inversedBy'b2bXmlApis')]
  40.     private ?MarkupStrategy $b2bMarkupStrategy null;
  41.     #[ORM\OneToMany(mappedBy'xmlApi'targetEntityAirlineXmlApi::class, orphanRemovaltrue)]
  42.     private Collection $airlineXmlApis;
  43.     public function __construct()
  44.     {
  45.         parent::__construct();
  46.         $this->customerXmlApis = new ArrayCollection();
  47.         $this->airlineXmlApis = new ArrayCollection();
  48.     }
  49.     public function getName(): ?string
  50.     {
  51.         return $this->name;
  52.     }
  53.     public function setName(string $name): self
  54.     {
  55.         $this->name $name;
  56.         return $this;
  57.     }
  58.     public function getGdsCode(): ?string
  59.     {
  60.         return $this->gdsCode;
  61.     }
  62.     public function setGdsCode(string $gdsCode): self
  63.     {
  64.         $this->gdsCode $gdsCode;
  65.         return $this;
  66.     }
  67.     public function getColor(): ?string
  68.     {
  69.         return $this->color;
  70.     }
  71.     public function setColor(?string $color): self
  72.     {
  73.         $this->color $color;
  74.         return $this;
  75.     }
  76.     public function isPayAtHotelAuthorized(): ?bool
  77.     {
  78.         return $this->payAtHotelAuthorized;
  79.     }
  80.     public function setPayAtHotelAuthorized(bool $payAtHotelAuthorized): self
  81.     {
  82.         $this->payAtHotelAuthorized $payAtHotelAuthorized;
  83.         return $this;
  84.     }
  85.     public function getImmediatePaymentPercent(): ?float
  86.     {
  87.         return $this->immediatePaymentPercent;
  88.     }
  89.     public function setImmediatePaymentPercent(?float $immediatePaymentPercent): self
  90.     {
  91.         $this->immediatePaymentPercent $immediatePaymentPercent;
  92.         return $this;
  93.     }
  94.     public function getCreditCard(): ?CreditCard
  95.     {
  96.         return $this->creditCard;
  97.     }
  98.     public function setCreditCard(?CreditCard $creditCard): self
  99.     {
  100.         $this->creditCard $creditCard;
  101.         return $this;
  102.     }
  103.     public function getSource(): ?int
  104.     {
  105.         return $this->source;
  106.     }
  107.     public function setSource(int $source): self
  108.     {
  109.         $this->source $source;
  110.         return $this;
  111.     }
  112.     public function __toString(): string
  113.     {
  114.         return $this->name ?? 'UNDEFINED';
  115.         // Todo - s'assurer que les xml-api ont des noms non vides
  116.     }
  117.     public function getmarginB2C(): ?float
  118.     {
  119.         return $this->marginB2C;
  120.     }
  121.     public function setmarginB2C(float $marginB2C): static
  122.     {
  123.         $this->marginB2C $marginB2C;
  124.         return $this;
  125.     }
  126.     public function getmarginB2B(): ?float
  127.     {
  128.         return $this->marginB2B;
  129.     }
  130.     public function setmarginB2B(float $marginB2B): static
  131.     {
  132.         $this->marginB2B $marginB2B;
  133.         return $this;
  134.     }
  135.     /**
  136.      * @return Collection<int, CustomerXmlApi>
  137.      */
  138.     public function getCustomerXmlApis(): Collection
  139.     {
  140.         return $this->customerXmlApis;
  141.     }
  142.     public function addCustomerXmlApi(CustomerXmlApi $customerXmlApi): self
  143.     {
  144.         if (!$this->customerXmlApis->contains($customerXmlApi)) {
  145.             $this->customerXmlApis[] = $customerXmlApi;
  146.             $customerXmlApi->setXmlApi($this);
  147.         }
  148.         return $this;
  149.     }
  150.     public function removeCustomerXmlApis(CustomerXmlApi $customerXmlApis): self
  151.     {
  152.         if ($this->customerXmlApis->removeElement($customerXmlApis)) {
  153.             // set the owning side to null (unless already changed)
  154.             if ($customerXmlApis->getXmlApi() === $this) {
  155.                 $customerXmlApis->setXmlApi(null);
  156.             }
  157.         }
  158.         return $this;
  159.     }
  160.     public function isActive(): ?bool
  161.     {
  162.         return $this->active;
  163.     }
  164.     public function setActive(bool $active): static
  165.     {
  166.         $this->active $active;
  167.         return $this;
  168.     }
  169.     public function getClass()  : string {
  170.         return "XmlApi";
  171.     }
  172.     public function getIcon(): string
  173.     {
  174.         return match ($this->xmlApiType) {
  175.             "HOTEL" => "fas fa-hotel",
  176.             "TRANSFER" => "fas fa-car",
  177.             "FLIGHT" => "fas fa-plane",
  178.             default => "fe-rss",
  179.         };
  180.     }
  181.     public function getXmlApiType(): ?string
  182.     {
  183.         return $this->xmlApiType;
  184.     }
  185.     public function setXmlApiType(?string $xmlApiType): static
  186.     {
  187.         $this->xmlApiType $xmlApiType;
  188.         return $this;
  189.     }
  190.     public function getB2cMarkupStrategy(): ?MarkupStrategy
  191.     {
  192.         return $this->b2cMarkupStrategy;
  193.     }
  194.     public function setB2cMarkupStrategy(?MarkupStrategy $b2cMarkupStrategy): static
  195.     {
  196.         $this->b2cMarkupStrategy $b2cMarkupStrategy;
  197.         return $this;
  198.     }
  199.     public function getB2bMarkupStrategy(): ?MarkupStrategy
  200.     {
  201.         return $this->b2bMarkupStrategy;
  202.     }
  203.     public function setB2bMarkupStrategy(?MarkupStrategy $b2bMarkupStrategy): static
  204.     {
  205.         $this->b2bMarkupStrategy $b2bMarkupStrategy;
  206.         return $this;
  207.     }
  208.     /**
  209.      * @return Collection<int, AirlineXmlApi>
  210.      */
  211.     public function getAirlineXmlApis(): Collection
  212.     {
  213.         return $this->airlineXmlApis;
  214.     }
  215.     public function addAirlineXmlApi(AirlineXmlApi $airlineXmlApi): static
  216.     {
  217.         if (!$this->airlineXmlApis->contains($airlineXmlApi)) {
  218.             $this->airlineXmlApis->add($airlineXmlApi);
  219.             $airlineXmlApi->setXmlApi($this);
  220.         }
  221.         return $this;
  222.     }
  223.     public function removeAirlineXmlApi(AirlineXmlApi $airlineXmlApi): static
  224.     {
  225.         if ($this->airlineXmlApis->removeElement($airlineXmlApi)) {
  226.             // set the owning side to null (unless already changed)
  227.             if ($airlineXmlApi->getXmlApi() === $this) {
  228.                 $airlineXmlApi->setXmlApi(null);
  229.             }
  230.         }
  231.         return $this;
  232.     }
  233. }