src/Entity/Page/Page.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Page;
  3. use App\Entity\Blog\Article;
  4. use App\Repository\PageRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use App\Controller\Traits\UrlMaker;
  9. #[ORM\Entity(repositoryClassPageRepository::class)]
  10. class Page
  11. {
  12.     use UrlMaker;
  13.     #[ORM\Id]
  14.     #[ORM\GeneratedValue]
  15.     #[ORM\Column]
  16.     private ?int $id null;
  17.     #[ORM\Column(length255)]
  18.     private ?string $nom null;
  19.     #[ORM\Column(length255)]
  20.     private ?string $url null;
  21.     #[ORM\Column(length255nullabletrue)]
  22.     private ?string $metas null;
  23.     #[ORM\Column(nullablefalseoptions: [ 'default' => true ])]
  24.     private bool $actif true;
  25.     #[ORM\OneToOne(mappedBy'page'cascade: ['persist''remove'])]
  26.     private ?Article $article null;
  27.     #[ORM\ManyToOne(inversedBy'pages')]
  28.     #[ORM\JoinColumn(name"menu"referencedColumnName"id")]
  29.     private ?Menu $menu null;
  30.     public function getId(): ?int
  31.     {
  32.         return $this->id;
  33.     }
  34.     public function getNom(): ?string
  35.     {
  36.         return $this->nom;
  37.     }
  38.     public function setNom(string $nom): static
  39.     {
  40.         $this->nom $nom;
  41.         return $this;
  42.     }
  43.     public function getUrl(): ?string
  44.     {
  45.         return $this->url;
  46.     }
  47.     public function setUrl(string $url): static
  48.     {
  49.         $parsedUrl $url;
  50.         if (!empty($url)) {
  51.             $parsedUrl $this->urlFromString($url);
  52.         }
  53.         $this->url $parsedUrl;
  54.         return $this;
  55.     }
  56.     public function getMetas(): ?string
  57.     {
  58.         return $this->metas;
  59.     }
  60.     public function setMetas(?string $metas): static
  61.     {
  62.         $this->metas $metas;
  63.         return $this;
  64.     }
  65.     public function isActif(): ?bool
  66.     {
  67.         return $this->actif;
  68.     }
  69.     public function setActif(bool $actif): static
  70.     {
  71.         $this->actif $actif;
  72.         return $this;
  73.     }
  74.     public function getArticle(): ?Article
  75.     {
  76.         return $this->article;
  77.     }
  78.     public function setArticle(?Article $article): static
  79.     {
  80.         // unset the owning side of the relation if necessary
  81.         if ($article === null && $this->article !== null) {
  82.             $this->article->setPage(null);
  83.         }
  84.         // set the owning side of the relation if necessary
  85.         if ($article !== null && $article->getPage() !== $this) {
  86.             $article->setPage($this);
  87.         }
  88.         $this->article $article;
  89.         return $this;
  90.     }
  91.     public function getMenu(): ?Menu
  92.     {
  93.         return $this->menu;
  94.     }
  95.     public function setMenu(?Menu $menu): static
  96.     {
  97.         $this->menu $menu;
  98.         return $this;
  99.     }
  100. }