src/Entity/Spectateur.php line 10

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\SpectateurRepository;
  4. use Doctrine\DBAL\Types\Types;
  5. use Doctrine\ORM\Mapping as ORM;
  6. #[ORM\Entity(repositoryClassSpectateurRepository::class)]
  7. class Spectateur
  8. {
  9.     #[ORM\Id]
  10.     #[ORM\GeneratedValue]
  11.     #[ORM\Column]
  12.     private ?int $id null;
  13.     #[ORM\ManyToOne]
  14.     private ?Events $event null;
  15.     #[ORM\Column(length255)]
  16.     private ?string $nom null;
  17.     #[ORM\Column(nullabletrue)]
  18.     private ?bool $isActive null;
  19.     #[ORM\Column(typeTypes::DATE_MUTABLEnullabletrue)]
  20.     private ?\DateTimeInterface $date null;
  21.     #[ORM\ManyToOne(inversedBy'spectateurs')]
  22.     private ?Commande $commande null;
  23.     #[ORM\OneToOne(mappedBy"spectateur"targetEntityAttribution::class, orphanRemovaltrue)]
  24.     private $attribution;
  25.     public function __construct()
  26.     {
  27.         $this->date = new \DateTime();
  28.     }
  29.     public function getId(): ?int
  30.     {
  31.         return $this->id;
  32.     }
  33.     public function getEvent(): ?Events
  34.     {
  35.         return $this->event;
  36.     }
  37.     public function setEvent(?Events $event): self
  38.     {
  39.         $this->event $event;
  40.         return $this;
  41.     }
  42.     public function getNom(): ?string
  43.     {
  44.         return $this->nom;
  45.     }
  46.     public function setNom(string $nom): self
  47.     {
  48.         $this->nom $nom;
  49.         return $this;
  50.     }
  51.     public function isIsActive(): ?bool
  52.     {
  53.         return $this->isActive;
  54.     }
  55.     public function setIsActive(?bool $isActive): self
  56.     {
  57.         $this->isActive $isActive;
  58.         return $this;
  59.     }
  60.     public function getDate(): ?\DateTimeInterface
  61.     {
  62.         return ($this->date) ? $this->date : new \DateTime();
  63.     }
  64.     public function setDate(?\DateTimeInterface $date): self
  65.     {
  66.         $this->date $date;
  67.         return $this;
  68.     }
  69.     public function getCommande(): ?Commande
  70.     {
  71.         return $this->commande;
  72.     }
  73.     public function setCommande(?Commande $commande): self
  74.     {
  75.         $this->commande $commande;
  76.         return $this;
  77.     }
  78.     public function getLocalizedDate(): string
  79.     {
  80.         setlocale(LC_ALL'fr_FR.utf8');
  81.         return strftime('%A %d %B %Y'$this->getDate()->getTimestamp());
  82.     }
  83.     public function __toString(): string
  84.     {
  85.         // TODO: Implement __toString() method.
  86.         return $this->getNom();
  87.     }
  88.     public function getAttribution(): ?Attribution
  89.     {
  90.         return $this->attribution;
  91.     }
  92.     public function setAttribution(Attribution $attribution): self
  93.     {
  94.         $this->attribution $attribution;
  95.         // set the owning side of the relation if necessary
  96.         if ($attribution->getSpectateur() !== $this) {
  97.             $attribution->setSpectateur($this);
  98.         }
  99.         return $this;
  100.     }
  101.     public function __clone(): void
  102.     {
  103.         if ($this->id) {
  104.             $this->id null;
  105.             $this->event null;
  106.             $this->attribution null;
  107.         }
  108.     }
  109. }