src/Entity/SerieBillet.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\SerieBilletRepository;
  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. use Doctrine\ORM\Mapping\OneToMany;
  9. #[ORM\Entity(repositoryClassSerieBilletRepository::class)]
  10. class SerieBillet
  11. {
  12.     #[ORM\Id]
  13.     #[ORM\GeneratedValue]
  14.     #[ORM\Column]
  15.     private ?int $id null;
  16.     #[ORM\Column(typeTypes::DATE_MUTABLEnullabletrue)]
  17.     private ?\DateTimeInterface $dateAchat null;
  18.     #[ORM\ManyToOne]
  19.     #[ORM\OrderBy(["nom" => "ASC"])]
  20.     private ?Cour $cour null;
  21.     #[ORM\ManyToOne]
  22.     #[ORM\OrderBy(["nom" => "ASC"])]
  23.     private ?Category $category null;
  24.     #[ORM\Column(type"integer"nullabletrue)]
  25.     private ?int $nbr null;
  26.     #[ORM\Column(length255nullabletrue)]
  27.     private ?string $escalier null;
  28.     #[ORM\Column(length255nullabletrue)]
  29.     private ?string $rang null;
  30.     #[ORM\Column(length255nullabletrue)]
  31.     private ?string $place null;
  32.     #[ORM\ManyToOne(targetEntityAcheteur::class, cascade: ['persist''remove'], inversedBy'serieBillets')]
  33.     #[ORM\OrderBy(["prenom" => "ASC"])]
  34.     private ?Acheteur $acheteur null;
  35.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  36.     private ?string $note null;
  37.     #[ORM\Column(nullabletrue)]
  38.     private ?float $tarif null;
  39.     #[ORM\Column]
  40.     private ?bool $papier null;
  41.     #[ORM\Column(nullabletrue)]
  42.     private ?float $commision null;
  43.     #[ORM\Column(nullabletrue)]
  44.     private ?bool $active null;
  45.     #[ORM\ManyToOne(inversedBy'serieBillets')]
  46.     #[ORM\OrderBy(["nom" => "ASC"])]
  47.     private ?Tribune $tribune null;
  48.     #[ORM\ManyToOne(targetEntitySession::class, inversedBy'serieBillets')]
  49.     private $session;
  50.     #[OneToMany(mappedBy'serieBillet'targetEntityBillet::class, cascade: ['persist''remove'], orphanRemovaltrue)]
  51.     private Collection $billets;
  52.     public function __construct()
  53.     {
  54.         $this->dateAchat = new \DateTime('now');
  55.         $this->billets = new ArrayCollection();
  56.     }
  57.     public function getId(): ?int
  58.     {
  59.         return $this->id;
  60.     }
  61.     public function getDateAchat(): ?\DateTimeInterface
  62.     {
  63.         return $this->dateAchat;
  64.     }
  65.     public function setDateAchat(?\DateTimeInterface $dateAchat): self
  66.     {
  67.         $this->dateAchat $dateAchat;
  68.         return $this;
  69.     }
  70.     public function getCour(): ?Cour
  71.     {
  72.         return $this->cour;
  73.     }
  74.     public function setCour(?Cour $cour): self
  75.     {
  76.         $this->cour $cour;
  77.         return $this;
  78.     }
  79.     public function getCategory(): ?Category
  80.     {
  81.         return $this->category;
  82.     }
  83.     public function setCategory(?Category $category): self
  84.     {
  85.         $this->category $category;
  86.         return $this;
  87.     }
  88.     public function getNbr(): ?int
  89.     {
  90.         return $this->nbr;
  91.     }
  92.     public function setNbr(?int $nbr): self
  93.     {
  94.         $this->nbr $nbr;
  95.         return $this;
  96.     }
  97.     public function getEscalier(): ?string
  98.     {
  99.         return $this->escalier;
  100.     }
  101.     public function setEscalier(?string $escalier): self
  102.     {
  103.         $this->escalier $escalier;
  104.         return $this;
  105.     }
  106.     public function getRang(): ?string
  107.     {
  108.         return $this->rang;
  109.     }
  110.     public function setRang(?string $rang): self
  111.     {
  112.         $this->rang $rang;
  113.         return $this;
  114.     }
  115.     public function getPlace(): ?string
  116.     {
  117.         return $this->place;
  118.     }
  119.     public function setPlace(?string $place): self
  120.     {
  121.         $this->place $place;
  122.         return $this;
  123.     }
  124.     public function getAcheteur(): ?Acheteur
  125.     {
  126.         return $this->acheteur;
  127.     }
  128.     public function setAcheteur(?Acheteur $acheteur): self
  129.     {
  130.         $this->acheteur $acheteur;
  131.         return $this;
  132.     }
  133.     public function getNote(): ?string
  134.     {
  135.         return $this->note;
  136.     }
  137.     public function setNote(?string $note): self
  138.     {
  139.         $this->note $note;
  140.         return $this;
  141.     }
  142.     public function getTarif(): ?float
  143.     {
  144.         return $this->tarif;
  145.     }
  146.     public function setTarif(?float $tarif): self
  147.     {
  148.         $this->tarif $tarif;
  149.         return $this;
  150.     }
  151.     public function isPapier(): ?bool
  152.     {
  153.         return $this->papier;
  154.     }
  155.     public function setPapier(bool $papier): self
  156.     {
  157.         $this->papier $papier;
  158.         return $this;
  159.     }
  160.     public function getCommision(): ?float
  161.     {
  162.         return $this->commision;
  163.     }
  164.     public function setCommision(?float $commision): self
  165.     {
  166.         $this->commision $commision;
  167.         return $this;
  168.     }
  169.     public function isActive(): ?bool
  170.     {
  171.         return $this->active;
  172.     }
  173.     public function setActive(?bool $active): self
  174.     {
  175.         $this->active $active;
  176.         return $this;
  177.     }
  178.     public function getTribune(): ?Tribune
  179.     {
  180.         return $this->tribune;
  181.     }
  182.     public function setTribune(?Tribune $tribune): self
  183.     {
  184.         $this->tribune $tribune;
  185.         return $this;
  186.     }
  187.     public function getSession(): ?Session
  188.     {
  189.         return $this->session;
  190.     }
  191.     public function setSession(?Session $session): self
  192.     {
  193.         $this->session $session;
  194.         return $this;
  195.     }
  196.     public function __toString(): string
  197.     {
  198.         $acheteurName $this->acheteur $this->acheteur->getNom().' '.$this->acheteur->getPrenom() : '';
  199.         $sessionDesc $this->session $this->session->getDescription() : '';
  200.         return $acheteurName' - '.$sessionDesc;
  201.     }
  202.     /**
  203.      * @return Collection<int, Billet>
  204.      */
  205.     public function getBillets(): Collection
  206.     {
  207.         return $this->billets;
  208.     }
  209.     public function addBillet(Billet $billet): self
  210.     {
  211.         if (!$this->billets->contains($billet)) {
  212.             $this->billets->add($billet);
  213.             $billet->setSerieBillet($this);
  214.         }
  215.         return $this;
  216.     }
  217.     public function removeBillet(Billet $billet): self
  218.     {
  219.         if ($this->billets->removeElement($billet)) {
  220.             // set the owning side to null (unless already changed)
  221.             if ($billet->getSerieBillet() === $this) {
  222.                 $billet->setSerieBillet(null);
  223.             }
  224.         }
  225.         return $this;
  226.     }
  227.     public function getLocalizedDate(): string
  228.     {
  229.         setlocale(LC_ALL'fr_FR.utf8');
  230.         return strftime('%A %d %B %Y', ($this->dateAchat) ? $this->dateAchat->getTimestamp() : time());
  231.     }
  232.     public function getEscalierNumber(): ?int
  233.     {
  234.         return (is_null($this->getEscalier())) ? null intval(substr($this->getEscalier(), 23));
  235.     }
  236.     public function getRangNumber(): ?int
  237.     {
  238.         return (is_null($this->getRang())) ? null intval(substr($this->getRang(), 23));
  239.     }
  240.     public function getPlaceNumber(): ?int
  241.     {
  242.         return (is_null($this->getPlace())) ? null intval(substr($this->getPlace(), 23));
  243.     }
  244. }