src/Entity/Offer.php line 12

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\OfferRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. #[ORM\Entity(repositoryClassOfferRepository::class)]
  9. class Offer
  10. {
  11.     #[ORM\IdORM\GeneratedValueORM\Column(type"integer")]
  12.     private $id;
  13.     #[ORM\Column(type"string"length255)]
  14.     private $name;
  15.     #[ORM\Column(type"string"length255)]
  16.     private $badgeContent;
  17.     #[ORM\Column(type"string"length255nullabletrue)]
  18.     private $title;
  19.     #[ORM\Column(type"string"length255)]
  20.     private $amount;
  21.     #[ORM\Column(type"datetime_immutable")]
  22.     private $start_at;
  23.     #[ORM\Column(type"datetime_immutable")]
  24.     private $end_at;
  25.     #[ORM\OneToMany(targetEntityOfferProduct::class, mappedBy"offer"orphanRemovaltrue)]
  26.     private $offerProducts;
  27.     #[ORM\Column(type"string"length255nullabletrue)]
  28.     private $imageName;
  29.     #[ORM\Column(type"string"length255nullabletrue)]
  30.     private $mentions;
  31.     #[ORM\Column(type"string"length10)]
  32.     private $amountType;
  33.     #[ORM\Column(type"string"length20)]
  34.     private $type;
  35.     #[ORM\Column(type"datetime_immutable")]
  36.     private $addedAt;
  37.     #[ORM\Column(type"string"length20)]
  38.     private $color;
  39.     /**
  40.      * @ORM\Column(type="string", length=255, nullable=true)
  41.      */
  42.     private $offerUrl;
  43.     #[ORM\Column(length255nullabletrue)]
  44.     private ?string $amount_rib_payment null;
  45.     #[ORM\Column]
  46.     private ?bool $is_archived null;
  47.     #[ORM\Column(type"datetime_immutable")]
  48.     private ?\DateTimeImmutable $validityEndDate null;
  49.     public function __construct()
  50.     {
  51.         $this->offerProducts = new ArrayCollection();
  52.     }
  53.     public function getId(): ?int
  54.     {
  55.         return $this->id;
  56.     }
  57.     public function getName(): ?string
  58.     {
  59.         return $this->name;
  60.     }
  61.     public function setName(string $name): self
  62.     {
  63.         $this->name $name;
  64.         return $this;
  65.     }
  66.     public function getBadgeContent(): ?string
  67.     {
  68.         return $this->badgeContent;
  69.     }
  70.     public function setBadgeContent(string $badgeContent): self
  71.     {
  72.         $this->badgeContent $badgeContent;
  73.         return $this;
  74.     }
  75.     public function getTitle(): ?string
  76.     {
  77.         return $this->title;
  78.     }
  79.     public function setTitle(?string $title): self
  80.     {
  81.         $this->title $title;
  82.         return $this;
  83.     }
  84.     public function getAmount(): ?string
  85.     {
  86.         return $this->amount;
  87.     }
  88.     public function setAmount(string $amount): self
  89.     {
  90.         $this->amount $amount;
  91.         return $this;
  92.     }
  93.     public function getStartAt(): ?\DateTimeImmutable
  94.     {
  95.         return $this->start_at;
  96.     }
  97.     public function setStartAt(\DateTimeImmutable $start_at): self
  98.     {
  99.         $this->start_at $start_at;
  100.         return $this;
  101.     }
  102.     public function getEndAt(): ?\DateTimeImmutable
  103.     {
  104.         return $this->end_at;
  105.     }
  106.     public function setEndAt(\DateTimeImmutable $end_at): self
  107.     {
  108.         $this->end_at $end_at;
  109.         return $this;
  110.     }
  111.     /**
  112.      * @return Collection<int, OfferProduct>
  113.      */
  114.     public function getOfferProducts(): Collection
  115.     {
  116.         return $this->offerProducts;
  117.     }
  118.     public function addOfferProduct(OfferProduct $offerProduct): self
  119.     {
  120.         if (!$this->offerProducts->contains($offerProduct)) {
  121.             $this->offerProducts[] = $offerProduct;
  122.             $offerProduct->setOffer($this);
  123.         }
  124.         return $this;
  125.     }
  126.     public function removeOfferProduct(OfferProduct $offerProduct): self
  127.     {
  128.         if ($this->offerProducts->removeElement($offerProduct)) {
  129.             // set the owning side to null (unless already changed)
  130.             if ($offerProduct->getOffer() === $this) {
  131.                 $offerProduct->setOffer(null);
  132.             }
  133.         }
  134.         return $this;
  135.     }
  136.     public function getImageName(): ?string
  137.     {
  138.         return $this->imageName;
  139.     }
  140.     public function setImageName(?string $imageName): self
  141.     {
  142.         $this->imageName $imageName;
  143.         return $this;
  144.     }
  145.     public function getMentions(): ?string
  146.     {
  147.         return $this->mentions;
  148.     }
  149.     public function setMentions(?string $mentions): self
  150.     {
  151.         $this->mentions $mentions;
  152.         return $this;
  153.     }
  154.     public function getAmountType(): ?string
  155.     {
  156.         return $this->amountType;
  157.     }
  158.     public function setAmountType(string $amountType): self
  159.     {
  160.         $this->amountType $amountType;
  161.         return $this;
  162.     }
  163.     public function getType(): ?string
  164.     {
  165.         return $this->type;
  166.     }
  167.     public function setType(string $type): self
  168.     {
  169.         $this->type $type;
  170.         return $this;
  171.     }
  172.     public function getTypeFormatted(): ?string
  173.     {
  174.         if($this->type === "overcost"){
  175.             return "SurcĂ´te reprise";
  176.         }else{
  177.             return "Bonus reprise";
  178.         }
  179.     }
  180.     public function getAddedAt(): ?\DateTimeImmutable
  181.     {
  182.         return $this->addedAt;
  183.     }
  184.     public function setAddedAt(\DateTimeImmutable $addedAt): self
  185.     {
  186.         $this->addedAt $addedAt;
  187.         return $this;
  188.     }
  189.     public function getColor(): ?string
  190.     {
  191.         return $this->color;
  192.     }
  193.     public function setColor(string $color): self
  194.     {
  195.         $this->color $color;
  196.         return $this;
  197.     }
  198.     /**
  199.      * @return mixed
  200.      */
  201.     public function getOfferUrl()
  202.     {
  203.         return $this->offerUrl;
  204.     }
  205.     /**
  206.      * @param mixed $offerUrl
  207.      */
  208.     public function setOfferUrl($offerUrl): void
  209.     {
  210.         $this->offerUrl $offerUrl;
  211.     }
  212.     public function getAmountRibPayment(): ?string
  213.     {
  214.         return $this->amount_rib_payment;
  215.     }
  216.     public function setAmountRibPayment(?string $amount_rib_payment): static
  217.     {
  218.         $this->amount_rib_payment $amount_rib_payment;
  219.         return $this;
  220.     }
  221.     public function isIsArchived(): ?bool
  222.     {
  223.         return $this->is_archived;
  224.     }
  225.     public function setIsArchived(bool $is_archived): static
  226.     {
  227.         $this->is_archived $is_archived;
  228.         return $this;
  229.     }
  230.     public function getValidityEndDate(): ?\DateTimeImmutable
  231.     {
  232.         return $this->validityEndDate;
  233.     }
  234.     public function setValidityEndDate(?\DateTimeImmutable $validityEndDate): static
  235.     {
  236.         $this->validityEndDate $validityEndDate;
  237.         return $this;
  238.     }
  239. }