X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fgabordemooij%2Fredbean%2FRedBeanPHP%2FBeanCollection.php;fp=vendor%2Fgabordemooij%2Fredbean%2FRedBeanPHP%2FBeanCollection.php;h=25ab5017ef593da7faa783c42603b61e0dee2922;hp=0000000000000000000000000000000000000000;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad diff --git a/vendor/gabordemooij/redbean/RedBeanPHP/BeanCollection.php b/vendor/gabordemooij/redbean/RedBeanPHP/BeanCollection.php new file mode 100644 index 000000000..25ab5017e --- /dev/null +++ b/vendor/gabordemooij/redbean/RedBeanPHP/BeanCollection.php @@ -0,0 +1,92 @@ +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(); + } +}