PageRenderTime 71ms CodeModel.GetById 25ms RepoModel.GetById 0ms app.codeStats 0ms

/src/lib/legacy/Zikula/Doctrine2/Entity/Category.php

https://github.com/pabloveintimilla/core
PHP | 275 lines | 141 code | 46 blank | 88 comment | 2 complexity | ba18e1192f203898de881882ddd8e1b9 MD5 | raw file
  1. <?php
  2. /**
  3. * Copyright Zikula Foundation 2009 - Zikula Application Framework
  4. *
  5. * This work is contributed to the Zikula Foundation under one or more
  6. * Contributor Agreements and licensed to You under the following license:
  7. *
  8. * @license GNU/LGPLv3 (or at your option, any later version).
  9. * @package Zikula_Form
  10. *
  11. * Please see the NOTICE file distributed with this source code for further
  12. * information regarding copyright and licensing.
  13. */
  14. use Doctrine\ORM\Mapping as ORM;
  15. use Doctrine\Common\Collections\ArrayCollection;
  16. use Zikula\Module\CategoriesModule\Entity\CategoryAttributeEntity;
  17. /**
  18. * Category doctrine2 entity.
  19. *
  20. * @ORM\Entity
  21. * @ORM\Table(name="categories_category")
  22. *
  23. * @deprecated since 1.3.6
  24. */
  25. class Zikula_Doctrine2_Entity_Category extends Zikula_EntityAccess
  26. {
  27. /**
  28. * @ORM\Id
  29. * @ORM\GeneratedValue
  30. * @ORM\Column(type="integer")
  31. * @var integer
  32. */
  33. private $id;
  34. /**
  35. * @ORM\ManyToOne(targetEntity="Zikula_Doctrine2_Entity_Category", inversedBy="children")
  36. * @ORM\JoinColumn(name="parent_id", referencedColumnName="id")
  37. * @var Zikula_Doctrine2_Entity_Category
  38. */
  39. private $parent;
  40. /**
  41. * @ORM\OneToMany(targetEntity="Zikula_Doctrine2_Entity_Category", mappedBy="parent")
  42. * @var Zikula_Doctrine2_Entity_Category[]
  43. */
  44. private $children;
  45. /**
  46. * @ORM\Column(type="boolean", name="is_locked")
  47. * @var boolean
  48. */
  49. private $locked;
  50. /**
  51. * @ORM\Column(type="boolean", name="is_leaf")
  52. * @var boolean
  53. */
  54. private $leaf;
  55. /**
  56. * @ORM\Column(type="string", length=255)
  57. * @var string
  58. */
  59. private $name;
  60. /**
  61. * @ORM\Column(type="string", length=255)
  62. * @var string
  63. */
  64. private $value;
  65. /**
  66. * @ORM\Column(type="integer", name="sort_value")
  67. * @var integer
  68. */
  69. private $sortValue;
  70. /**
  71. * @ORM\Column(type="array", name="display_name")
  72. * @var array
  73. */
  74. private $displayName;
  75. /**
  76. * @ORM\Column(type="array", name="display_desc")
  77. * @var array
  78. */
  79. private $displayDesc;
  80. /**
  81. * @ORM\Column(type="text")
  82. * @var string
  83. */
  84. private $path;
  85. /**
  86. * @ORM\Column(type="string", length=255)
  87. * @var string
  88. */
  89. private $ipath;
  90. /**
  91. * @ORM\Column(type="smallint")
  92. * @var integer
  93. */
  94. private $status;
  95. /**
  96. * @ORM\OneToMany(targetEntity="Zikula\Module\CategoriesModule\Entity\CategoryAttributeEntity",
  97. * mappedBy="category",
  98. * cascade={"all"},
  99. * orphanRemoval=true,
  100. * indexBy="name")
  101. */
  102. private $attributes;
  103. public function __construct()
  104. {
  105. $this->attributes = new ArrayCollection();
  106. }
  107. public function getId()
  108. {
  109. return $this->id;
  110. }
  111. public function setId($id)
  112. {
  113. $this->id;
  114. }
  115. public function getParent()
  116. {
  117. return $this->parent;
  118. }
  119. public function setParent(Zikula_Doctrine2_Entity_Category $parent)
  120. {
  121. $this->parent = $parent;
  122. }
  123. public function getChildren()
  124. {
  125. return $this->children;
  126. }
  127. public function setChildren($children)
  128. {
  129. $this->children = $children;
  130. }
  131. public function getLocked()
  132. {
  133. return $this->locked;
  134. }
  135. public function setLocked($locked)
  136. {
  137. $this->locked = $locked;
  138. }
  139. public function getLeaf()
  140. {
  141. return $this->leaf;
  142. }
  143. public function setLeaf($leaf)
  144. {
  145. $this->leaf = $leaf;
  146. }
  147. public function getName()
  148. {
  149. return $this->name;
  150. }
  151. public function setName($name)
  152. {
  153. $this->name = $name;
  154. }
  155. public function getValue()
  156. {
  157. return $this->value;
  158. }
  159. public function setValue($value)
  160. {
  161. $this->value = $value;
  162. }
  163. public function getSortValue()
  164. {
  165. return $this->sortValue;
  166. }
  167. public function setSortValue($sortValue)
  168. {
  169. $this->sortValue = $sortValue;
  170. }
  171. public function getDisplayName()
  172. {
  173. return $this->displayName;
  174. }
  175. public function setDisplayName($displayName)
  176. {
  177. $this->displayName = $displayName;
  178. }
  179. public function getDisplayDesc()
  180. {
  181. return $this->displayDesc;
  182. }
  183. public function setDisplayDesc($displayDesc)
  184. {
  185. $this->displayDesc = $displayDesc;
  186. }
  187. public function getPath()
  188. {
  189. return $this->path;
  190. }
  191. public function setPath($path)
  192. {
  193. $this->path = $path;
  194. }
  195. public function getIPath()
  196. {
  197. return $this->ipath;
  198. }
  199. public function setIPath($ipath)
  200. {
  201. $this->ipath = $ipath;
  202. }
  203. public function getStatus()
  204. {
  205. return $this->status;
  206. }
  207. public function setStatus($status)
  208. {
  209. $this->status = $status;
  210. }
  211. public function getAttributes()
  212. {
  213. return $this->attributes;
  214. }
  215. /**
  216. * set a single attribute for the category
  217. *
  218. * @param $name string attribute name
  219. * @param $value string attribute value
  220. */
  221. public function setAttribute($name, $value)
  222. {
  223. if (isset($this->attributes[$name])) {
  224. $this->attributes[$name]->setValue($value);
  225. } else {
  226. $this->attributes[$name] = new CategoryAttributeEntity($this, $name, $value);
  227. }
  228. }
  229. }