type = $type; $this->cursor = $cursor; $this->repository = $repository; } /** * Returns the next bean in the collection. * If called the first time, this will return the first bean in the collection. * If there are no more beans left in the collection, this method * will return NULL. * * @return OODBBean|NULL */ public function next() { $row = $this->cursor->getNextItem(); if ( $row ) { $beans = $this->repository->convertToBeans( $this->type, array( $row ) ); $bean = array_shift( $beans ); return $bean; } return NULL; } /** * Closes the underlying cursor (needed for some databases). * * @return void */ public function close() { $this->cursor->close(); } }