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