src/Entity/Billet.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\BilletRepository;
  4. use Symfony\Component\HttpFoundation\File\File;
  5. use Symfony\Component\Validator\Constraints as Assert;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. #[ORM\Entity(repositoryClassBilletRepository::class)]
  9. class Billet
  10. {
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue]
  13.     #[ORM\Column]
  14.     private ?int $id null;
  15.     #[ORM\Column(typeTypes::DATE_MUTABLEnullabletrue)]
  16.     private ?\DateTimeInterface $dateAchat null;
  17.     #[ORM\ManyToOne]
  18.     #[ORM\OrderBy(["nom" => "ASC"])]
  19.     private ?Cour $cour null;
  20.     #[ORM\ManyToOne(targetEntitySerieBillet::class, cascade: ['persist'], inversedBy'billets')]
  21.     private ?SerieBillet $serieBillet null;
  22.     #[ORM\ManyToOne]
  23.     #[ORM\OrderBy(["nom" => "ASC"])]
  24.     private ?Category $category null;
  25.     #[ORM\Column(type"integer"nullabletrue)]
  26.     private ?int $nbr null;
  27.     #[ORM\Column(length255nullabletrue)]
  28.     private ?string $escalier null;
  29.     #[ORM\Column(length255nullabletrue)]
  30.     private ?string $rang null;
  31.     #[ORM\Column(length255nullabletrue)]
  32.     private ?string $place null;
  33.     #[ORM\ManyToOne(targetEntityAcheteur::class)]
  34.     #[ORM\OrderBy(["prenom" => "ASC"])]
  35.     private ?Acheteur $acheteur null;
  36.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  37.     private ?string $note null;
  38.     #[ORM\Column(nullabletrue)]
  39.     private ?float $tarif null;
  40.     #[ORM\Column]
  41.     private ?bool $papier null;
  42.     #[ORM\Column(nullabletrue)]
  43.     private ?float $commision null;
  44.     #[ORM\Column(nullabletrue)]
  45.     private ?bool $active null;
  46.     #[ORM\ManyToOne(targetEntityTribune::class)]
  47.     #[ORM\OrderBy(["nom" => "ASC"])]
  48.     private ?Tribune $tribune null;
  49.     #[ORM\ManyToOne(targetEntitySession::class)]
  50.     #[ORM\OrderBy(["codeSession" => "ASC"])]
  51.     private ?Session $session null;
  52.     #[ORM\OneToOne(mappedBy"billet"targetEntityAttribution::class, cascade: ['remove'])]
  53.     private $attribution;
  54.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  55.     private ?string $noteBillet null;
  56.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  57.     private ?string $noteSerieBillet null;
  58.     #[ORM\Column(length255nullabletrue)]
  59.     private ?string $file null;
  60.     #[Assert\File(maxSize"6000000")]
  61.     private ?File $fileUpload null;
  62.     public function __construct()
  63.     {
  64.         $this->dateAchat = new \DateTime('now');
  65.     }
  66.     public function getId(): ?int
  67.     {
  68.         return $this->id;
  69.     }
  70.     public function getDateAchat(): ?\DateTimeInterface
  71.     {
  72.         return $this->dateAchat;
  73.     }
  74.     public function setDateAchat(?\DateTimeInterface $dateAchat): self
  75.     {
  76.         $this->dateAchat $dateAchat;
  77.         return $this;
  78.     }
  79.     public function getCour(): ?Cour
  80.     {
  81.         return $this->cour;
  82.     }
  83.     public function setCour(?Cour $cour): self
  84.     {
  85.         $this->cour $cour;
  86.         return $this;
  87.     }
  88.     public function getCategory(): ?Category
  89.     {
  90.         return $this->category;
  91.     }
  92.     public function setCategory(?Category $category): self
  93.     {
  94.         $this->category $category;
  95.         return $this;
  96.     }
  97.     public function getNbr(): ?int
  98.     {
  99.         return $this->nbr;
  100.     }
  101.     public function setNbr(?int $nbr): self
  102.     {
  103.         $this->nbr $nbr;
  104.         return $this;
  105.     }
  106.     public function getEscalier(): ?string
  107.     {
  108.         return $this->escalier;
  109.     }
  110.     public function setEscalier(?string $escalier): self
  111.     {
  112.         $this->escalier $escalier;
  113.         return $this;
  114.     }
  115.     public function getRang(): ?string
  116.     {
  117.         return $this->rang;
  118.     }
  119.     public function setRang(?string $rang): self
  120.     {
  121.         $this->rang $rang;
  122.         return $this;
  123.     }
  124.     public function getPlace(): ?string
  125.     {
  126.         return $this->place;
  127.     }
  128.     public function setPlace(?string $place): self
  129.     {
  130.         $this->place $place;
  131.         return $this;
  132.     }
  133.     public function getAcheteur(): ?Acheteur
  134.     {
  135.         return $this->acheteur;
  136.     }
  137.     public function setAcheteur(?Acheteur $acheteur): self
  138.     {
  139.         $this->acheteur $acheteur;
  140.         return $this;
  141.     }
  142.     public function getSerieBillet(): ?SerieBillet
  143.     {
  144.         return $this->serieBillet;
  145.     }
  146.     public function setSerieBillet(?SerieBillet $serieBillet): self
  147.     {
  148.         $this->serieBillet $serieBillet;
  149.         return $this;
  150.     }
  151.     public function getNote(): ?string
  152.     {
  153.         return $this->note;
  154.     }
  155.     public function setNote(?string $note): self
  156.     {
  157.         $this->note $note;
  158.         return $this;
  159.     }
  160.     public function getTarif(): ?float
  161.     {
  162.         return $this->tarif;
  163.     }
  164.     public function setTarif(?float $tarif): self
  165.     {
  166.         $this->tarif $tarif;
  167.         return $this;
  168.     }
  169.     public function isPapier(): ?bool
  170.     {
  171.         return $this->papier;
  172.     }
  173.     public function setPapier(bool $papier): self
  174.     {
  175.         $this->papier $papier;
  176.         return $this;
  177.     }
  178.     public function getCommision(): ?float
  179.     {
  180.         return $this->commision;
  181.     }
  182.     public function setCommision(?float $commision): self
  183.     {
  184.         $this->commision $commision;
  185.         return $this;
  186.     }
  187.     public function isActive(): ?bool
  188.     {
  189.         return $this->getSerieBillet()->isActive();
  190.     }
  191.     public function setActive(?bool $active): self
  192.     {
  193.         $this->active $active;
  194.         return $this;
  195.     }
  196.     public function getTribune(): ?Tribune
  197.     {
  198.         return $this->tribune;
  199.     }
  200.     public function setTribune(?Tribune $tribune): self
  201.     {
  202.         $this->tribune $tribune;
  203.         return $this;
  204.     }
  205.     public function getSession(): ?Session
  206.     {
  207.         return $this->session;
  208.     }
  209.     public function setSession(?Session $session): self
  210.     {
  211.         $this->session $session;
  212.         return $this;
  213.     }
  214.     public function __toString(): string
  215.     {
  216.         // TODO: Implement __toString() method.
  217.         return $this->acheteur->getNom().' '.$this->acheteur->getPrenom(). ' - '.$this->session->getDescription();
  218.     }
  219.     public function getAttribution(): ?Attribution
  220.     {
  221.         return $this->attribution;
  222.     }
  223.     public function setAttribution(Attribution $attribution): self
  224.     {
  225.         $this->attribution $attribution;
  226.         // set the owning side of the relation if necessary
  227.         if ($attribution->getBillet() !== $this) {
  228.             $attribution->setBillet($this);
  229.         }
  230.         return $this;
  231.     }
  232.     public function getNoteBillet(): ?string
  233.     {
  234.         return $this->noteBillet;
  235.     }
  236.     public function setNoteBillet(?string $noteBillet): self
  237.     {
  238.         $this->noteBillet $noteBillet;
  239.         return $this;
  240.     }
  241.     public function getNoteSerieBillet(): ?string
  242.     {
  243.         return $this->noteSerieBillet;
  244.     }
  245.     public function setNoteSerieBillet(?string $noteSerieBillet): self
  246.     {
  247.         $this->noteSerieBillet $noteSerieBillet;
  248.         return $this;
  249.     }
  250.     public function getFile(): ?string
  251.     {
  252.         return $this->file;
  253.     }
  254.     public function setFile(?string $file): self
  255.     {
  256.         $this->file $file;
  257.         return $this;
  258.     }
  259.     public function getFileUpload(): ?File
  260.     {
  261.         return $this->fileUpload;
  262.     }
  263.     public function setFileUpload(?File $fileUpload): self
  264.     {
  265.         $this->fileUpload $fileUpload;
  266.         return $this;
  267.     }
  268.     public function getLocalizedDate(): string
  269.     {
  270.         setlocale(LC_ALL'fr_FR.utf8');
  271.         return strftime('%A %d %B %Y', ($this->dateAchat) ? $this->dateAchat->getTimestamp() : time());
  272.     }
  273.     public function getClient(): ?string
  274.     {
  275.         if(!is_null($this->attribution)) return $this->attribution->getCommande()->getClient()->getFullName();
  276.         return '';
  277.     }
  278.     public function getSpectateur(): ?string
  279.     {
  280.         if(!is_null($this->attribution)) return $this->attribution->getSpectateur()->getNom();
  281.         return '';
  282.     }
  283.     public function getStatut(): ?string
  284.     {
  285.         if(!is_null($this->attribution)) return $this->attribution->getStatut();
  286.         return Commande::COMMANDE_STATUS_SAISIE;
  287.     }
  288.     public function getNoteSerie(): ?string
  289.     {
  290.         return $this->getSerieBillet()->getNote();
  291.     }
  292. }