src/Entity/Subscription.php line 12

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\SubscriptionRepository;
  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(repositoryClassSubscriptionRepository::class)]
  9. class Subscription
  10. {
  11.     const STATUS_PENDING 'pending';
  12.     const STATUS_PAID 'paid';
  13.     const STATUS_DELIVERED 'complete';
  14.     const STATUS_CANCELLED 'cancelled';
  15.     #[ORM\Id]
  16.     #[ORM\GeneratedValue]
  17.     #[ORM\Column]
  18.     private ?int $id null;
  19.     #[ORM\Column(length255nullabletrue)]
  20.     private ?string $firstName null;
  21.     #[ORM\Column(length255nullabletrue)]
  22.     private ?string $lastName null;
  23.     #[ORM\Column(length255nullabletrue)]
  24.     private ?string $place null;
  25.     #[ORM\Column(length255nullabletrue)]
  26.     private ?string $postalCode null;
  27.     #[ORM\Column(length255nullabletrue)]
  28.     private ?string $city null;
  29.     #[ORM\Column(length255nullabletrue)]
  30.     private ?string $country null;
  31.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  32.     private ?string $additionnal null;
  33.     #[ORM\Column(length255nullabletrue)]
  34.     private ?string $phone null;
  35.     #[ORM\Column(length255)]
  36.     private ?string $payment_type null;
  37.     #[ORM\Column(length50nullabletrue)]
  38.     private ?string $status self::STATUS_PENDING;
  39.     #[ORM\Column(nullabletrue)]
  40.     private ?float $amount null;
  41.     #[ORM\Column(length120nullabletrue)]
  42.     private ?string $coupon_code null;
  43.     #[ORM\Column(nullabletrue)]
  44.     private ?float $discount_amount null;
  45.     #[ORM\Column(nullabletrue)]
  46.     private ?float $sub_total null;
  47.     #[ORM\Column(nullabletrue)]
  48.     private ?string $is_confirmed null;
  49.     #[ORM\OneToMany(mappedBy'subscription'targetEntitySubscriptionProduct::class)]
  50.     private Collection $subscriptionProducts;
  51.     #[ORM\Column(length15)]
  52.     private ?string $reference null;
  53.     #[ORM\ManyToOne(inversedBy'subscriptions')]
  54.     private ?User $user null;
  55.     #[ORM\Column(typeTypes::DATETIME_MUTABLE)]
  56.     private ?\DateTimeInterface $createAt null;
  57.     public function __construct()
  58.     {
  59.         $this->subscriptionProducts = new ArrayCollection();
  60.     }
  61.     public function getId(): ?int
  62.     {
  63.         return $this->id;
  64.     }
  65.     public function getFirstName(): ?string
  66.     {
  67.         return $this->firstName;
  68.     }
  69.     public function setFirstName(?string $firstName): self
  70.     {
  71.         $this->firstName $firstName;
  72.         return $this;
  73.     }
  74.     public function getLastName(): ?string
  75.     {
  76.         return $this->lastName;
  77.     }
  78.     public function setLastName(?string $lastName): self
  79.     {
  80.         $this->lastName $lastName;
  81.         return $this;
  82.     }
  83.     public function getPlace(): ?string
  84.     {
  85.         return $this->place;
  86.     }
  87.     public function setPlace(?string $place): self
  88.     {
  89.         $this->place $place;
  90.         return $this;
  91.     }
  92.     public function getPostalCode(): ?string
  93.     {
  94.         return $this->postalCode;
  95.     }
  96.     public function setPostalCode(?string $postalCode): self
  97.     {
  98.         $this->postalCode $postalCode;
  99.         return $this;
  100.     }
  101.     public function getCity(): ?string
  102.     {
  103.         return $this->city;
  104.     }
  105.     public function setCity(?string $city): self
  106.     {
  107.         $this->city $city;
  108.         return $this;
  109.     }
  110.     public function getCountry(): ?string
  111.     {
  112.         return $this->country;
  113.     }
  114.     public function setCountry(?string $country): self
  115.     {
  116.         $this->country $country;
  117.         return $this;
  118.     }
  119.     public function getAdditionnal(): ?string
  120.     {
  121.         return $this->additionnal;
  122.     }
  123.     public function setAdditionnal(?string $additionnal): self
  124.     {
  125.         $this->additionnal $additionnal;
  126.         return $this;
  127.     }
  128.     public function getPhone(): ?string
  129.     {
  130.         return $this->phone;
  131.     }
  132.     public function setPhone(?string $phone): self
  133.     {
  134.         $this->phone $phone;
  135.         return $this;
  136.     }
  137.     public function getPaymentType(): ?string
  138.     {
  139.         return $this->payment_type;
  140.     }
  141.     public function setPaymentType(string $payment_type): self
  142.     {
  143.         $this->payment_type $payment_type;
  144.         return $this;
  145.     }
  146.     public function getStatus(): ?string
  147.     {
  148.         return $this->status;
  149.     }
  150.     public function setStatus(?string $status): self
  151.     {
  152.         $this->status $status;
  153.         return $this;
  154.     }
  155.     public function getAmount(): ?float
  156.     {
  157.         return $this->amount;
  158.     }
  159.     public function setAmount(?float $amount): self
  160.     {
  161.         $this->amount $amount;
  162.         return $this;
  163.     }
  164.     public function getCouponCode(): ?string
  165.     {
  166.         return $this->coupon_code;
  167.     }
  168.     public function setCouponCode(?string $coupon_code): self
  169.     {
  170.         $this->coupon_code $coupon_code;
  171.         return $this;
  172.     }
  173.     public function getDiscountAmount(): ?float
  174.     {
  175.         return $this->discount_amount;
  176.     }
  177.     public function setDiscountAmount(?float $discount_amount): self
  178.     {
  179.         $this->discount_amount $discount_amount;
  180.         return $this;
  181.     }
  182.     public function getSubTotal(): ?float
  183.     {
  184.         return $this->sub_total;
  185.     }
  186.     public function setSubTotal(?float $sub_total): self
  187.     {
  188.         $this->sub_total $sub_total;
  189.         return $this;
  190.     }
  191.     public function isIsConfirmed(): ?string
  192.     {
  193.         return $this->is_confirmed;
  194.     }
  195.     public function setIsConfirmed(?string $is_confirmed): self
  196.     {
  197.         $this->is_confirmed $is_confirmed;
  198.         return $this;
  199.     }
  200.     /**
  201.      * @return Collection<int, SubscriptionProduct>
  202.      */
  203.     public function getSubscriptionProducts(): Collection
  204.     {
  205.         return $this->subscriptionProducts;
  206.     }
  207.     public function addSubscriptionProduct(SubscriptionProduct $subscriptionProduct): self
  208.     {
  209.         if (!$this->subscriptionProducts->contains($subscriptionProduct)) {
  210.             $this->subscriptionProducts->add($subscriptionProduct);
  211.             $subscriptionProduct->setSubscription($this);
  212.         }
  213.         return $this;
  214.     }
  215.     public function removeSubscriptionProduct(SubscriptionProduct $subscriptionProduct): self
  216.     {
  217.         if ($this->subscriptionProducts->removeElement($subscriptionProduct)) {
  218.             // set the owning side to null (unless already changed)
  219.             if ($subscriptionProduct->getSubscription() === $this) {
  220.                 $subscriptionProduct->setSubscription(null);
  221.             }
  222.         }
  223.         return $this;
  224.     }
  225.     public function getReference(): ?string
  226.     {
  227.         return $this->reference;
  228.     }
  229.     public function setReference(string $reference): self
  230.     {
  231.         $this->reference $reference;
  232.         return $this;
  233.     }
  234.     public function getUser(): ?User
  235.     {
  236.         return $this->user;
  237.     }
  238.     public function setUser(?User $user): self
  239.     {
  240.         $this->user $user;
  241.         return $this;
  242.     }
  243.     public function getCreateAt(): ?\DateTimeInterface
  244.     {
  245.         return $this->createAt;
  246.     }
  247.     public function setCreateAt(\DateTimeInterface $createAt): self
  248.     {
  249.         $this->createAt $createAt;
  250.         return $this;
  251.     }
  252. }