src/Entity/System/MenuItem.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity\System;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\ORM\Mapping as ORM;
  5. /**
  6.  * @ORM\Entity(repositoryClass="App\Repository\System\MenuItemRepository")
  7.  *
  8.  * @ORM\Table(name="menu_item")
  9.  */
  10. class MenuItem
  11. {
  12.     public const LINK_TYPE_CMS 'cms';
  13.     public const LINK_TYPE_CMS_ABSOLUTE 'cms_absolute';
  14.     /**
  15.      * @var int
  16.      *
  17.      * @ORM\Id
  18.      *
  19.      * @ORM\GeneratedValue(strategy="AUTO")
  20.      *
  21.      * @ORM\Column(type="integer")
  22.      */
  23.     private $id;
  24.     /**
  25.      * @var Menu
  26.      *
  27.      * @ORM\ManyToOne(targetEntity="App\Entity\System\Menu")
  28.      *
  29.      * @ORM\JoinColumn(name="menu_id",referencedColumnName="id")
  30.      */
  31.     private $menu;
  32.     /**
  33.      * @var MenuItem|null
  34.      *
  35.      * @ORM\ManyToOne(targetEntity="App\Entity\System\MenuItem", inversedBy="children")
  36.      *
  37.      * @ORM\JoinColumn(name="parent",referencedColumnName="id")
  38.      */
  39.     private $parent;
  40.     /**
  41.      * @var string|null
  42.      *
  43.      * @ORM\Column(type="string", length=30, nullable=true)
  44.      */
  45.     private $linkType;
  46.     /**
  47.      * @var string|null
  48.      *
  49.      * @ORM\Column(type="string", length=255, nullable=true)
  50.      */
  51.     private $linkValue;
  52.     /**
  53.      * @var int
  54.      *
  55.      * @ORM\Column(type="integer")
  56.      */
  57.     private $position;
  58.     /**
  59.      * @var string|null
  60.      *
  61.      * @ORM\Column(type="string", length=20, nullable=true)
  62.      */
  63.     private $tag;
  64.     /**
  65.      * @var string|null
  66.      *
  67.      * @ORM\Column(type="string", length=100, nullable=true)
  68.      */
  69.     private $icon;
  70.     /**
  71.      * @var int
  72.      *
  73.      * @ORM\Column(type="integer", options={"default" : 0})
  74.      */
  75.     private $numberColumns;
  76.     /**
  77.      * @var bool
  78.      *
  79.      * @ORM\Column(type="boolean", columnDefinition="tinyint(1)", options={"default" : 0})
  80.      */
  81.     private $visibility;
  82.     /**
  83.      * @var int
  84.      *
  85.      * @ORM\Column(type="integer", options={"default" : 0})
  86.      */
  87.     private $colspan;
  88.     /**
  89.      * @var MenuItem[]|ArrayCollection
  90.      *
  91.      * @ORM\OneToMany(targetEntity="MenuItem", mappedBy="parent")
  92.      */
  93.     private $children;
  94.     /**
  95.      * @var ArrayCollection|MenuItemLang[]
  96.      *
  97.      * @ORM\OneToMany(targetEntity="MenuItemLang", mappedBy="menuItem", indexBy="language_id", orphanRemoval=true)
  98.      */
  99.     private $translations;
  100.     /**
  101.      * @var string|null
  102.      *
  103.      * @ORM\Column(type="string", length=30, nullable=true)
  104.      */
  105.     private $target;
  106.     /**
  107.      * @var bool
  108.      *
  109.      * @ORM\Column(type="boolean", options={"default" : 0})
  110.      */
  111.     private $additional;
  112.     public function __construct()
  113.     {
  114.         $this->children = new ArrayCollection();
  115.         $this->translations = new ArrayCollection();
  116.     }
  117.     /**
  118.      * @return int
  119.      */
  120.     public function getId(): int
  121.     {
  122.         return $this->id;
  123.     }
  124.     /**
  125.      * @param int $id
  126.      *
  127.      * @return MenuItem
  128.      */
  129.     public function setId(int $id): self
  130.     {
  131.         $this->id $id;
  132.         return $this;
  133.     }
  134.     /**
  135.      * @return Menu
  136.      */
  137.     public function getMenu(): Menu
  138.     {
  139.         return $this->menu;
  140.     }
  141.     /**
  142.      * @param Menu $menu
  143.      *
  144.      * @return MenuItem
  145.      */
  146.     public function setMenu(Menu $menu): self
  147.     {
  148.         $this->menu $menu;
  149.         return $this;
  150.     }
  151.     /**
  152.      * @return string|null
  153.      */
  154.     public function getLinkType(): ?string
  155.     {
  156.         return $this->linkType;
  157.     }
  158.     /**
  159.      * @param string|null $linkType
  160.      *
  161.      * @return MenuItem
  162.      */
  163.     public function setLinkType(?string $linkType): self
  164.     {
  165.         $this->linkType $linkType;
  166.         return $this;
  167.     }
  168.     /**
  169.      * @return string|null
  170.      */
  171.     public function getLinkValue(): ?string
  172.     {
  173.         return $this->linkValue;
  174.     }
  175.     /**
  176.      * @param string|null $linkValue
  177.      *
  178.      * @return MenuItem
  179.      */
  180.     public function setLinkValue(?string $linkValue): self
  181.     {
  182.         $this->linkValue $linkValue;
  183.         return $this;
  184.     }
  185.     /**
  186.      * @return int
  187.      */
  188.     public function getPosition(): int
  189.     {
  190.         return $this->position;
  191.     }
  192.     /**
  193.      * @param int $position
  194.      *
  195.      * @return MenuItem
  196.      */
  197.     public function setPosition(int $position): self
  198.     {
  199.         $this->position $position;
  200.         return $this;
  201.     }
  202.     /**
  203.      * @return string|null
  204.      */
  205.     public function getTag(): ?string
  206.     {
  207.         return $this->tag;
  208.     }
  209.     /**
  210.      * @param string|null $tag
  211.      *
  212.      * @return MenuItem
  213.      */
  214.     public function setTag(?string $tag): self
  215.     {
  216.         $this->tag $tag;
  217.         return $this;
  218.     }
  219.     /**
  220.      * @return string|null
  221.      */
  222.     public function getIcon(): ?string
  223.     {
  224.         return $this->icon;
  225.     }
  226.     /**
  227.      * @param string|null $icon
  228.      *
  229.      * @return MenuItem
  230.      */
  231.     public function setIcon(?string $icon): self
  232.     {
  233.         $this->icon $icon;
  234.         return $this;
  235.     }
  236.     /**
  237.      * @return int
  238.      */
  239.     public function getNumberColumns(): int
  240.     {
  241.         return $this->numberColumns;
  242.     }
  243.     /**
  244.      * @param int $numberColumns
  245.      *
  246.      * @return MenuItem
  247.      */
  248.     public function setNumberColumns(int $numberColumns): self
  249.     {
  250.         $this->numberColumns $numberColumns;
  251.         return $this;
  252.     }
  253.     /**
  254.      * @return bool
  255.      */
  256.     public function isVisible(): bool
  257.     {
  258.         return $this->visibility;
  259.     }
  260.     /**
  261.      * @param bool $visibility
  262.      *
  263.      * @return MenuItem
  264.      */
  265.     public function setVisibility(bool $visibility): self
  266.     {
  267.         $this->visibility $visibility;
  268.         return $this;
  269.     }
  270.     /**
  271.      * @return MenuItem[]|ArrayCollection
  272.      */
  273.     public function getChildren()
  274.     {
  275.         return $this->children;
  276.     }
  277.     /**
  278.      * @return MenuItem|null
  279.      */
  280.     public function getParent(): ?MenuItem
  281.     {
  282.         return $this->parent;
  283.     }
  284.     /**
  285.      * @return MenuItemLang[]|ArrayCollection
  286.      */
  287.     public function getTranslations()
  288.     {
  289.         return $this->translations;
  290.     }
  291.     /**
  292.      * @return bool
  293.      */
  294.     public function isVisibility(): bool
  295.     {
  296.         return $this->visibility;
  297.     }
  298.     /**
  299.      * @return int
  300.      */
  301.     public function getColspan(): int
  302.     {
  303.         return $this->colspan;
  304.     }
  305.     /**
  306.      * @return bool
  307.      */
  308.     public function isAdditional(): bool
  309.     {
  310.         return $this->additional;
  311.     }
  312.     /**
  313.      * @return string|null
  314.      */
  315.     public function getTarget(): ?string
  316.     {
  317.         return $this->target;
  318.     }
  319.     public function setParent(?MenuItem $parent): MenuItem
  320.     {
  321.         $this->parent $parent;
  322.         return $this;
  323.     }
  324.     public function setColspan(int $colspan): MenuItem
  325.     {
  326.         $this->colspan $colspan;
  327.         return $this;
  328.     }
  329.     /**
  330.      * @param MenuItem[]|ArrayCollection<int, MenuItem> $children
  331.      *
  332.      * @return MenuItem
  333.      */
  334.     public function setChildren($children)
  335.     {
  336.         $this->children $children;
  337.         return $this;
  338.     }
  339.     /**
  340.      * @param MenuItemLang[]|ArrayCollection<int, MenuItemLang> $translations
  341.      *
  342.      * @return MenuItem
  343.      */
  344.     public function setTranslations($translations)
  345.     {
  346.         $this->translations $translations;
  347.         return $this;
  348.     }
  349.     public function setTarget(?string $target): MenuItem
  350.     {
  351.         $this->target $target;
  352.         return $this;
  353.     }
  354.     public function setAdditional(bool $additional): MenuItem
  355.     {
  356.         $this->additional $additional;
  357.         return $this;
  358.     }
  359. }