samples/PhotoAlbum/lib/rb.php
public static function relatedOne( RedBean_OODBBean $bean, $type, $sql=null, $values=array() ) {
		$beans = self::related($bean, $type, $sql, $values);
		if (count($beans)==0 || !is_array($beans)) return null;
		return reset( $beans );
	}
public static function relatedOne( RedBean_OODBBean $bean, $type, $sql=null, $values=array() ) {
		$beans = self::related($bean, $type, $sql, $values);
		if (count($beans)==0 || !is_array($beans)) return null;
		return reset( $beans );
	}
public static function relatedOne ( RedBean_OODBBean $ bean , $ type , $ sql = null , $ values = array ( ) ) { $ beans = self :: related ( $ bean , $ type , $ sql , $ values ) ; if ( count ( $ beans ) == 0 || ! is_array ( $ beans ) ) return null ; return reset ( $ beans ) ; }
Returns only single associated bean.

@param RedBean_OODBBean $bean bean provided
@param string $type type of bean you are searching for
@param string $sql SQL for extra filtering
@param array $values values to be inserted in SQL slots


@return RedBean_OODBBean $bean
Returns only single associated bean .