Trees
From RedBean
Trees
RedBeanPHP also supports trees. Here is an example of a tree in RedBeanPHP:
R::attach($father,$daughter); R::attach($father,$son); $children = R::children( $father ); $father = R::getParent( $son );
To attach a child bean to a parent bean say:
R::attach( $parent, $child );
To get all the children under a parent:
$pages = R::children( $parent );
To get the parent id of a child bean, simply access the property parent_id:
$child->parent_id

