1 | <?php |
||
15 | class Item implements ItemInterface |
||
16 | { |
||
17 | /** |
||
18 | * @var int |
||
19 | * |
||
20 | * @ORM\Column(name="item_id", type="integer", nullable=false) |
||
21 | * @ORM\Id |
||
22 | * @ORM\GeneratedValue(strategy="IDENTITY") |
||
23 | */ |
||
24 | protected $id; |
||
25 | |||
26 | /** |
||
27 | * @Gedmo\SortableGroup |
||
28 | * |
||
29 | * @ORM\ManyToOne(targetEntity="Alpixel\Bundle\MenuBundle\Entity\Item", inversedBy="children") |
||
30 | * @ORM\JoinColumn(name="parent_id", referencedColumnName="item_id", onDelete="SET NULL") |
||
31 | */ |
||
32 | protected $parent; |
||
33 | |||
34 | /** |
||
35 | * @ORM\OneToMany(targetEntity="Alpixel\Bundle\MenuBundle\Entity\Item", mappedBy="parent") |
||
36 | */ |
||
37 | protected $children; |
||
38 | |||
39 | /** |
||
40 | * @ORM\ManyToOne(targetEntity="Alpixel\Bundle\MenuBundle\Entity\Menu", inversedBy="items") |
||
41 | * @ORM\JoinColumn(name="menu_id", referencedColumnName="menu_id") |
||
42 | */ |
||
43 | protected $menu; |
||
44 | |||
45 | /** |
||
46 | * @var string |
||
47 | * |
||
48 | * @ORM\Column(name="name", type="string", length=255, nullable=false) |
||
49 | */ |
||
50 | protected $name; |
||
51 | |||
52 | /** |
||
53 | * @var string |
||
54 | * |
||
55 | * @ORM\Column(name="uri", type="text", nullable=false) |
||
56 | */ |
||
57 | protected $uri; |
||
58 | |||
59 | /** |
||
60 | * @Gedmo\SortablePosition |
||
61 | * |
||
62 | * @ORM\Column(name="position", type="integer", nullable=false) |
||
63 | */ |
||
64 | protected $position; |
||
65 | |||
66 | /** |
||
67 | * @Gedmo\Slug(fields={"name"}, updatable=true, separator="_") |
||
68 | * @ORM\Column(length=128) |
||
69 | **/ |
||
70 | protected $slug; |
||
71 | |||
72 | |||
73 | public function __construct() |
||
77 | |||
78 | /** |
||
79 | * Get string defined. |
||
80 | * |
||
81 | * @return string |
||
82 | */ |
||
83 | public function __toString() |
||
87 | |||
88 | /** |
||
89 | * Get Id. |
||
90 | * |
||
91 | * @return int |
||
92 | */ |
||
93 | public function getId() |
||
97 | |||
98 | /** |
||
99 | * Get menu. |
||
100 | * |
||
101 | * @return Menu |
||
102 | */ |
||
103 | public function getMenu() |
||
107 | |||
108 | /** |
||
109 | * Set menu. |
||
110 | * |
||
111 | * @param Menu $menu |
||
112 | * |
||
113 | * @return self |
||
114 | */ |
||
115 | public function setMenu(MenuInterface $menu) |
||
121 | |||
122 | /** |
||
123 | * Get parent Item. |
||
124 | * |
||
125 | * @return null\Item |
||
126 | */ |
||
127 | public function getParent() |
||
131 | |||
132 | /** |
||
133 | * Set parent Item. |
||
134 | * |
||
135 | * @param ItemInterface $menu |
||
136 | * |
||
137 | * @return self |
||
138 | */ |
||
139 | public function setParent(ItemInterface $item = null) |
||
145 | |||
146 | /** |
||
147 | * Get children of Item. |
||
148 | * |
||
149 | * @return ArrayCollection (Item) |
||
150 | */ |
||
151 | public function getChildren() |
||
155 | |||
156 | /** |
||
157 | * Set Item from ArrayCollection. |
||
158 | * |
||
159 | * @param null\ArrayCollection |
||
160 | * |
||
161 | * @return self |
||
162 | */ |
||
163 | public function addChildren(ArrayCollection $collection) |
||
171 | |||
172 | /** |
||
173 | * Set children of Item. |
||
174 | * |
||
175 | * @param Item $item |
||
176 | * |
||
177 | * @return self |
||
178 | */ |
||
179 | public function setChildren(ItemInterface $item) |
||
187 | |||
188 | /** |
||
189 | * Remove children. |
||
190 | * |
||
191 | * @param ItemInterface $item |
||
192 | * |
||
193 | * @return $this |
||
194 | */ |
||
195 | public function removeChildren(ItemInterface $item) |
||
203 | |||
204 | /** |
||
205 | * Get name displayed in Item. |
||
206 | * |
||
207 | * @return string |
||
208 | */ |
||
209 | public function getName() |
||
213 | |||
214 | /** |
||
215 | * Set name displayed in Item. |
||
216 | * |
||
217 | * @param string |
||
218 | * |
||
219 | * @return self |
||
220 | */ |
||
221 | public function setName($name) |
||
227 | |||
228 | /** |
||
229 | * Get URL. |
||
230 | * |
||
231 | * @return string |
||
232 | */ |
||
233 | public function getUri() |
||
237 | |||
238 | /** |
||
239 | * Set URL. |
||
240 | * |
||
241 | * @param string $url |
||
242 | * |
||
243 | * @return self |
||
244 | */ |
||
245 | public function setUri($uri) |
||
251 | |||
252 | /** |
||
253 | * Get position of Item. |
||
254 | * |
||
255 | * @return int |
||
256 | */ |
||
257 | public function getPosition() |
||
261 | |||
262 | /** |
||
263 | * Set position. |
||
264 | * |
||
265 | * @param int $position |
||
266 | * |
||
267 | * @return self |
||
268 | */ |
||
269 | public function setPosition($position) |
||
275 | |||
276 | /** |
||
277 | * Gets the value of slug. |
||
278 | * |
||
279 | * @return mixed |
||
280 | */ |
||
281 | public function getSlug() |
||
285 | |||
286 | /** |
||
287 | * Sets the value of slug. |
||
288 | * |
||
289 | * @param mixed $slug the slug |
||
290 | * |
||
291 | * @return self |
||
292 | */ |
||
293 | public function setSlug($slug) |
||
299 | } |
||
300 |