src/Entity/Page.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use App\Repository\PageRepository;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use App\Entity\Translation\PageTranslation;
  8. use Gedmo\Translatable\Translatable;
  9. use Gedmo\Mapping\Annotation\TranslationEntity;
  10. use Gedmo\Mapping\Annotation\Locale as GedmoLocale;
  11. use Gedmo\Mapping\Annotation\Translatable as GedmoTranslatable;
  12. #[ORM\Entity(repositoryClassPageRepository::class)]
  13. #[TranslationEntity(class: PageTranslation::class)]
  14. class Page implements TranslatableEntityInterface
  15. {
  16.     #[ORM\Id]
  17.     #[ORM\GeneratedValue]
  18.     #[ORM\Column(type'integer')]
  19.     private $id;
  20.     #[ORM\Column(type'string'length255)]
  21.     private $type 'page';
  22.     #[ORM\Column(type'integer')]
  23.     private $page 0;
  24.     #[ORM\Column(type'string'length255)]
  25.     private $intname '';
  26.     #[ORM\Column(type'boolean')]
  27.     private $mainpage false;
  28.     #[GedmoTranslatable]
  29.     #[ORM\Column(type'string'length255)]    
  30.     private $name '';
  31.     #[ORM\Column(type'string'length255)]
  32.     #[GedmoTranslatable]
  33.     private $href '';
  34.     #[GedmoTranslatable]
  35.     #[ORM\Column(type'text')]
  36.     private $short '';
  37.     #[GedmoTranslatable]
  38.     #[ORM\Column(type'text')]
  39.     private $cont '';
  40.     private $cont2 '';
  41.     #[ORM\Column(type'smallint')]
  42.     private $prior 0;
  43.     #[ORM\Column(type'boolean')]
  44.     private $visible 1;
  45.     #[GedmoTranslatable]
  46.     #[ORM\Column(type'string'length255)]
  47.     private $title '';
  48.     #[GedmoTranslatable]
  49.     #[ORM\Column(type'string'length255)]
  50.     private $h1 '';
  51.     #[GedmoTranslatable]
  52.     #[ORM\Column(type'string'length255)]
  53.     private $kw '';
  54.     #[GedmoTranslatable]
  55.     #[ORM\Column(type'string'length1000)]
  56.     private $descr '';
  57.     #[ORM\Column(type'integer')]
  58.     private $tstamp 0;
  59.     #[ORM\Column(type'string'length255)]
  60.     private $icon '';
  61.     #[ORM\OneToMany(mappedBy'page'targetEntityPagePhoto::class)]
  62.     private $photos;
  63.     #[ORM\OneToMany(mappedBy'page'targetEntityPageBlock::class)]
  64.     private $blocks;
  65.    
  66.     #[GedmoLocale]
  67.     private $locale;
  68.     #[ORM\OneToMany(targetEntityPageTranslation::class, mappedBy'object'cascade: ['persist''remove'])]
  69.     private $translations;
  70.     public function __construct()
  71.     {
  72.         $this->photos = new ArrayCollection();
  73.         $this->blocks = new ArrayCollection();
  74.         $this->translations = new ArrayCollection();
  75.     }
  76.     public function setLocale($locale)
  77.     {
  78.         $this->locale $locale;
  79.     }
  80.     public function getTranslations()
  81.     {
  82.         return $this->translations;
  83.     }
  84.     public function addTranslation(PageTranslation $t)
  85.     {
  86.         if (!$this->translations->contains($t)) {
  87.             $this->translations[] = $t;
  88.             $t->setObject($this);
  89.         }
  90.     }
  91.     public function getId(): ?int
  92.     {
  93.         return $this->id;
  94.     }
  95.     public function getType(): ?string
  96.     {
  97.         return $this->type;
  98.     }
  99.     public function setType(string $type): self
  100.     {
  101.         $this->type $type;
  102.         return $this;
  103.     }
  104.     public function getPage(): ?int
  105.     {
  106.         return $this->page;
  107.     }
  108.     public function setPage(int $page): self
  109.     {
  110.         $this->page $page;
  111.         return $this;
  112.     }
  113.     public function getIntname(): ?string
  114.     {
  115.         return $this->intname;
  116.     }
  117.     public function setIntname(string $intname): self
  118.     {
  119.         $this->intname $intname;
  120.         return $this;
  121.     }
  122.     public function isMainpage(): ?bool
  123.     {
  124.         return $this->mainpage;
  125.     }
  126.     public function setMainpage(bool $mainpage): self
  127.     {
  128.         $this->mainpage $mainpage;
  129.         return $this;
  130.     }
  131.     public function getName(): ?string
  132.     {
  133.         return $this->name;
  134.     }
  135.     public function setName(string $name): self
  136.     {
  137.         $this->name $name;
  138.         return $this;
  139.     }
  140.     public function getHref(): ?string
  141.     {
  142.         return $this->href;
  143.     }
  144.     public function setHref(string $href): self
  145.     {
  146.         $this->href $href;
  147.         return $this;
  148.     }
  149.     public function getShort(): ?string
  150.     {        
  151.         return $this->short $this->short mb_substr(strip_tags($this->getCont()), 0200)."..."
  152.     }
  153.     public function setShort(string $short): self
  154.     {
  155.         $this->short $short;
  156.         return $this;
  157.     }
  158.     public function getCont(): ?string
  159.     {
  160.         return $this->cont;
  161.     }
  162.     public function setCont(string $cont): self
  163.     {
  164.         $this->cont $cont;
  165.         return $this;
  166.     }
  167.     public function getCont2(): ?string
  168.     {
  169.         return $this->cont;
  170.     }
  171.     public function setCont2(string $cont): self
  172.     {
  173.         $this->cont $cont;
  174.         return $this;
  175.     }
  176.     public function getPrior(): ?int
  177.     {
  178.         return $this->prior;
  179.     }
  180.     public function setPrior(int $prior): self
  181.     {
  182.         $this->prior $prior;
  183.         return $this;
  184.     }
  185.     public function isVisible(): ?bool
  186.     {
  187.         return $this->visible;
  188.     }
  189.     public function setVisible(bool $visible): self
  190.     {
  191.         $this->visible $visible;
  192.         return $this;
  193.     }
  194.     public function getTitle(): ?string
  195.     {
  196.         return $this->title;
  197.     }
  198.     public function setTitle(string $title): self
  199.     {
  200.         $this->title $title;
  201.         return $this;
  202.     }
  203.     public function getH1(): ?string
  204.     {
  205.         return $this->h1;
  206.     }
  207.     public function setH1(string $h1): self
  208.     {
  209.         $this->h1 $h1;
  210.         return $this;
  211.     }
  212.     public function getKw(): ?string
  213.     {
  214.         return $this->kw;
  215.     }
  216.     public function setKw(string $kw): self
  217.     {
  218.         $this->kw $kw;
  219.         return $this;
  220.     }
  221.     public function getDescr(): ?string
  222.     {
  223.         return $this->descr;
  224.     }
  225.     public function setDescr(string $descr): self
  226.     {
  227.         $this->descr $descr;
  228.         return $this;
  229.     }
  230.     public function getTstamp(): ?int
  231.     {
  232.         return $this->tstamp;
  233.     }
  234.     public function setTstamp(int $tstamp): self
  235.     {
  236.         $this->tstamp $tstamp;
  237.         return $this;
  238.     }
  239.     public function getIcon(): ?string
  240.     {
  241.         return $this->icon;
  242.     }
  243.     public function setIcon(string $icon): self
  244.     {
  245.         $this->icon $icon;
  246.         return $this;
  247.     }
  248.     /**
  249.      * @return Collection<int, PagePhoto>
  250.      */
  251.     public function getPhotos(): Collection
  252.     {
  253.         return $this->photos;
  254.     }
  255.     public function addPhoto(PagePhoto $photo): self
  256.     {
  257.         if (!$this->photos->contains($photo)) {
  258.             $this->photos[] = $photo;
  259.             $photo->setPage($this);
  260.         }
  261.         return $this;
  262.     }
  263.     public function removePhoto(PagePhoto $photo): self
  264.     {
  265.         if ($this->photos->removeElement($photo)) {
  266.             // set the owning side to null (unless already changed)
  267.             if ($photo->getPage() === $this) {
  268.                 $photo->setPage(null);
  269.             }
  270.         }
  271.         return $this;
  272.     }
  273.     /**
  274.      * @return Collection<int, PageBlock>
  275.      */
  276.     public function getBlocks(): Collection
  277.     {
  278.         return $this->blocks;
  279.     }
  280.     public function addBlock(PageBlock $block): self
  281.     {
  282.         if (!$this->blocks->contains($block)) {
  283.             $this->blocks[] = $block;
  284.             $block->setPage($this);
  285.         }
  286.         return $this;
  287.     }
  288.     public function removeBlock(PageBlock $block): self
  289.     {
  290.         if ($this->blocks->removeElement($block)) {
  291.             // set the owning side to null (unless already changed)
  292.             if ($block->getPage() === $this) {
  293.                 $block->setPage(null);
  294.             }
  295.         }
  296.         return $this;
  297.     }
  298. }