5f013b7430ad124ee685e050a1093c803ba4c79c
[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 \TYPO3\CMS\Extbase\Domain\Model\Category|NULL
37 * @lazy
38 */
39 protected $parent = null;
40
41 /**
42 * Gets the title.
43 *
44 * @return string the title, might be empty
45 * @api
46 */
47 public function getTitle()
48 {
49 return $this->title;
50 }
51
52 /**
53 * Sets the title.
54 *
55 * @param string $title the title to set, may be empty
56 * @api
57 */
58 public function setTitle($title)
59 {
60 $this->title = $title;
61 }
62
63 /**
64 * Gets the description.
65 *
66 * @return string the description, might be empty
67 * @api
68 */
69 public function getDescription()
70 {
71 return $this->description;
72 }
73
74 /**
75 * Sets the description.
76 *
77 * @param string $description the description to set, may be empty
78 * @api
79 */
80 public function setDescription($description)
81 {
82 $this->description = $description;
83 }
84
85 /**
86 * Gets the parent category.
87 *
88 * @return \TYPO3\CMS\Extbase\Domain\Model\Category|NULL the parent category
89 * @api
90 */
91 public function getParent()
92 {
93 if ($this->parent instanceof \TYPO3\CMS\Extbase\Persistence\Generic\LazyLoadingProxy) {
94 $this->parent->_loadRealInstance();
95 }
96 return $this->parent;
97 }
98
99 /**
100 * Sets the parent category.
101 *
102 * @param \TYPO3\CMS\Extbase\Domain\Model\Category $parent the parent category
103 * @api
104 */
105 public function setParent(\TYPO3\CMS\Extbase\Domain\Model\Category $parent)
106 {
107 $this->parent = $parent;
108 }
109 }