/nesty/cud/root.md
Markdown | 40 lines | 28 code | 12 blank | 0 comment | 0 complexity | fe756e199e95d0d70eced5599d4a9d97 MD5 | raw file
Possible License(s): BSD-3-Clause
- ###root()
- ----------
- The `root` method returns the Nesty object.
- The function returns `Nesty` and throws `NestyException`.
- #####Examples:
- // Create a new car make
- try
- {
- $ford = new Model_Car(array(
- 'name' => 'Ford',
- ));
- /**
- * Make Ford a new root
- * Nesty object
- */
- $ford->root();
- }
- catch (NestyException $e)
- {
- $error = $e->getMessage();
- }
- #####Database Table:
- id | name | lft | rgt | tree_id
- :-------- | :-------- | :---------: | :---------: | :------:
- 1 | Ford | 1 | 2 | 1
- #####Nested Structure:
- Ford
- ----------