/** * Returns all children beans under parent bean $parent * @param RedBean_OODBBean $parent * @return array $childBeans */ public static function children(RedBean_OODBBean $parent) { return self::$treeManager->children($parent); }
asrt(count($a->related($page, "user")), 1); $a->clearRelations($user, "page"); pass(); //no error asrt(count($a->related($user, "page")), 0); asrt(count($a->related($page, "user")), 0); $page = $redbean->load("page", $id); pass(); asrt($page->name, "test page"); testpack("Test: Trees "); $tm = new RedBean_TreeManager($toolbox); $subpage1 = $redbean->dispense("page"); $subpage2 = $redbean->dispense("page"); $subpage3 = $redbean->dispense("page"); $tm->attach($page, $subpage1); asrt(count($tm->children($page)), 1); $tm->attach($page, $subpage2); asrt(count($tm->children($page)), 2); $tm->attach($subpage2, $subpage3); asrt(count($tm->children($page)), 2); asrt(count($tm->children($subpage2)), 1); asrt(intval($subpage1->parent_id), intval($id)); testpack("Test Integration Pre-existing Schema"); $adapter->exec("ALTER TABLE `page` CHANGE `name` `name` VARCHAR( 254 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL "); $page = $redbean->dispense("page"); $page->name = "Just Another Page In a Table"; $cols = $writer->getColumns("page"); asrt($cols["name"], "varchar(254)"); //$pdo->setDebugMode(1); $redbean->store($page); pass();