e1ff9f2b9bb94479c7e06cd2ab8f88c5759b3754
[Packages/TYPO3.CMS.git] / typo3 / sysext / extbase / Classes / Domain / Model / Category.php
1 <?php
2 namespace TYPO3\CMS\Extbase\Domain\Model;
3
4 /*
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 /**
18 * This model represents a category (for anything).
19 *
20 * @api
21 */
22 class Category extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
23 {
24 /**
25 * @var string
26 * @validate notEmpty
27 */
28 protected $title = '';
29
30 /**
31 * @var string
32 */
33 protected $description = '';
34
35 /**
36 * @var string
37 */
38 protected $icon = '';
39
40 /**
41 * @var \TYPO3\CMS\Extbase\Domain\Model\Category|NULL
42 * @lazy
43 */
44 protected $parent = null;
45
46 /**
47 * Gets the title.
48 *
49 * @return string the title, might be empty
50 * @api
51 */
52 public function getTitle()
53 {
54 return $this->title;
55 }
56
57 /**
58 * Sets the title.
59 *
60 * @param string $title the title to set, may be empty
61 * @return void
62 * @api
63 */
64 public function setTitle($title)
65 {
66 $this->title = $title;
67 }
68
69 /**
70 * Gets the description.
71 *
72 * @return string the description, might be empty
73 * @api
74 */
75 public function getDescription()
76 {
77 return $this->description;
78 }
79
80 /**
81 * Sets the description.
82 *
83 * @param string $description the description to set, may be empty
84 * @return void
85 * @api
86 */
87 public function setDescription($description)
88 {
89 $this->description = $description;
90 }
91
92 /**
93 * Returns the icon
94 *
95 * @return string $icon
96 * @api
97 */
98 public function getIcon()
99 {
100 return $this->icon;
101 }
102
103 /**
104 * Sets the icon
105 *
106 * @param string $icon
107 * @return void
108 * @api
109 */
110 public function setIcon($icon)
111 {
112 $this->icon = $icon;
113 }
114
115 /**
116 * Gets the parent category.
117 *
118 * @return \TYPO3\CMS\Extbase\Domain\Model\Category|NULL the parent category
119 * @api
120 */
121 public function getParent()
122 {
123 if ($this->parent instanceof \TYPO3\CMS\Extbase\Persistence\Generic\LazyLoadingProxy) {
124 $this->parent->_loadRealInstance();
125 }
126 return $this->parent;
127 }
128
129 /**
130 * Sets the parent category.
131 *
132 * @param \TYPO3\CMS\Extbase\Domain\Model\Category $parent the parent category
133 * @return void
134 * @api
135 */
136 public function setParent(\TYPO3\CMS\Extbase\Domain\Model\Category $parent)
137 {
138 $this->parent = $parent;
139 }
140 }