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.     #[ORM\Column(length45nullabletrue)]
  44.     private ?string $commissionType null;
  45.     public function __construct()
  46.     {
  47.         parent::__construct();
  48.         $this->customerXmlApis = new ArrayCollection();
  49.         $this->airlineXmlApis = new ArrayCollection();
  50.     }
  51.     public function getName(): ?string
  52.     {
  53.         return $this->name;
  54.     }
  55.     public function setName(string $name): self
  56.     {
  57.         $this->name $name;
  58.         return $this;
  59.     }
  60.     public function getGdsCode(): ?string
  61.     {
  62.         return $this->gdsCode;
  63.     }
  64.     public function setGdsCode(string $gdsCode): self
  65.     {
  66.         $this->gdsCode $gdsCode;
  67.         return $this;
  68.     }
  69.     public function getColor(): ?string
  70.     {
  71.         return $this->color;
  72.     }
  73.     public function setColor(?string $color): self
  74.     {
  75.         $this->color $color;
  76.         return $this;
  77.     }
  78.     public function isPayAtHotelAuthorized(): ?bool
  79.     {
  80.         return $this->payAtHotelAuthorized;
  81.     }
  82.     public function setPayAtHotelAuthorized(bool $payAtHotelAuthorized): self
  83.     {
  84.         $this->payAtHotelAuthorized $payAtHotelAuthorized;
  85.         return $this;
  86.     }
  87.     public function getImmediatePaymentPercent(): ?float
  88.     {
  89.         return $this->immediatePaymentPercent;
  90.     }
  91.     public function setImmediatePaymentPercent(?float $immediatePaymentPercent): self
  92.     {
  93.         $this->immediatePaymentPercent $immediatePaymentPercent;
  94.         return $this;
  95.     }
  96.     public function getCreditCard(): ?CreditCard
  97.     {
  98.         return $this->creditCard;
  99.     }
  100.     public function setCreditCard(?CreditCard $creditCard): self
  101.     {
  102.         $this->creditCard $creditCard;
  103.         return $this;
  104.     }
  105.     public function getSource(): ?int
  106.     {
  107.         return $this->source;
  108.     }
  109.     public function setSource(int $source): self
  110.     {
  111.         $this->source $source;
  112.         return $this;
  113.     }
  114.     public function __toString(): string
  115.     {
  116.         return $this->name ?? 'UNDEFINED';
  117.         // Todo - s'assurer que les xml-api ont des noms non vides
  118.     }
  119.     public function getmarginB2C(): ?float
  120.     {
  121.         return $this->marginB2C;
  122.     }
  123.     public function setmarginB2C(float $marginB2C): static
  124.     {
  125.         $this->marginB2C $marginB2C;
  126.         return $this;
  127.     }
  128.     public function getmarginB2B(): ?float
  129.     {
  130.         return $this->marginB2B;
  131.     }
  132.     public function setmarginB2B(float $marginB2B): static
  133.     {
  134.         $this->marginB2B $marginB2B;
  135.         return $this;
  136.     }
  137.     /**
  138.      * @return Collection<int, CustomerXmlApi>
  139.      */
  140.     public function getCustomerXmlApis(): Collection
  141.     {
  142.         return $this->customerXmlApis;
  143.     }
  144.     public function addCustomerXmlApi(CustomerXmlApi $customerXmlApi): self
  145.     {
  146.         if (!$this->customerXmlApis->contains($customerXmlApi)) {
  147.             $this->customerXmlApis[] = $customerXmlApi;
  148.             $customerXmlApi->setXmlApi($this);
  149.         }
  150.         return $this;
  151.     }
  152.     public function removeCustomerXmlApis(CustomerXmlApi $customerXmlApis): self
  153.     {
  154.         if ($this->customerXmlApis->removeElement($customerXmlApis)) {
  155.             // set the owning side to null (unless already changed)
  156.             if ($customerXmlApis->getXmlApi() === $this) {
  157.                 $customerXmlApis->setXmlApi(null);
  158.             }
  159.         }
  160.         return $this;
  161.     }
  162.     public function isActive(): ?bool
  163.     {
  164.         return $this->active;
  165.     }
  166.     public function setActive(bool $active): static
  167.     {
  168.         $this->active $active;
  169.         return $this;
  170.     }
  171.     public function getClass()  : string {
  172.         return "XmlApi";
  173.     }
  174.     public function getIcon(): string
  175.     {
  176.         return match ($this->xmlApiType) {
  177.             "HOTEL" => "fas fa-hotel",
  178.             "TRANSFER" => "fas fa-car",
  179.             "FLIGHT" => "fas fa-plane",
  180.             default => "fe-rss",
  181.         };
  182.     }
  183.     public function getXmlApiType(): ?string
  184.     {
  185.         return $this->xmlApiType;
  186.     }
  187.     public function setXmlApiType(?string $xmlApiType): static
  188.     {
  189.         $this->xmlApiType $xmlApiType;
  190.         return $this;
  191.     }
  192.     public function getB2cMarkupStrategy(): ?MarkupStrategy
  193.     {
  194.         return $this->b2cMarkupStrategy;
  195.     }
  196.     public function setB2cMarkupStrategy(?MarkupStrategy $b2cMarkupStrategy): static
  197.     {
  198.         $this->b2cMarkupStrategy $b2cMarkupStrategy;
  199.         return $this;
  200.     }
  201.     public function getB2bMarkupStrategy(): ?MarkupStrategy
  202.     {
  203.         return $this->b2bMarkupStrategy;
  204.     }
  205.     public function setB2bMarkupStrategy(?MarkupStrategy $b2bMarkupStrategy): static
  206.     {
  207.         $this->b2bMarkupStrategy $b2bMarkupStrategy;
  208.         return $this;
  209.     }
  210.     /**
  211.      * @return Collection<int, AirlineXmlApi>
  212.      */
  213.     public function getAirlineXmlApis(): Collection
  214.     {
  215.         return $this->airlineXmlApis;
  216.     }
  217.     public function addAirlineXmlApi(AirlineXmlApi $airlineXmlApi): static
  218.     {
  219.         if (!$this->airlineXmlApis->contains($airlineXmlApi)) {
  220.             $this->airlineXmlApis->add($airlineXmlApi);
  221.             $airlineXmlApi->setXmlApi($this);
  222.         }
  223.         return $this;
  224.     }
  225.     public function removeAirlineXmlApi(AirlineXmlApi $airlineXmlApi): static
  226.     {
  227.         if ($this->airlineXmlApis->removeElement($airlineXmlApi)) {
  228.             // set the owning side to null (unless already changed)
  229.             if ($airlineXmlApi->getXmlApi() === $this) {
  230.                 $airlineXmlApi->setXmlApi(null);
  231.             }
  232.         }
  233.         return $this;
  234.     }
  235.     public function getCommissionType(): ?string
  236.     {
  237.         return $this->commissionType;
  238.     }
  239.     public function setCommissionType(string $commissionType): static
  240.     {
  241.         $this->commissionType $commissionType;
  242.         return $this;
  243.     }
  244. }