コード例 #1
0
 /**
  * Associates two Beans. This method will associate two beans with eachother.
  * You can then get one of the beans by using the related() function and
  * providing the other bean. You can also provide a base bean in the extra
  * parameter. This base bean allows you to add extra information to the association
  * record. Note that this is for advanced use only and the information will not
  * be added to one of the beans, just to the association record.
  * It's also possible to provide an array or JSON string as base bean. If you
  * pass a scalar this function will interpret the base bean as having one
  * property called 'extra' with the value of the scalar.
  *
  * @todo extract from facade
  *
  * @param RedBean_OODBBean $bean1            bean that will be part of the association
  * @param RedBean_OODBBean $bean2            bean that will be part of the association
  * @param mixed            $extra            bean, scalar, array or JSON providing extra data.
  *
  * @return mixed
  */
 public function associate($beans1, $beans2, $extra = NULL)
 {
     if (!$extra) {
         return $this->associationManager->associate($beans1, $beans2);
     } else {
         return $this->extAssocManager->extAssociateSimple($beans1, $beans2, $extra);
     }
 }