src/Entity/Stade.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. /**
  7.  * @ORM\Entity(repositoryClass="App\Repository\StadeRepository")
  8.  */
  9. class Stade
  10. {
  11.     /**
  12.      * @ORM\Id()
  13.      * @ORM\GeneratedValue()
  14.      * @ORM\Column(type="integer")
  15.      */
  16.     private $id;
  17.     /**
  18.      * @ORM\Column(type="string", length=255)
  19.      */
  20.     private $name;
  21.     /**
  22.      * @ORM\Column(type="text", nullable=true)
  23.      */
  24.     private $description;
  25.     /**
  26.      * @ORM\Column(type="datetime")
  27.      */
  28.     private $createdAt;
  29.     /**
  30.      * @ORM\OneToMany(targetEntity="App\Entity\SousJacent", mappedBy="statde")
  31.      */
  32.     private $sousJacents;
  33.     public function __construct(){
  34.         $this->createdAt = new \DateTime('now');
  35.         $this->sousJacents = new ArrayCollection();
  36.     }
  37.     public function __toString(){
  38.         return $this->name;
  39.     }
  40.     public function getId(): ?int
  41.     {
  42.         return $this->id;
  43.     }
  44.     public function getName(): ?string
  45.     {
  46.         return $this->name;
  47.     }
  48.     public function setName(string $name): self
  49.     {
  50.         $this->name $name;
  51.         return $this;
  52.     }
  53.     public function getDescription(): ?string
  54.     {
  55.         return $this->description;
  56.     }
  57.     public function setDescription(?string $description): self
  58.     {
  59.         $this->description $description;
  60.         return $this;
  61.     }
  62.     public function getCreatedAt(): ?\DateTimeInterface
  63.     {
  64.         return $this->createdAt;
  65.     }
  66.     public function setCreatedAt(\DateTimeInterface $createdAt): self
  67.     {
  68.         $this->createdAt $createdAt;
  69.         return $this;
  70.     }
  71.     /**
  72.      * @return Collection|SousJacent[]
  73.      */
  74.     public function getSousJacents(): Collection
  75.     {
  76.         return $this->sousJacents;
  77.     }
  78.     public function addSousJacent(SousJacent $sousJacent): self
  79.     {
  80.         if (!$this->sousJacents->contains($sousJacent)) {
  81.             $this->sousJacents[] = $sousJacent;
  82.             $sousJacent->setStatde($this);
  83.         }
  84.         return $this;
  85.     }
  86.     public function removeSousJacent(SousJacent $sousJacent): self
  87.     {
  88.         if ($this->sousJacents->contains($sousJacent)) {
  89.             $this->sousJacents->removeElement($sousJacent);
  90.             // set the owning side to null (unless already changed)
  91.             if ($sousJacent->getStatde() === $this) {
  92.                 $sousJacent->setStatde(null);
  93.             }
  94.         }
  95.         return $this;
  96.     }
  97. }