We previously discussed the own-list. This is RedBeanPHP's version of a one-to-many relationship. However, if we look from the other end of the relationship we have a many-to-one relationship: many buildings belong to one village. Suppose you are working on this end of the relationship; you have a building, how can you access its village?
$village = $building->village;
We call this the parent bean. The term 'parent' may be confusing but on the other hand it clearly indicates that on the other side the bean is part of a list owned by another bean.
You can unset the parent bean like this:
$building->village = null;
Trying to assign something other than a bean to a parent object field will throw an exception:
//throws a RedBeanPHP Security exception
$building->village = 'Lutjebroek';
Once a property has been used to store a bean, it can only be used to store a bean afterwards.
RedBeanPHP Easy ORM for PHP © 2013 Gabor de Mooij and the RedBeanPHP community - Licensed New BSD/GPLv2