\RedBeanPHPBeanCollection

BeanCollection.

The BeanCollection represents a collection of beans and makes it possible to use database cursors. The BeanCollection has a method next() to obtain the first, next and last bean in the collection. The BeanCollection does not implement the array interface nor does it try to act like an array because it cannot go backward or rewind itself.

Use the BeanCollection for large datasets where skip/limit is not an option. Keep in mind that ID-marking (querying a start ID) is a decent alternative though.

Summary

Methods
Properties
Constants
__construct()
next()
reset()
close()
No public properties found
No constants found
No protected methods found
$cursor
$repository
$type
N/A
No private methods found
No private properties found
N/A

Properties

$type

$type : string

Type

string

Methods

__construct()

__construct(string  $type, \RedBeanPHP\Repository  $repository, \RedBeanPHP\Cursor  $cursor) : void

Constructor, creates a new instance of the BeanCollection.

Parameters

string $type

type of beans in this collection

\RedBeanPHP\Repository $repository

repository to use to generate bean objects

\RedBeanPHP\Cursor $cursor

cursor object to use

next()

next() : \RedBeanPHP\OODBBean|NULL

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.

Returns

\RedBeanPHP\OODBBean|NULL

reset()

reset() : void

Resets the collection from the start, like a fresh() on a bean.

close()

close() : void

Closes the underlying cursor (needed for some databases).