samples/PhotoAlbum/lib/rb.php
public function associate($beans1, $beans2) {
		$results = array();
		if (!is_array($beans1)) $beans1 = array($beans1);
		if (!is_array($beans2)) $beans2 = array($beans2);
		foreach($beans1 as $bean1) {
			foreach($beans2 as $bean2) {
				$table = $this->getTable( array($bean1->getMeta('type') , $bean2->getMeta('type')) );
				$bean = $this->oodb->dispense($table);
				$results[] = $this->associateBeans( $bean1, $bean2, $bean );
			}
		}
		return (count($results)>1) ? $results : reset($results);
	}
public function associate($beans1, $beans2) {
		$results = array();
		if (!is_array($beans1)) $beans1 = array($beans1);
		if (!is_array($beans2)) $beans2 = array($beans2);
		foreach($beans1 as $bean1) {
			foreach($beans2 as $bean2) {
				$table = $this->getTable( array($bean1->getMeta('type') , $bean2->getMeta('type')) );
				$bean = $this->oodb->dispense($table);
				$results[] = $this->associateBeans( $bean1, $bean2, $bean );
			}
		}
		return (count($results)>1) ? $results : reset($results);
	}
public function associate ( $ beans1 , $ beans2 ) { $ results = array ( ) ; if ( ! is_array ( $ beans1 ) ) $ beans1 = array ( $ beans1 ) ; if ( ! is_array ( $ beans2 ) ) $ beans2 = array ( $ beans2 ) ; foreach ( $ beans1 as $ bean1 ) { foreach ( $ beans2 as $ bean2 ) { $ table = $ this -> getTable ( array ( $ bean1 -> getMeta ( 'type' ) , $ bean2 -> getMeta ( 'type' ) ) ) ; $ bean = $ this -> oodb -> dispense ( $ table ) ; $ results [ ] = $ this -> associateBeans ( $ bean1 , $ bean2 , $ bean ) ; } } return ( count ( $ results ) > 1 ) ? $ results : reset ( $ results ) ; }
Associates two beans with eachother using a many-to-many relation.

@param RedBean_OODBBean $bean1 bean1
@param RedBean_OODBBean $bean2 bean2
Associates two beans with eachother using a many - to - many relation .