NodeObject.php 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  1. <?php
  2. /**
  3. * This file is part of the Propel package.
  4. * For the full copyright and license information, please view the LICENSE
  5. * file that was distributed with this source code.
  6. *
  7. * @license MIT License
  8. */
  9. /**
  10. * This interface defines methods that must be implemented by all
  11. * business objects within the system to handle Node object.
  12. *
  13. * @author Heltem <heltem@o2php.com> (Propel)
  14. * @version $Revision: 1612 $
  15. * @package propel.runtime.om
  16. */
  17. interface NodeObject extends IteratorAggregate
  18. {
  19. /**
  20. * If object is saved without left/right values, set them as undefined (0)
  21. *
  22. * @param PropelPDO $con Connection to use.
  23. * @return void
  24. * @throws PropelException
  25. */
  26. public function save(PropelPDO $con = null);
  27. /**
  28. * Delete node and descendants
  29. *
  30. * @param PropelPDO $con Connection to use.
  31. * @return void
  32. * @throws PropelException
  33. */
  34. public function delete(PropelPDO $con = null);
  35. /**
  36. * Sets node properties to make it a root node.
  37. *
  38. * @return object The current object (for fluent API support)
  39. * @throws PropelException
  40. */
  41. public function makeRoot();
  42. /**
  43. * Gets the level if set, otherwise calculates this and returns it
  44. *
  45. * @param PropelPDO $con Connection to use.
  46. * @return int
  47. */
  48. public function getLevel(PropelPDO $con = null);
  49. /**
  50. * Get the path to the node in the tree
  51. *
  52. * @param PropelPDO $con Connection to use.
  53. * @return array
  54. */
  55. public function getPath(PropelPDO $con = null);
  56. /**
  57. * Gets the number of children for the node (direct descendants)
  58. *
  59. * @param PropelPDO $con Connection to use.
  60. * @return int
  61. */
  62. public function getNumberOfChildren(PropelPDO $con = null);
  63. /**
  64. * Gets the total number of desceandants for the node
  65. *
  66. * @param PropelPDO $con Connection to use.
  67. * @return int
  68. */
  69. public function getNumberOfDescendants(PropelPDO $con = null);
  70. /**
  71. * Gets the children for the node
  72. *
  73. * @param PropelPDO $con Connection to use.
  74. * @return array
  75. */
  76. public function getChildren(PropelPDO $con = null);
  77. /**
  78. * Gets the descendants for the node
  79. *
  80. * @param PropelPDO $con Connection to use.
  81. * @return array
  82. */
  83. public function getDescendants(PropelPDO $con = null);
  84. /**
  85. * Sets the level of the node in the tree
  86. *
  87. * @param int $v new value
  88. * @return object The current object (for fluent API support)
  89. */
  90. public function setLevel($level);
  91. /**
  92. * Sets the children array of the node in the tree
  93. *
  94. * @param array of Node $children array of Propel node object
  95. * @return object The current object (for fluent API support)
  96. */
  97. public function setChildren(array $children);
  98. /**
  99. * Sets the parentNode of the node in the tree
  100. *
  101. * @param Node $parent Propel node object
  102. * @return object The current object (for fluent API support)
  103. */
  104. public function setParentNode(NodeObject $parent = null);
  105. /**
  106. * Sets the previous sibling of the node in the tree
  107. *
  108. * @param Node $node Propel node object
  109. * @return object The current object (for fluent API support)
  110. */
  111. public function setPrevSibling(NodeObject $node = null);
  112. /**
  113. * Sets the next sibling of the node in the tree
  114. *
  115. * @param Node $node Propel node object
  116. * @return object The current object (for fluent API support)
  117. */
  118. public function setNextSibling(NodeObject $node = null);
  119. /**
  120. * Determines if the node is the root node
  121. *
  122. * @return bool
  123. */
  124. public function isRoot();
  125. /**
  126. * Determines if the node is a leaf node
  127. *
  128. * @return bool
  129. */
  130. public function isLeaf();
  131. /**
  132. * Tests if object is equal to $node
  133. *
  134. * @param object $node Propel object for node to compare to
  135. * @return bool
  136. */
  137. public function isEqualTo(NodeObject $node);
  138. /**
  139. * Tests if object has an ancestor
  140. *
  141. * @param PropelPDO $con Connection to use.
  142. * @return bool
  143. */
  144. public function hasParent(PropelPDO $con = null);
  145. /**
  146. * Determines if the node has children / descendants
  147. *
  148. * @return bool
  149. */
  150. public function hasChildren();
  151. /**
  152. * Determines if the node has previous sibling
  153. *
  154. * @param PropelPDO $con Connection to use.
  155. * @return bool
  156. */
  157. public function hasPrevSibling(PropelPDO $con = null);
  158. /**
  159. * Determines if the node has next sibling
  160. *
  161. * @param PropelPDO $con Connection to use.
  162. * @return bool
  163. */
  164. public function hasNextSibling(PropelPDO $con = null);
  165. /**
  166. * Gets ancestor for the given node if it exists
  167. *
  168. * @param PropelPDO $con Connection to use.
  169. * @return mixed Propel object if exists else false
  170. */
  171. public function retrieveParent(PropelPDO $con = null);
  172. /**
  173. * Gets first child if it exists
  174. *
  175. * @param PropelPDO $con Connection to use.
  176. * @return mixed Propel object if exists else false
  177. */
  178. public function retrieveFirstChild(PropelPDO $con = null);
  179. /**
  180. * Gets last child if it exists
  181. *
  182. * @param PropelPDO $con Connection to use.
  183. * @return mixed Propel object if exists else false
  184. */
  185. public function retrieveLastChild(PropelPDO $con = null);
  186. /**
  187. * Gets prev sibling for the given node if it exists
  188. *
  189. * @param PropelPDO $con Connection to use.
  190. * @return mixed Propel object if exists else false
  191. */
  192. public function retrievePrevSibling(PropelPDO $con = null);
  193. /**
  194. * Gets next sibling for the given node if it exists
  195. *
  196. * @param PropelPDO $con Connection to use.
  197. * @return mixed Propel object if exists else false
  198. */
  199. public function retrieveNextSibling(PropelPDO $con = null);
  200. /**
  201. * Inserts as first child of destination node $parent
  202. *
  203. * @param object $parent Propel object for given destination node
  204. * @param PropelPDO $con Connection to use.
  205. * @return object The current object (for fluent API support)
  206. */
  207. public function insertAsFirstChildOf(NodeObject $parent, PropelPDO $con = null);
  208. /**
  209. * Inserts as last child of destination node $parent
  210. *
  211. * @param object $parent Propel object for given destination node
  212. * @param PropelPDO $con Connection to use.
  213. * @return object The current object (for fluent API support)
  214. */
  215. public function insertAsLastChildOf(NodeObject $parent, PropelPDO $con = null);
  216. /**
  217. * Inserts node as previous sibling to destination node $dest
  218. *
  219. * @param object $dest Propel object for given destination node
  220. * @param PropelPDO $con Connection to use.
  221. * @return object The current object (for fluent API support)
  222. */
  223. public function insertAsPrevSiblingOf(NodeObject $dest, PropelPDO $con = null);
  224. /**
  225. * Inserts node as next sibling to destination node $dest
  226. *
  227. * @param object $dest Propel object for given destination node
  228. * @param PropelPDO $con Connection to use.
  229. * @return object The current object (for fluent API support)
  230. */
  231. public function insertAsNextSiblingOf(NodeObject $dest, PropelPDO $con = null);
  232. /**
  233. * Moves node to be first child of $parent
  234. *
  235. * @param object $parent Propel object for destination node
  236. * @param PropelPDO $con Connection to use.
  237. * @return void
  238. */
  239. public function moveToFirstChildOf(NodeObject $parent, PropelPDO $con = null);
  240. /**
  241. * Moves node to be last child of $parent
  242. *
  243. * @param object $parent Propel object for destination node
  244. * @param PropelPDO $con Connection to use.
  245. * @return void
  246. */
  247. public function moveToLastChildOf(NodeObject $parent, PropelPDO $con = null);
  248. /**
  249. * Moves node to be prev sibling to $dest
  250. *
  251. * @param object $dest Propel object for destination node
  252. * @param PropelPDO $con Connection to use.
  253. * @return void
  254. */
  255. public function moveToPrevSiblingOf(NodeObject $dest, PropelPDO $con = null);
  256. /**
  257. * Moves node to be next sibling to $dest
  258. *
  259. * @param object $dest Propel object for destination node
  260. * @param PropelPDO $con Connection to use.
  261. * @return void
  262. */
  263. public function moveToNextSiblingOf(NodeObject $dest, PropelPDO $con = null);
  264. /**
  265. * Inserts node as parent of given node.
  266. *
  267. * @param object $node Propel object for given destination node
  268. * @param PropelPDO $con Connection to use.
  269. * @return void
  270. * @throws Exception When trying to insert node as parent of a root node
  271. */
  272. public function insertAsParentOf(NodeObject $node, PropelPDO $con = null);
  273. /**
  274. * Wraps the getter for the scope value
  275. *
  276. * @return int
  277. */
  278. public function getScopeIdValue();
  279. /**
  280. * Set the value of scope column
  281. *
  282. * @param int $v new value
  283. * @return object The current object (for fluent API support)
  284. */
  285. public function setScopeIdValue($v);
  286. } // NodeObject