samples/PhotoAlbum/lib/rb.php
public function batch( $type, $ids ) {
		if (!$ids) return array();
		$collection = array();
		try {
			$rows = $this->writer->selectRecord($type,array('id'=>$ids));
		}catch(RedBean_Exception_SQL $e) {
			if (!$this->writer->sqlStateIn($e->getSQLState(),
			array(
			RedBean_QueryWriter::C_SQLSTATE_NO_SUCH_COLUMN,
			RedBean_QueryWriter::C_SQLSTATE_NO_SUCH_TABLE)
			)) throw $e;

			$rows = false;
		}
		$this->stash = array();
		if (!$rows) return array();
		foreach($rows as $row) {
			$this->stash[$row['id']] = $row;
		}
		foreach($ids as $id) {
			$collection[ $id ] = $this->load( $type, $id );
		}
		$this->stash = NULL;
		return $collection;
	}
public function batch( $type, $ids ) {
		if (!$ids) return array();
		$collection = array();
		try {
			$rows = $this->writer->selectRecord($type,array('id'=>$ids));
		}catch(RedBean_Exception_SQL $e) {
			if (!$this->writer->sqlStateIn($e->getSQLState(),
			array(
			RedBean_QueryWriter::C_SQLSTATE_NO_SUCH_COLUMN,
			RedBean_QueryWriter::C_SQLSTATE_NO_SUCH_TABLE)
			)) throw $e;

			$rows = false;
		}
		$this->stash = array();
		if (!$rows) return array();
		foreach($rows as $row) {
			$this->stash[$row['id']] = $row;
		}
		foreach($ids as $id) {
			$collection[ $id ] = $this->load( $type, $id );
		}
		$this->stash = NULL;
		return $collection;
	}
public function batch ( $ type , $ ids ) { if ( ! $ ids ) return array ( ) ; $ collection = array ( ) ; try { $ rows = $ this -> writer -> selectRecord ( $ type , array ( 'id' => $ ids ) ) ; } catch ( RedBean_Exception_SQL $ e ) { if ( ! $ this -> writer -> sqlStateIn ( $ e -> getSQLState ( ) , array ( RedBean_QueryWriter :: C_SQLSTATE_NO_SUCH_COLUMN , RedBean_QueryWriter :: C_SQLSTATE_NO_SUCH_TABLE ) ) ) throw $ e ; $ rows = false ; } $ this -> stash = array ( ) ; if ( ! $ rows ) return array ( ) ; foreach ( $ rows as $ row ) { $ this -> stash [ $ row [ 'id' ] ] = $ row ; } foreach ( $ ids as $ id ) { $ collection [ $ id ] = $ this -> load ( $ type , $ id ) ; } $ this -> stash = NULL ; return $ collection ; }
Returns an array of beans. Pass a type and a series of ids and
this method will bring you the correspondig beans.

important note: Because this method loads beans using the load()
function (but faster) it will return empty beans with ID 0 for
every bean that could not be located. The resulting beans will have the
passed IDs as their keys.

@param string $type type of beans
@param array  $ids  ids to load

@return array $beans resulting beans (may include empty ones)
Returns an array of beans . Pass a type and a series of ids and this method will bring you the correspondig beans .