src/Entity/Order.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\OrderRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Gedmo\Mapping\Annotation as Gedmo;
  8. /**
  9.  * @ORM\Entity(repositoryClass=OrderRepository::class)
  10.  * @ORM\Table(name="`order`")
  11.  */
  12. class Order
  13. {
  14.     /**
  15.      * @ORM\Id
  16.      * @ORM\GeneratedValue
  17.      * @ORM\Column(type="integer")
  18.      */
  19.     private $id;
  20.     
  21.     /**
  22.      * @ORM\Column(type="datetime")
  23.      */
  24.     private $start;
  25.     /**
  26.      * @ORM\Column(type="datetime")
  27.      */
  28.     private $end;
  29.     
  30.     /**
  31.      * @ORM\Column(type="datetime")
  32.      */
  33.     private $test_end;
  34.     /**
  35.      * @ORM\Column(type="string", length=255, nullable=true)
  36.      */
  37.     private $comment;
  38.     /**
  39.      * @ORM\Column(type="float")
  40.      */
  41.     private $price;
  42.     /**
  43.      * @ORM\Column(type="float", nullable=true)
  44.      */
  45.     private $agent_price;
  46.     /**
  47.      * @ORM\Column(type="string", nullable=true)
  48.      */
  49.     private $statut null;
  50.     
  51.     /**
  52.      * @ORM\Column(type="boolean")
  53.      */
  54.     private $payement;
  55.     /**
  56.      * @ORM\ManyToOne(targetEntity=User::class, inversedBy="orders")
  57.      *  @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=true)
  58.      */
  59.     private $user;
  60.     /**
  61.      * @ORM\ManyToOne(targetEntity=Period::class, inversedBy="orders")
  62.      */
  63.     private $period;
  64.     /**
  65.      * @ORM\ManyToOne(targetEntity=Discount::class, inversedBy="orders")
  66.      */
  67.     private $discount;
  68.     /**
  69.      * @ORM\Column(type="string", length=255, nullable=true)
  70.      */
  71.     private $token;
  72.     /**
  73.      * @ORM\ManyToMany(targetEntity=Accessory::class, inversedBy="orders", cascade={"all"}, fetch="EAGER")
  74.      */
  75.     private $accessory;
  76.     /**
  77.      * @ORM\ManyToOne(targetEntity=Agency::class, inversedBy="orders")
  78.      */
  79.     private $agency;
  80.     /**
  81.      * @ORM\ManyToOne(targetEntity=Participant::class, inversedBy="orders")
  82.      */
  83.     private $responsible;
  84.     /**
  85.      * @ORM\ManyToOne(targetEntity=Event::class, inversedBy="orders")
  86.      * @ORM\JoinColumn(name="event_id", referencedColumnName="id", nullable=true)
  87.      */
  88.     private $event;
  89.     /**
  90.      * @ORM\OneToMany(targetEntity=OrderParticipantBike::class, mappedBy="book")
  91.      */
  92.     private $orderParticipantBikes;
  93.     
  94.     /**
  95.      * @ORM\ManyToOne(targetEntity=Circuit::class, inversedBy="orders")
  96.      * @ORM\JoinColumn(name="circuit_id", referencedColumnName="id", nullable=true)
  97.      */
  98.     private $circuit;
  99.     /**
  100.      * @ORM\ManyToOne(targetEntity=Dealer::class, inversedBy="orders")
  101.      */
  102.     private $dealer;
  103.     /**
  104.      * @ORM\OneToMany(targetEntity=History::class, mappedBy="book", cascade={"remove"})
  105.      */
  106.     private $histories;
  107.     /**
  108.      * @ORM\Column(type="datetime_immutable")
  109.      * @Gedmo\Timestampable(on="create")
  110.      */
  111.     private $created_at;
  112.     /**
  113.      * @ORM\Column(type="datetime_immutable")
  114.      * @Gedmo\Timestampable(on="update")
  115.      */
  116.     private $updated_at;
  117.     /**
  118.      * @ORM\OneToMany(targetEntity=OrderCircuit::class, mappedBy="book")
  119.      */
  120.     private $orderCircuits;
  121.     public function __construct()
  122.     {
  123.         $this->accessory = new ArrayCollection();
  124.         $this->orderParticipantBikes = new ArrayCollection();
  125.         $this->histories = new ArrayCollection();
  126.         $this->orderCircuits = new ArrayCollection();
  127.     }
  128.     public function getId(): ?int
  129.     {
  130.         return $this->id;
  131.     }
  132.     public function getPeriod(): ?Period
  133.     {
  134.         return $this->period;
  135.     }
  136.     public function setPeriod(?Period $period): self
  137.     {
  138.         $this->period $period;
  139.         return $this;
  140.     }
  141.     public function getStart(): ?\DateTimeInterface
  142.     {
  143.         return $this->start;
  144.     }
  145.     public function setStart(\DateTimeInterface $start): self
  146.     {
  147.         $this->start $start;
  148.         return $this;
  149.     }
  150.     public function getEnd(): ?\DateTimeInterface
  151.     {
  152.         return $this->end;
  153.     }
  154.     public function setEnd(\DateTimeInterface $end): self
  155.     {
  156.         $this->end $end;
  157.         return $this;
  158.     }
  159.     
  160.     public function getTestEnd(): ?\DateTimeInterface
  161.     {
  162.         return $this->test_end;
  163.     }
  164.     public function setTestEnd(\DateTimeInterface $test_end): self
  165.     {
  166.         $this->test_end $test_end;
  167.         return $this;
  168.     }
  169.     public function getComment(): ?string
  170.     {
  171.         return $this->comment;
  172.     }
  173.     public function setComment(string $comment): self
  174.     {
  175.         $this->comment $comment;
  176.         return $this;
  177.     }
  178.     public function getPrice(): ?float
  179.     {
  180.         return $this->price;
  181.     }
  182.     public function setPrice(float $price): self
  183.     {
  184.         $this->price $price;
  185.         return $this;
  186.     }
  187.     public function getAgentPrice(): ?float
  188.     {
  189.         return $this->agent_price;
  190.     }
  191.     public function setAgentPrice(float $agent_price): self
  192.     {
  193.         $this->agent_price $agent_price;
  194.         return $this;
  195.     }
  196.     public function getStatut(): ?string
  197.     {
  198.         return $this->statut;
  199.     }
  200.     public function setStatut(string $statut): self
  201.     {
  202.         $this->statut $statut;
  203.         return $this;
  204.     }
  205.     public function isPayement(): ?bool
  206.     {
  207.         return $this->payement;
  208.     }
  209.     public function setPayement(bool $payement): self
  210.     {
  211.         $this->payement $payement;
  212.         return $this;
  213.     }
  214.     public function getUser(): ?User
  215.     {
  216.         return $this->user;
  217.     }
  218.     public function setUser(?User $user): self
  219.     {
  220.         $this->user $user;
  221.         return $this;
  222.     }
  223.     
  224.     public function getDiscount(): ?Discount
  225.     {
  226.         return $this->discount;
  227.     }
  228.     public function setDiscount(?Discount $discount): self
  229.     {
  230.         $this->discount $discount;
  231.         return $this;
  232.     }
  233.     public function getToken(): ?string
  234.     {
  235.         return $this->token;
  236.     }
  237.     public function setToken(string $token): self
  238.     {
  239.         $this->token $token;
  240.         return $this;
  241.     }
  242.     /**
  243.      * @return Collection<int, Accessory>
  244.      */
  245.     public function getAccessory(): Collection
  246.     {
  247.         return $this->accessory;
  248.     }
  249.     public function addAccessory(Accessory $accessory): self
  250.     {
  251.         if (!$this->accessory->contains($accessory)) {
  252.             $this->accessory[] = $accessory;
  253.         }
  254.         return $this;
  255.     }
  256.     public function removeAccessory(Accessory $accessory): self
  257.     {
  258.         $this->accessory->removeElement($accessory);
  259.         return $this;
  260.     }
  261.     public function getAgency(): ?Agency
  262.     {
  263.         return $this->agency;
  264.     }
  265.     public function setAgency(?Agency $agency): self
  266.     {
  267.         $this->agency $agency;
  268.         return $this;
  269.     }
  270.     
  271.     public function getResponsible(): ?Participant
  272.     {
  273.         return $this->responsible;
  274.     }
  275.     public function setResponsible(?Participant $responsible): self
  276.     {
  277.         $this->responsible $responsible;
  278.         return $this;
  279.     }
  280.     public function getEvent(): ?Event
  281.     {
  282.         return $this->event;
  283.     }
  284.     public function setEvent(?Event $event): self
  285.     {
  286.         $this->event $event;
  287.         return $this;
  288.     }
  289.     /**
  290.      * @return Collection<int, OrderParticipantBike>
  291.      */
  292.     public function getOrderParticipantBikes(): Collection
  293.     {
  294.         return $this->orderParticipantBikes;
  295.     }
  296.     public function addOrderParticipantBike(OrderParticipantBike $orderParticipantBike): self
  297.     {
  298.         if (!$this->orderParticipantBikes->contains($orderParticipantBike)) {
  299.             $this->orderParticipantBikes[] = $orderParticipantBike;
  300.             $orderParticipantBike->setBook($this);
  301.         }
  302.         return $this;
  303.     }
  304.     public function removeOrderParticipantBike(OrderParticipantBike $orderParticipantBike): self
  305.     {
  306.         if ($this->orderParticipantBikes->removeElement($orderParticipantBike)) {
  307.             // set the owning side to null (unless already changed)
  308.             if ($orderParticipantBike->getBook() === $this) {
  309.                 $orderParticipantBike->setBook(null);
  310.             }
  311.         }
  312.         return $this;
  313.     }
  314.     
  315.     public function getCircuit(): ?Circuit
  316.     {
  317.         return $this->circuit;
  318.     }
  319.     public function setCircuit(?Circuit $circuit): self
  320.     {
  321.         $this->circuit $circuit;
  322.         return $this;
  323.     }
  324.     public function getDealer(): ?Dealer
  325.     {
  326.         return $this->dealer;
  327.     }
  328.     public function setDealer(?Dealer $dealer): self
  329.     {
  330.         $this->dealer $dealer;
  331.         return $this;
  332.     }
  333.     /**
  334.      * @return Collection<int, History>
  335.      */
  336.     public function getHistories(): Collection
  337.     {
  338.         return $this->histories;
  339.     }
  340.     public function addHistory(History $history): self
  341.     {
  342.         if (!$this->histories->contains($history)) {
  343.             $this->histories[] = $history;
  344.             $history->setBook($this);
  345.         }
  346.         return $this;
  347.     }
  348.     public function removeHistory(History $history): self
  349.     {
  350.         if ($this->histories->removeElement($history)) {
  351.             // set the owning side to null (unless already changed)
  352.             if ($history->getBook() === $this) {
  353.                 $history->setBook(null);
  354.             }
  355.         }
  356.         return $this;
  357.     }
  358.     public function getCreatedAt(): ?\DateTimeImmutable
  359.     {
  360.         return $this->created_at;
  361.     }
  362.     public function setCreatedAt(\DateTimeImmutable $created_at): self
  363.     {
  364.         $this->created_at $created_at;
  365.         return $this;
  366.     }
  367.     public function getUpdatedAt(): ?\DateTimeImmutable
  368.     {
  369.         return $this->updated_at;
  370.     }
  371.     public function setUpdatedAt(\DateTimeImmutable $updated_at): self
  372.     {
  373.         $this->updated_at $updated_at;
  374.         return $this;
  375.     }
  376.     /**
  377.      * @return Collection<int, OrderCircuit>
  378.      */
  379.     public function getOrderCircuits(): Collection
  380.     {
  381.         return $this->orderCircuits;
  382.     }
  383.     public function addOrderCircuit(OrderCircuit $orderCircuit): self
  384.     {
  385.         if (!$this->orderCircuits->contains($orderCircuit)) {
  386.             $this->orderCircuits[] = $orderCircuit;
  387.             $orderCircuit->setBook($this);
  388.         }
  389.         return $this;
  390.     }
  391.     public function removeOrderCircuit(OrderCircuit $orderCircuit): self
  392.     {
  393.         if ($this->orderCircuits->removeElement($orderCircuit)) {
  394.             // set the owning side to null (unless already changed)
  395.             if ($orderCircuit->getBook() === $this) {
  396.                 $orderCircuit->setBook(null);
  397.             }
  398.         }
  399.         return $this;
  400.     }
  401. }