<?php
namespace App\Entity;
use App\Repository\OrderRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
/**
* @ORM\Entity(repositoryClass=OrderRepository::class)
* @ORM\Table(name="`order`")
*/
class Order
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="datetime")
*/
private $start;
/**
* @ORM\Column(type="datetime")
*/
private $end;
/**
* @ORM\Column(type="datetime")
*/
private $test_end;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $comment;
/**
* @ORM\Column(type="float")
*/
private $price;
/**
* @ORM\Column(type="float", nullable=true)
*/
private $agent_price;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $statut = null;
/**
* @ORM\Column(type="boolean")
*/
private $payement;
/**
* @ORM\ManyToOne(targetEntity=User::class, inversedBy="orders")
* @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=true)
*/
private $user;
/**
* @ORM\ManyToOne(targetEntity=Period::class, inversedBy="orders")
*/
private $period;
/**
* @ORM\ManyToOne(targetEntity=Discount::class, inversedBy="orders")
*/
private $discount;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $token;
/**
* @ORM\ManyToMany(targetEntity=Accessory::class, inversedBy="orders", cascade={"all"}, fetch="EAGER")
*/
private $accessory;
/**
* @ORM\ManyToOne(targetEntity=Agency::class, inversedBy="orders")
*/
private $agency;
/**
* @ORM\ManyToOne(targetEntity=Participant::class, inversedBy="orders")
*/
private $responsible;
/**
* @ORM\ManyToOne(targetEntity=Event::class, inversedBy="orders")
* @ORM\JoinColumn(name="event_id", referencedColumnName="id", nullable=true)
*/
private $event;
/**
* @ORM\OneToMany(targetEntity=OrderParticipantBike::class, mappedBy="book")
*/
private $orderParticipantBikes;
/**
* @ORM\ManyToOne(targetEntity=Circuit::class, inversedBy="orders")
* @ORM\JoinColumn(name="circuit_id", referencedColumnName="id", nullable=true)
*/
private $circuit;
/**
* @ORM\ManyToOne(targetEntity=Dealer::class, inversedBy="orders")
*/
private $dealer;
/**
* @ORM\OneToMany(targetEntity=History::class, mappedBy="book", cascade={"remove"})
*/
private $histories;
/**
* @ORM\Column(type="datetime_immutable")
* @Gedmo\Timestampable(on="create")
*/
private $created_at;
/**
* @ORM\Column(type="datetime_immutable")
* @Gedmo\Timestampable(on="update")
*/
private $updated_at;
/**
* @ORM\OneToMany(targetEntity=OrderCircuit::class, mappedBy="book")
*/
private $orderCircuits;
public function __construct()
{
$this->accessory = new ArrayCollection();
$this->orderParticipantBikes = new ArrayCollection();
$this->histories = new ArrayCollection();
$this->orderCircuits = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getPeriod(): ?Period
{
return $this->period;
}
public function setPeriod(?Period $period): self
{
$this->period = $period;
return $this;
}
public function getStart(): ?\DateTimeInterface
{
return $this->start;
}
public function setStart(\DateTimeInterface $start): self
{
$this->start = $start;
return $this;
}
public function getEnd(): ?\DateTimeInterface
{
return $this->end;
}
public function setEnd(\DateTimeInterface $end): self
{
$this->end = $end;
return $this;
}
public function getTestEnd(): ?\DateTimeInterface
{
return $this->test_end;
}
public function setTestEnd(\DateTimeInterface $test_end): self
{
$this->test_end = $test_end;
return $this;
}
public function getComment(): ?string
{
return $this->comment;
}
public function setComment(string $comment): self
{
$this->comment = $comment;
return $this;
}
public function getPrice(): ?float
{
return $this->price;
}
public function setPrice(float $price): self
{
$this->price = $price;
return $this;
}
public function getAgentPrice(): ?float
{
return $this->agent_price;
}
public function setAgentPrice(float $agent_price): self
{
$this->agent_price = $agent_price;
return $this;
}
public function getStatut(): ?string
{
return $this->statut;
}
public function setStatut(string $statut): self
{
$this->statut = $statut;
return $this;
}
public function isPayement(): ?bool
{
return $this->payement;
}
public function setPayement(bool $payement): self
{
$this->payement = $payement;
return $this;
}
public function getUser(): ?User
{
return $this->user;
}
public function setUser(?User $user): self
{
$this->user = $user;
return $this;
}
public function getDiscount(): ?Discount
{
return $this->discount;
}
public function setDiscount(?Discount $discount): self
{
$this->discount = $discount;
return $this;
}
public function getToken(): ?string
{
return $this->token;
}
public function setToken(string $token): self
{
$this->token = $token;
return $this;
}
/**
* @return Collection<int, Accessory>
*/
public function getAccessory(): Collection
{
return $this->accessory;
}
public function addAccessory(Accessory $accessory): self
{
if (!$this->accessory->contains($accessory)) {
$this->accessory[] = $accessory;
}
return $this;
}
public function removeAccessory(Accessory $accessory): self
{
$this->accessory->removeElement($accessory);
return $this;
}
public function getAgency(): ?Agency
{
return $this->agency;
}
public function setAgency(?Agency $agency): self
{
$this->agency = $agency;
return $this;
}
public function getResponsible(): ?Participant
{
return $this->responsible;
}
public function setResponsible(?Participant $responsible): self
{
$this->responsible = $responsible;
return $this;
}
public function getEvent(): ?Event
{
return $this->event;
}
public function setEvent(?Event $event): self
{
$this->event = $event;
return $this;
}
/**
* @return Collection<int, OrderParticipantBike>
*/
public function getOrderParticipantBikes(): Collection
{
return $this->orderParticipantBikes;
}
public function addOrderParticipantBike(OrderParticipantBike $orderParticipantBike): self
{
if (!$this->orderParticipantBikes->contains($orderParticipantBike)) {
$this->orderParticipantBikes[] = $orderParticipantBike;
$orderParticipantBike->setBook($this);
}
return $this;
}
public function removeOrderParticipantBike(OrderParticipantBike $orderParticipantBike): self
{
if ($this->orderParticipantBikes->removeElement($orderParticipantBike)) {
// set the owning side to null (unless already changed)
if ($orderParticipantBike->getBook() === $this) {
$orderParticipantBike->setBook(null);
}
}
return $this;
}
public function getCircuit(): ?Circuit
{
return $this->circuit;
}
public function setCircuit(?Circuit $circuit): self
{
$this->circuit = $circuit;
return $this;
}
public function getDealer(): ?Dealer
{
return $this->dealer;
}
public function setDealer(?Dealer $dealer): self
{
$this->dealer = $dealer;
return $this;
}
/**
* @return Collection<int, History>
*/
public function getHistories(): Collection
{
return $this->histories;
}
public function addHistory(History $history): self
{
if (!$this->histories->contains($history)) {
$this->histories[] = $history;
$history->setBook($this);
}
return $this;
}
public function removeHistory(History $history): self
{
if ($this->histories->removeElement($history)) {
// set the owning side to null (unless already changed)
if ($history->getBook() === $this) {
$history->setBook(null);
}
}
return $this;
}
public function getCreatedAt(): ?\DateTimeImmutable
{
return $this->created_at;
}
public function setCreatedAt(\DateTimeImmutable $created_at): self
{
$this->created_at = $created_at;
return $this;
}
public function getUpdatedAt(): ?\DateTimeImmutable
{
return $this->updated_at;
}
public function setUpdatedAt(\DateTimeImmutable $updated_at): self
{
$this->updated_at = $updated_at;
return $this;
}
/**
* @return Collection<int, OrderCircuit>
*/
public function getOrderCircuits(): Collection
{
return $this->orderCircuits;
}
public function addOrderCircuit(OrderCircuit $orderCircuit): self
{
if (!$this->orderCircuits->contains($orderCircuit)) {
$this->orderCircuits[] = $orderCircuit;
$orderCircuit->setBook($this);
}
return $this;
}
public function removeOrderCircuit(OrderCircuit $orderCircuit): self
{
if ($this->orderCircuits->removeElement($orderCircuit)) {
// set the owning side to null (unless already changed)
if ($orderCircuit->getBook() === $this) {
$orderCircuit->setBook(null);
}
}
return $this;
}
}