<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use App\Trait\TimestampableTrait;
use App\Repository\SousmenuRepository;
use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\Validator\Constraints as Assert;
#[ORM\Entity(repositoryClass: SousmenuRepository::class)]
#[ORM\HasLifecycleCallbacks]
class Sousmenu
{
use TimestampableTrait;
#[Assert\NotBlank]
#[ORM\ManyToOne(targetEntity: Menu::class, inversedBy: 'sousmenus')]
private $menus;
#[Assert\NotBlank]
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $intitule;
#[ORM\OneToMany(mappedBy: 'sousmenus', targetEntity: Sousmenu2::class)]
private $sousmenu2s;
#[Assert\NotBlank]
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $path;
#[ORM\Column(type: 'text', nullable: true)]
private $content;
#[ORM\Column(type: 'json',nullable: true)]
private $image = [];
#[ORM\Column(type: 'json',nullable: true)]
private $video = [];
#[ORM\OneToMany(mappedBy: 'sousmenu', targetEntity: Actualites::class)]
private $actualites;
#[ORM\OneToMany(mappedBy: 'sousmenu', targetEntity: Reportage::class)]
private $reportages;
#[ORM\OneToMany(mappedBy: 'sousmenu', targetEntity: Membre::class)]
private $membres;
#[ORM\OneToMany(mappedBy: 'sousmenu', targetEntity: Annonces::class)]
private $annonces;
#[ORM\OneToMany(mappedBy: 'sousmenu', targetEntity: Magazine::class)]
private $magazines;
#[ORM\Column]
private ?bool $statut = null;
/* #[ORM\OneToMany(mappedBy: 'sousmenu', targetEntity: Produit::class)]
private $produits; */
public function __construct()
{
$this->sousmenu2s = new ArrayCollection();
$this->actualites = new ArrayCollection();
$this->reportages = new ArrayCollection();
$this->membres = new ArrayCollection();
$this->annonces = new ArrayCollection();
$this->produits = new ArrayCollection();
$this->magazines = new ArrayCollection();
}
public function getMenus(): ?Menu
{
return $this->menus;
}
public function setMenus(?Menu $menus): self
{
$this->menus = $menus;
return $this;
}
public function getIntitule(): ?string
{
return $this->intitule;
}
public function setIntitule(?string $intitule): self
{
$this->intitule = $intitule;
return $this;
}
/**
* @return Collection<int, Sousmenu2>
*/
public function getSousmenu2s(): Collection
{
return $this->sousmenu2s;
}
public function addSousmenu2(Sousmenu2 $sousmenu2): self
{
if (!$this->sousmenu2s->contains($sousmenu2)) {
$this->sousmenu2s[] = $sousmenu2;
$sousmenu2->setSousmenus($this);
}
return $this;
}
public function removeSousmenu2(Sousmenu2 $sousmenu2): self
{
if ($this->sousmenu2s->removeElement($sousmenu2)) {
// set the owning side to null (unless already changed)
if ($sousmenu2->getSousmenus() === $this) {
$sousmenu2->setSousmenus(null);
}
}
return $this;
}
public function __toString()
{
return $this->intitule;
}
public function getPath(): ?string
{
return $this->path;
}
public function setPath(?string $path): self
{
$this->path = $path;
return $this;
}
public function getContent(): ?string
{
return $this->content;
}
public function setContent(?string $content): self
{
$this->content = $content;
return $this;
}
public function getImage(): array
{
return $this->image;
}
public function setImage(?array $image): self
{
$this->image = $image;
return $this;
}
public function getVideo(): array
{
return $this->video;
}
public function setVideo(?array $video): self
{
$this->video = $video;
return $this;
}
/**
* @return Collection<int, Actualites>
*/
public function getActualites(): Collection
{
return $this->actualites;
}
public function addActualite(Actualites $actualite): self
{
if (!$this->actualites->contains($actualite)) {
$this->actualites[] = $actualite;
$actualite->setSousmenu($this);
}
return $this;
}
public function removeActualite(Actualites $actualite): self
{
if ($this->actualites->removeElement($actualite)) {
// set the owning side to null (unless already changed)
if ($actualite->getSousmenu() === $this) {
$actualite->setSousmenu(null);
}
}
return $this;
}
/**
* @return Collection<int, Reportage>
*/
public function getReportages(): Collection
{
return $this->reportages;
}
public function addReportage(Reportage $reportage): self
{
if (!$this->reportages->contains($reportage)) {
$this->reportages[] = $reportage;
$reportage->setSousmenu($this);
}
return $this;
}
public function removeReportage(Reportage $reportage): self
{
if ($this->reportages->removeElement($reportage)) {
// set the owning side to null (unless already changed)
if ($reportage->getSousmenu() === $this) {
$reportage->setSousmenu(null);
}
}
return $this;
}
/**
* @return Collection<int, Membre>
*/
public function getMembres(): Collection
{
return $this->membres;
}
public function addMembre(Membre $membre): self
{
if (!$this->membres->contains($membre)) {
$this->membres[] = $membre;
$membre->setSousmenu($this);
}
return $this;
}
public function removeMembre(Membre $membre): self
{
if ($this->membres->removeElement($membre)) {
// set the owning side to null (unless already changed)
if ($membre->getSousmenu() === $this) {
$membre->setSousmenu(null);
}
}
return $this;
}
/**
* @return Collection<int, Annonces>
*/
public function getAnnonces(): Collection
{
return $this->annonces;
}
public function addAnnonce(Annonces $annonce): self
{
if (!$this->annonces->contains($annonce)) {
$this->annonces[] = $annonce;
$annonce->setSousmenu($this);
}
return $this;
}
public function removeAnnonce(Annonces $annonce): self
{
if ($this->annonces->removeElement($annonce)) {
// set the owning side to null (unless already changed)
if ($annonce->getSousmenu() === $this) {
$annonce->setSousmenu(null);
}
}
return $this;
}
/* /**
* @return Collection<int, Produit>
*
public function getProduits(): Collection
{
return $this->produits;
}
public function addProduit(Produit $produit): self
{
if (!$this->produits->contains($produit)) {
$this->produits[] = $produit;
$produit->setSousmenu($this);
}
return $this;
}
public function removeProduit(Produit $produit): self
{
if ($this->produits->removeElement($produit)) {
// set the owning side to null (unless already changed)
if ($produit->getSousmenu() === $this) {
$produit->setSousmenu(null);
}
}
return $this;
}
*/
/**
* @return Collection<int, Magazine>
*/
public function getMagazines(): Collection
{
return $this->magazines;
}
public function addMagazine(Magazine $magazine): self
{
if (!$this->magazines->contains($magazine)) {
$this->magazines[] = $magazine;
$magazine->setSousmenu($this);
}
return $this;
}
public function removeMagazine(Magazine $magazine): self
{
if ($this->magazines->removeElement($magazine)) {
// set the owning side to null (unless already changed)
if ($magazine->getSousmenu() === $this) {
$magazine->setSousmenu(null);
}
}
return $this;
}
public function isStatut(): ?bool
{
return $this->statut;
}
public function setStatut(bool $statut): self
{
$this->statut = $statut;
return $this;
}
}