/** * Loads multiple types of beans with the same ID. * This might look like a strange method, however it can be useful * for loading a one-to-one relation. * * @param OODB $oodb OODB object * @param string|array $types the set of types to load at once * @param mixed $id the common ID * * @return OODBBean */ public static function load(OODB $oodb, $types, $id) { if (is_string($types)) { $types = explode(',', $types); } if (!is_array($types)) { return array(); } foreach ($types as $k => $typeItem) { $types[$k] = $oodb->load($typeItem, $id); } return $types; }
/** * Loads a bean from the object database. * It searches for a OODBBean Bean Object in the * database. It does not matter how this bean has been stored. * RedBean uses the primary key ID $id and the string $type * to find the bean. The $type specifies what kind of bean you * are looking for; this is the same type as used with the * dispense() function. If RedBean finds the bean it will return * the OODB Bean object; if it cannot find the bean * RedBean will return a new bean of type $type and with * primary key ID 0. In the latter case it acts basically the * same as dispense(). * * Important note: * If the bean cannot be found in the database a new bean of * the specified type will be generated and returned. * * @param string $type type of bean you want to load * @param integer $id ID of the bean you want to load * * @return OODBBean */ public static function load($type, $id) { return self::$redbean->load($type, $id); }