src/Entity/Page.php line 12

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\PageRepository;
  4. use Doctrine\DBAL\Types\Types;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Symfony\Component\String\Slugger\AsciiSlugger;
  7. #[ORM\Entity(repositoryClassPageRepository::class)]
  8. class Page
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column]
  13.     private ?int $id null;
  14.     #[ORM\Column(typeTypes::SMALLINT)]
  15.     private int $rank;
  16.     #[ORM\Column(length255uniquetrue)]
  17.     private string $name;
  18.     #[ORM\Column(length160uniquetrue)]
  19.     private string $url;
  20.     #[ORM\Column(typeTypes::BOOLEAN)]
  21.     private bool $visible;
  22.     #[ORM\Column(typeTypes::BOOLEAN)]
  23.     private bool $main;
  24.     #[ORM\Column(length255 )]
  25.     private string $title;
  26.     #[ORM\Column(length255 )]
  27.     private string $description;
  28.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  29.     private ?string $text null;
  30.     public function getId(): ?int
  31.     {
  32.         return $this->id;
  33.     }
  34.     public function getRank(): ?int
  35.     {
  36.         return $this->rank;
  37.     }
  38.     public function setRank(int $rank): self
  39.     {
  40.         $this->rank $rank;
  41.         return $this;
  42.     }
  43.     public function getName(): ?string
  44.     {
  45.         return $this->name;
  46.     }
  47.     public function setName(string $name): self
  48.     {
  49.         $this->name $name;
  50.         return $this;
  51.     }
  52.     public function getUrl(): ?string
  53.     {
  54.         return $this->url;
  55.     }
  56.     public function setUrl(string $url): self
  57.     {
  58.         $this->url $url;
  59.         if($this->url) {
  60.             $slugger = new AsciiSlugger('cs');
  61.             $slug =   $slugger->slug($url'-')->lower();
  62.             $this->url $slug->toString();
  63.         }
  64.         return $this;
  65.     }
  66.     public function getVisible(): ?bool
  67.     {
  68.         return $this->visible;
  69.     }
  70.     public function setVisible(bool $visible): self
  71.     {
  72.         $this->visible $visible;
  73.         return $this;
  74.     }
  75.     /**
  76.      * @return bool
  77.      */
  78.     public function isMain(): bool
  79.     {
  80.         return $this->main;
  81.     }
  82.     /**
  83.      * @param bool $main
  84.      */
  85.     public function setMain(bool $main): void
  86.     {
  87.         $this->main $main;
  88.     }
  89.     public function getTitle(): ?string
  90.     {
  91.         return $this->title;
  92.     }
  93.     public function setTitle(string $title): self
  94.     {
  95.         $this->title $title;
  96.         return $this;
  97.     }
  98.     public function getDescription(): ?string
  99.     {
  100.         return $this->description;
  101.     }
  102.     public function setDescription(string $description): self
  103.     {
  104.         $this->description $description;
  105.         return $this;
  106.     }
  107.     public function getText(): ?string
  108.     {
  109.         return $this->text;
  110.     }
  111.     public function setText(string $text): self
  112.     {
  113.         $this->text $text;
  114.         return $this;
  115.     }
  116. }