src/Entity/Article.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Translation\ArticleTranslation;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use App\Repository\ArticleRepository;
  7. use Gedmo\Translatable\Translatable;
  8. use Gedmo\Mapping\Annotation\TranslationEntity;
  9. use Gedmo\Mapping\Annotation\Locale as GedmoLocale;
  10. use Gedmo\Mapping\Annotation\Translatable as GedmoTranslatable;
  11. #[ORM\Entity(repositoryClassArticleRepository::class)]
  12. #[TranslationEntity(class: ArticleTranslation::class)]
  13. class Article implements TranslatableEntityInterface
  14. {
  15.     #[ORM\Id]
  16.     #[ORM\GeneratedValue]
  17.     #[ORM\Column(type'integer')]
  18.     private $id;
  19.     #[ORM\Column(type'string'length255)]
  20.     private $type 'page';
  21.     #[ORM\Column(type'integer')]
  22.     private $page 0;
  23.     #[ORM\Column(type'string'length255)]
  24.     private $intname '';
  25.     #[ORM\Column(type'boolean')]
  26.     private $mainpage false;
  27.     #[GedmoTranslatable]
  28.     #[ORM\Column(type'string'length255)]    
  29.     private $name '';
  30.     #[ORM\Column(type'string'length255)]
  31.     private $href '';
  32.     #[GedmoTranslatable]
  33.     #[ORM\Column(type'text')]
  34.     private $short '';
  35.     #[GedmoTranslatable]
  36.     #[ORM\Column(type'text')]
  37.     private $cont '';
  38.     private $cont2 '';
  39.     #[ORM\Column(type'smallint')]
  40.     private $prior 0;
  41.     #[ORM\Column(type'boolean')]
  42.     private $visible 1;
  43.     #[GedmoTranslatable]
  44.     #[ORM\Column(type'string'length255)]
  45.     private $title '';
  46.     #[GedmoTranslatable]
  47.     #[ORM\Column(type'string'length255)]
  48.     private $h1 '';
  49.     #[GedmoTranslatable]
  50.     #[ORM\Column(type'string'length255)]
  51.     private $kw '';
  52.     #[GedmoTranslatable]
  53.     #[ORM\Column(type'string'length1000)]
  54.     private $descr '';
  55.     #[ORM\Column(type'integer')]
  56.     private $tstamp 0;
  57.     #[ORM\Column(type'string'length255)]
  58.     private $icon '';
  59.    
  60.     #[GedmoLocale]
  61.     private $locale;
  62.     #[ORM\OneToMany(targetEntityArticleTranslation::class, mappedBy'object'cascade: ['persist''remove'])]
  63.     private $translations;
  64.     public function __construct()
  65.     {
  66.         $this->translations = new ArrayCollection();
  67.     }
  68.     public function setLocale($locale)
  69.     {
  70.         $this->locale $locale;
  71.     }
  72.     public function getTranslations()
  73.     {
  74.         return $this->translations;
  75.     }
  76.     public function addTranslation(ArticleTranslation $t)
  77.     {
  78.         if (!$this->translations->contains($t)) {
  79.             $this->translations[] = $t;
  80.             $t->setObject($this);
  81.         }
  82.     }
  83.     public function getId(): ?int
  84.     {
  85.         return $this->id;
  86.     }
  87.     public function getType(): ?string
  88.     {
  89.         return $this->type;
  90.     }
  91.     public function setType(string $type): self
  92.     {
  93.         $this->type $type;
  94.         return $this;
  95.     }
  96.     public function getPage(): ?int
  97.     {
  98.         return $this->page;
  99.     }
  100.     public function setPage(int $page): self
  101.     {
  102.         $this->page $page;
  103.         return $this;
  104.     }
  105.     public function getIntname(): ?string
  106.     {
  107.         return $this->intname;
  108.     }
  109.     public function setIntname(string $intname): self
  110.     {
  111.         $this->intname $intname;
  112.         return $this;
  113.     }
  114.     public function isMainpage(): ?bool
  115.     {
  116.         return $this->mainpage;
  117.     }
  118.     public function setMainpage(bool $mainpage): self
  119.     {
  120.         $this->mainpage $mainpage;
  121.         return $this;
  122.     }
  123.     public function getName(): ?string
  124.     {
  125.         return $this->name;
  126.     }
  127.     public function setName(string $name): self
  128.     {
  129.         $this->name $name;
  130.         return $this;
  131.     }
  132.     public function getHref(): ?string
  133.     {
  134.         return $this->href;
  135.     }
  136.     public function setHref(string $href): self
  137.     {
  138.         $this->href $href;
  139.         return $this;
  140.     }
  141.     public function getShort(): ?string
  142.     {        
  143.         return $this->short $this->short mb_substr(strip_tags($this->getCont()), 0200)."..."
  144.     }
  145.     public function setShort(string $short): self
  146.     {
  147.         $this->short $short;
  148.         return $this;
  149.     }
  150.     public function getCont(): ?string
  151.     {
  152.         return $this->cont;
  153.     }
  154.     public function setCont(string $cont): self
  155.     {
  156.         $this->cont $cont;
  157.         return $this;
  158.     }
  159.     public function getCont2(): ?string
  160.     {
  161.         return $this->cont;
  162.     }
  163.     public function setCont2(string $cont): self
  164.     {
  165.         $this->cont $cont;
  166.         return $this;
  167.     }
  168.     public function getPrior(): ?int
  169.     {
  170.         return $this->prior;
  171.     }
  172.     public function setPrior(int $prior): self
  173.     {
  174.         $this->prior $prior;
  175.         return $this;
  176.     }
  177.     public function isVisible(): ?bool
  178.     {
  179.         return $this->visible;
  180.     }
  181.     public function setVisible(bool $visible): self
  182.     {
  183.         $this->visible $visible;
  184.         return $this;
  185.     }
  186.     public function getTitle(): ?string
  187.     {
  188.         return $this->title;
  189.     }
  190.     public function setTitle(string $title): self
  191.     {
  192.         $this->title $title;
  193.         return $this;
  194.     }
  195.     public function getH1(): ?string
  196.     {
  197.         return $this->h1;
  198.     }
  199.     public function setH1(string $h1): self
  200.     {
  201.         $this->h1 $h1;
  202.         return $this;
  203.     }
  204.     public function getKw(): ?string
  205.     {
  206.         return $this->kw;
  207.     }
  208.     public function setKw(string $kw): self
  209.     {
  210.         $this->kw $kw;
  211.         return $this;
  212.     }
  213.     public function getDescr(): ?string
  214.     {
  215.         return $this->descr;
  216.     }
  217.     public function setDescr(string $descr): self
  218.     {
  219.         $this->descr $descr;
  220.         return $this;
  221.     }
  222.     public function getTstamp(): ?int
  223.     {
  224.         return $this->tstamp;
  225.     }
  226.     public function setTstamp(int $tstamp): self
  227.     {
  228.         $this->tstamp $tstamp;
  229.         return $this;
  230.     }
  231.     public function getIcon(): ?string
  232.     {
  233.         return $this->icon;
  234.     }
  235.     public function setIcon(string $icon): self
  236.     {
  237.         $this->icon $icon;
  238.         return $this;
  239.     }
  240. }