PageRenderTime 47ms CodeModel.GetById 16ms RepoModel.GetById 1ms app.codeStats 0ms

/nesty/cud/root.md

https://bitbucket.org/KFFEIN-forks/manuals
Markdown | 40 lines | 28 code | 12 blank | 0 comment | 0 complexity | fe756e199e95d0d70eced5599d4a9d97 MD5 | raw file
Possible License(s): BSD-3-Clause
  1. ###root()
  2. ----------
  3. The `root` method returns the Nesty object.
  4. The function returns `Nesty` and throws `NestyException`.
  5. #####Examples:
  6. // Create a new car make
  7. try
  8. {
  9. $ford = new Model_Car(array(
  10. 'name' => 'Ford',
  11. ));
  12. /**
  13. * Make Ford a new root
  14. * Nesty object
  15. */
  16. $ford->root();
  17. }
  18. catch (NestyException $e)
  19. {
  20. $error = $e->getMessage();
  21. }
  22. #####Database Table:
  23. id | name | lft | rgt | tree_id
  24. :-------- | :-------- | :---------: | :---------: | :------:
  25. 1 | Ford | 1 | 2 | 1
  26. #####Nested Structure:
  27. Ford
  28. ----------