src/Entity/Menu.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use App\Trait\TimestampableTrait;
  5. use App\Repository\MenuRepository;
  6. use Symfony\Component\Validator\Constraints as Assert;
  7. use Doctrine\Common\Collections\Collection;
  8. use Doctrine\Common\Collections\ArrayCollection;
  9. #[ORM\Entity(repositoryClassMenuRepository::class)]
  10. #[ORM\HasLifecycleCallbacks]
  11. class Menu
  12. {
  13.     use TimestampableTrait;
  14.     #[Assert\NotBlank]
  15.     #[ORM\Column(type'string'length255nullabletrue)]
  16.     private $title;
  17.     #[ORM\OneToMany(mappedBy'menus'targetEntitySousmenu::class)]
  18.     private $sousmenus;
  19.     #[ORM\Column(type'string'length255nullabletrue)]
  20.     private $path;
  21.     #[ORM\Column(type'text'nullabletrue)]
  22.     private $content;
  23.     #[ORM\Column(type'json'nullabletrue)]
  24.     private  $image = [];
  25.     #[ORM\Column(type'json',nullabletrue)]
  26.     private  $video = [];
  27.     
  28.     #[ORM\OneToMany(mappedBy'menu'targetEntityEvent::class)]
  29.     private $events;
  30.     #[ORM\OneToMany(mappedBy'menu'targetEntityAgenda::class)]
  31.     private $agendas;
  32.     #[ORM\OneToMany(mappedBy'menu'targetEntityMagazine::class)]
  33.     private $magazines;
  34.     #[ORM\Column(nullabletrue)]
  35.     private ?bool $statut null;
  36.     #[ORM\Column(nullabletrue)]
  37.     private ?int $position null;
  38.     public function __construct()
  39.     {
  40.         $this->sousmenus = new ArrayCollection();
  41.         
  42.         $this->events = new ArrayCollection();
  43.         $this->agendas = new ArrayCollection();
  44.         $this->magazines = new ArrayCollection();
  45.     }
  46.    
  47.     public function getTitle(): ?string
  48.     {
  49.         return $this->title;
  50.     }
  51.     public function setTitle(?string $title): self
  52.     {
  53.         $this->title $title;
  54.         return $this;
  55.     }
  56.     /**
  57.      * @return Collection<int, Sousmenu>
  58.      */
  59.     public function getSousmenus(): Collection
  60.     {
  61.         return $this->sousmenus;
  62.     }
  63.     public function addSousmenu(Sousmenu $sousmenu): self
  64.     {
  65.         if (!$this->sousmenus->contains($sousmenu)) {
  66.             $this->sousmenus[] = $sousmenu;
  67.             $sousmenu->setMenus($this);
  68.         }
  69.         return $this;
  70.     }
  71.     public function removeSousmenu(Sousmenu $sousmenu): self
  72.     {
  73.         if ($this->sousmenus->removeElement($sousmenu)) {
  74.             // set the owning side to null (unless already changed)
  75.             if ($sousmenu->getMenus() === $this) {
  76.                 $sousmenu->setMenus(null);
  77.             }
  78.         }
  79.         return $this;
  80.     }
  81.     
  82.     public function __toString()
  83.     {
  84.         return $this->title;
  85.     }
  86.     public function getPath(): ?string
  87.     {
  88.         return $this->path;
  89.     }
  90.     public function setPath(?string $path): self
  91.     {
  92.         $this->path $path;
  93.         return $this;
  94.     }
  95.     public function getContent(): ?string
  96.     {
  97.         return $this->content;
  98.     }
  99.     public function setContent(?string $content): self
  100.     {
  101.         $this->content $content;
  102.         return $this;
  103.     }
  104.      public function getImage(): array
  105.     {
  106.         return $this->image;
  107.     }
  108.     
  109.     public function setImage(?array $image): self
  110.     {
  111.         $this->image $image;
  112.         return $this;
  113.     }
  114.     public function getVideo(): array
  115.     {
  116.         return $this->video;
  117.     }
  118.     public function setVideo(?array $video): self
  119.     {
  120.         $this->video $video;
  121.         return $this;
  122.     }
  123.   
  124.     /**
  125.      * @return Collection<int, Event>
  126.      */
  127.     public function getEvents(): Collection
  128.     {
  129.         return $this->events;
  130.     }
  131.     public function addEvent(Event $event): self
  132.     {
  133.         if (!$this->events->contains($event)) {
  134.             $this->events[] = $event;
  135.             $event->setMenu($this);
  136.         }
  137.         return $this;
  138.     }
  139.     public function removeEvent(Event $event): self
  140.     {
  141.         if ($this->events->removeElement($event)) {
  142.             // set the owning side to null (unless already changed)
  143.             if ($event->getMenu() === $this) {
  144.                 $event->setMenu(null);
  145.             }
  146.         }
  147.         return $this;
  148.     }
  149.     /**
  150.      * @return Collection<int, Agenda>
  151.      */
  152.     public function getAgendas(): Collection
  153.     {
  154.         return $this->agendas;
  155.     }
  156.     public function addAgenda(Agenda $agenda): self
  157.     {
  158.         if (!$this->agendas->contains($agenda)) {
  159.             $this->agendas[] = $agenda;
  160.             $agenda->setMenu($this);
  161.         }
  162.         return $this;
  163.     }
  164.     public function removeAgenda(Agenda $agenda): self
  165.     {
  166.         if ($this->agendas->removeElement($agenda)) {
  167.             // set the owning side to null (unless already changed)
  168.             if ($agenda->getMenu() === $this) {
  169.                 $agenda->setMenu(null);
  170.             }
  171.         }
  172.         return $this;
  173.     }
  174.     /**
  175.      * @return Collection<int, Magazine>
  176.      */
  177.     public function getMagazines(): Collection
  178.     {
  179.         return $this->magazines;
  180.     }
  181.     public function addMagazine(Magazine $magazine): self
  182.     {
  183.         if (!$this->magazines->contains($magazine)) {
  184.             $this->magazines[] = $magazine;
  185.             $magazine->setMenu($this);
  186.         }
  187.         return $this;
  188.     }
  189.     public function removeMagazine(Magazine $magazine): self
  190.     {
  191.         if ($this->magazines->removeElement($magazine)) {
  192.             // set the owning side to null (unless already changed)
  193.             if ($magazine->getMenu() === $this) {
  194.                 $magazine->setMenu(null);
  195.             }
  196.         }
  197.         return $this;
  198.     }
  199.     public function isStatut(): ?bool
  200.     {
  201.         return $this->statut;
  202.     }
  203.     public function setStatut(?bool $statut): self
  204.     {
  205.         $this->statut $statut;
  206.         return $this;
  207.     }
  208.     public function getPosition(): ?int
  209.     {
  210.         return $this->position;
  211.     }
  212.     public function setPosition(?int $position): self
  213.     {
  214.         $this->position $position;
  215.         return $this;
  216.     }
  217. }