src/Entity/MarkupRule.php line 21

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\MarkupRuleRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Gedmo\Timestampable\Traits\TimestampableEntity;
  6. #[ORM\InheritanceType('JOINED')]
  7. #[ORM\DiscriminatorColumn(name: "dtype", type: "string")]
  8. #[ORM\DiscriminatorMap(
  9.     [
  10.         'basic' => MarkupBasic::class,
  11.         'price' => MarkupPrice::class,
  12.         'priceAirline' => MarkupPriceAirline::class,
  13.         'seat' => MarkupSeat::class,
  14.         'fareClass' => MarkupFareClass::class,
  15.         'airline' => MarkupAirline::class,
  16.     ])]
  17. #[ORM\Entity(repositoryClass: MarkupRuleRepository::class)]
  18. class MarkupRule
  19. {
  20.     use TimestampableEntity;
  21.     #[ORM\Id]
  22.     #[ORM\GeneratedValue]
  23.     #[ORM\Column(type: 'integer')]
  24.     private ?int $id = null;
  25.     #[ORM\Column]
  26.     private ?float $value;
  27.     #[ORM\Column]
  28.     private ?int $type;
  29.     #[ORM\ManyToOne(inversedBy: 'rules')]
  30.     private ?MarkupStrategy $markupStrategy = null;
  31.     #[ORM\Column(type: 'integer', nullable: true, options: ['default' => 0])]
  32.     private ?int $priority = 0;
  33.     public function __construct()
  34.     {
  35.         $this->value = 0;
  36.         $this->type = 0;
  37.     }
  38.     public function getPriority(): ?int
  39.     {
  40.         return $this->priority;
  41.     }
  42.     public function setPriority(?int $priority): static
  43.     {
  44.         $this->priority = $priority;
  45.         return $this;
  46.     }
  47.     public function getId(): ?int
  48.     {
  49.         return $this->id;
  50.     }
  51.     public function getValue(): ?float
  52.     {
  53.         return $this->value;
  54.     }
  55.     public function setValue(?float $value): self
  56.     {
  57.         $this->value = $value;
  58.         return $this;
  59.     }
  60.     public function getType(): ?int
  61.     {
  62.         return $this->type;
  63.     }
  64.     public function setType(?int $type): self
  65.     {
  66.         $this->type = $type;
  67.         return $this;
  68.     }
  69.     public function getMarkupStrategy(): ?MarkupStrategy
  70.     {
  71.         return $this->markupStrategy;
  72.     }
  73.     public function setMarkupStrategy(?MarkupStrategy $markupStrategy): static
  74.     {
  75.         $this->markupStrategy = $markupStrategy;
  76.         return $this;
  77.     }
  78.     public function __toString(): string
  79.     {
  80.         return $this->name ?? ' ';
  81.     }
  82.     public function getClass()  : string {
  83.         return "MarkupRule";
  84.     }
  85. }