src/Entity/Boutique/Cours/Cours.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Boutique\Cours;
  3. use App\Entity\Media\Media;
  4. use App\Entity\PostType\PostTypeProduit;
  5. use App\Entity\User\Coach;
  6. use App\Entity\User\Skills;
  7. use App\Repository\Boutique\Cours\CoursRepository;
  8. use Doctrine\Common\Collections\ArrayCollection;
  9. use Doctrine\Common\Collections\Collection;
  10. use Doctrine\DBAL\Types\Types;
  11. use Doctrine\ORM\Mapping as ORM;
  12. #[ORM\Entity(repositoryClassCoursRepository::class)]
  13. class Cours extends PostTypeProduit
  14. {
  15.     #[ORM\Column(typeTypes::TEXT)]
  16.     private ?string $description null;
  17.     #[ORM\Column]
  18.     private ?\DateTimeImmutable $date null;
  19.     #[ORM\Column]
  20.     private ?int $duree null;
  21.     #[ORM\ManyToOne(inversedBy'cours')]
  22.     private ?Media $media null;
  23.     #[ORM\ManyToMany(targetEntitySkills::class, inversedBy'cours')]
  24.     private Collection $skills;
  25.     #[ORM\ManyToMany(targetEntityCoach::class, mappedBy'cours'cascade: ['persist'])]
  26.     private Collection $coaches;
  27.     #[ORM\Column(length255)]
  28.     private ?string $accroche null;
  29.     public function __construct()
  30.     {
  31.         parent::__construct();
  32.         date_default_timezone_set('Europe/Paris');
  33.         $this->skills = new ArrayCollection();
  34.         $this->coaches = new ArrayCollection();
  35.     }
  36.     public function getDescription(): ?string
  37.     {
  38.         return $this->description;
  39.     }
  40.     public function setDescription(string $description): self
  41.     {
  42.         $this->description $description;
  43.         return $this;
  44.     }
  45.     public function getDate(): ?\DateTimeImmutable
  46.     {
  47.         return $this->date;
  48.     }
  49.     public function setDate(\DateTimeImmutable $date): self
  50.     {
  51.         $this->date $date;
  52.         return $this;
  53.     }
  54.     public function getDuree(): ?int
  55.     {
  56.         return $this->duree;
  57.     }
  58.     public function setDuree(int $duree): self
  59.     {
  60.         $this->duree $duree;
  61.         return $this;
  62.     }
  63.     public function getMedia(): ?Media
  64.     {
  65.         return $this->media;
  66.     }
  67.     public function setMedia(?Media $media): self
  68.     {
  69.         $this->media $media;
  70.         return $this;
  71.     }
  72.     /**
  73.      * @return Collection<int, Skills>
  74.      */
  75.     public function getSkills(): Collection
  76.     {
  77.         return $this->skills;
  78.     }
  79.     public function addSkill(Skills $skill): self
  80.     {
  81.         if (!$this->skills->contains($skill)) {
  82.             $this->skills->add($skill);
  83.         }
  84.         return $this;
  85.     }
  86.     public function removeSkill(Skills $skill): self
  87.     {
  88.         $this->skills->removeElement($skill);
  89.         return $this;
  90.     }
  91.     /**
  92.      * @return Collection<int, Coach>
  93.      */
  94.     public function getCoaches(): Collection
  95.     {
  96.         return $this->coaches;
  97.     }
  98.     public function addCoach(Coach $coach): self
  99.     {
  100.         if (!$this->coaches->contains($coach)) {
  101.             $this->coaches->add($coach);
  102.             $coach->addCour($this);
  103.         }
  104.         return $this;
  105.     }
  106.     public function removeCoach(Coach $coach): self
  107.     {
  108.         if ($this->coaches->removeElement($coach)) {
  109.             $coach->removeCour($this);
  110.         }
  111.         return $this;
  112.     }
  113.     public function getAccroche(): ?string
  114.     {
  115.         return $this->accroche;
  116.     }
  117.     public function setAccroche(string $accroche): self
  118.     {
  119.         $this->accroche $accroche;
  120.         return $this;
  121.     }
  122. }