Extended Associations

From RedBean

Jump to: navigation, search

Extended Associations

Note that an association is in fact also just a bean; it only has a different name based on the names of the beans to be associated. For instance associating a page with a book results in a bean of type book_page (alphabetically ordered). With normal associations you do not have any control over this association bean. However if you want to qualify associations (in our example; order the pages of a book) then you can use the extended association manager:

$ea = new RedBean_ExtAssociationManager( $toolbox );
$pageNumber = $redbean->dispense("pagenumber");
$pageNumber->number = 9;
$ea->extAssociate( $page, $book, $pageNumber );
Personal tools