Propel API
Class

PropelOnDemandCollection

class PropelOnDemandCollection extends PropelCollection

Class for iterating over a statement and returning one Propel object at a time

Methods

array getData()

Get the data in the collection

from PropelCollection
setData(array $data)

Set the data in the collection

from PropelCollection
int getPosition()

Gets the position of the internal pointer This position can be later used in seek()

from PropelCollection
mixed getFirst()

Move the internal pointer to the beginning of the list And get the first element in the collection

from PropelCollection
boolean isFirst()

Check whether the internal pointer is at the beginning of the list

from PropelCollection
mixed getPrevious()

Move the internal pointer backward And get the previous element in the collection

from PropelCollection
mixed getCurrent()

Get the current element in the collection

from PropelCollection
mixed getNext()

Move the internal pointer forward And get the next element in the collection

from PropelCollection
mixed getLast()

Move the internal pointer to the end of the list And get the last element in the collection

from PropelCollection
boolean isLast()

Check whether the internal pointer is at the end of the list

from PropelCollection
boolean isEmpty()

Check if the collection is empty

from PropelCollection
boolean isOdd()

Check if the current index is an odd integer

from PropelCollection
boolean isEven()

Check if the current index is an even integer

from PropelCollection
mixed get(mixed $key)

Get an element from its key Alias for ArrayObject::offsetGet()

from PropelCollection
mixed pop()

Pops an element off the end of the collection

from PropelCollection
mixed shift()

Pops an element off the beginning of the collection

from PropelCollection
prepend($value)

set(mixed $key, mixed $value)

Add an element to the collection with the given key Alias for ArrayObject::offsetSet()

from PropelCollection
mixed remove(mixed $key)

Removes a specified collection element Alias for ArrayObject::offsetUnset()

from PropelCollection
array clear()

Clears the collection

from PropelCollection
boolean contains(mixed $element)

Whether or not this collection contains a specified element

from PropelCollection
mixed search(mixed $element)

Search an element in the collection

from PropelCollection
serialize()

unserialize($data)

getIterator()

getInternalIterator()

from PropelCollection
clearIterator()

Clear the internal Iterator.

from PropelCollection
setModel(string $model)

Set the model of the elements in the collection

from PropelCollection
string getModel()

Get the model of the elements in the collection

from PropelCollection
string getPeerClass()

Get the peer class of the elements in the collection

from PropelCollection
setFormatter(PropelFormatter $formatter)

from PropelCollection
getFormatter()

from PropelCollection
PropelPDO getConnection(string $type = Propel::CONNECTION_READ)

Get a connection object for the database containing the elements of the collection

from PropelCollection
BaseObject importFrom(mixed $parser, string $data)

Populate the current collection from a string, using a given parser format <code> $coll = new PropelObjectCollection(); $coll->setModel('Book'); $coll->importFrom('JSON', '{{"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}}'); </code>

from PropelCollection
string exportTo(mixed $parser)

Export the current collection to a string, using a given parser format <code> $books = BookQuery::create()->find(); echo $book->exportTo('JSON'); => {{"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}}'); </code>

from PropelCollection
__call($name, $params)

Catches calls to undefined methods.

from PropelCollection
__toString()

Returns a string representation of the current collection.

from PropelCollection
initIterator(PropelFormatter $formatter, PDOStatement $stmt)

offsetExists($offset)

offsetGet($offset)

offsetSet($offset, $value)

offsetUnset($offset)

int count()

Returns the number of rows in the resultset Warning: this number is inaccurate for most databases.

append($value)

asort()

exchangeArray($input)

getArrayCopy()

getFlags()

ksort()

natcasesort()

natsort()

setFlags($flags)

uasort($cmp_function)

uksort($cmp_function)

Details

in PropelCollection at line 41
public array getData()

Get the data in the collection

Return Value

array

in PropelCollection at line 51
public setData(array $data)

Set the data in the collection

Parameters

array $data

in PropelCollection at line 62
public int getPosition()

Gets the position of the internal pointer This position can be later used in seek()

Return Value

int

in PropelCollection at line 73
public mixed getFirst()

Move the internal pointer to the beginning of the list And get the first element in the collection

Return Value

mixed

in PropelCollection at line 84
public boolean isFirst()

Check whether the internal pointer is at the beginning of the list

Return Value

boolean

in PropelCollection at line 95
public mixed getPrevious()

Move the internal pointer backward And get the previous element in the collection

Return Value

mixed

in PropelCollection at line 111
public mixed getCurrent()

Get the current element in the collection

Return Value

mixed

in PropelCollection at line 122
public mixed getNext()

Move the internal pointer forward And get the next element in the collection

Return Value

mixed

in PropelCollection at line 134
public mixed getLast()

Move the internal pointer to the end of the list And get the last element in the collection

Return Value

mixed

in PropelCollection at line 150
public boolean isLast()

Check whether the internal pointer is at the end of the list

Return Value

boolean

in PropelCollection at line 166
public boolean isEmpty()

Check if the collection is empty

Return Value

boolean

in PropelCollection at line 176
public boolean isOdd()

Check if the current index is an odd integer

Return Value

boolean

in PropelCollection at line 186
public boolean isEven()

Check if the current index is an even integer

Return Value

boolean

in PropelCollection at line 199
public mixed get(mixed $key)

Get an element from its key Alias for ArrayObject::offsetGet()

Parameters

mixed $key

Return Value

mixed The element

in PropelCollection at line 212
public mixed pop()

Pops an element off the end of the collection

Return Value

mixed The popped element

in PropelCollection at line 228
public mixed shift()

Pops an element off the beginning of the collection

Return Value

mixed The popped element

at line 97
public prepend($value)

Parameters

$value

in PropelCollection at line 264
public set(mixed $key, mixed $value)

Add an element to the collection with the given key Alias for ArrayObject::offsetSet()

Parameters

mixed $key
mixed $value

in PropelCollection at line 277
public mixed remove(mixed $key)

Removes a specified collection element Alias for ArrayObject::offsetUnset()

Parameters

mixed $key

Return Value

mixed The removed element

in PropelCollection at line 290
public array clear()

Clears the collection

Return Value

array The previous collection

in PropelCollection at line 302
public boolean contains(mixed $element)

Whether or not this collection contains a specified element

Parameters

mixed $element the element

Return Value

boolean

Search an element in the collection

Parameters

mixed $element

Return Value

mixed Returns the key for the element if it is found in the collection, FALSE otherwise

at line 67
public serialize()

at line 72
public unserialize($data)

Parameters

$data

at line 32
public getIterator()

in PropelCollection at line 349
public getInternalIterator()

in PropelCollection at line 363
public clearIterator()

Clear the internal Iterator.

PHP 5.3 doesn't know how to free a PropelCollection object if it has an attached
Iterator, so this must be done manually to avoid memory leaks.

See also

http://www.propelorm.org/ticket/1232

in PropelCollection at line 375
public setModel(string $model)

Set the model of the elements in the collection

Parameters

string $model Name of the Propel object classes stored in the collection

in PropelCollection at line 385
public string getModel()

Get the model of the elements in the collection

Return Value

string Name of the Propel object class stored in the collection

in PropelCollection at line 395
public string getPeerClass()

Get the peer class of the elements in the collection

Return Value

string Name of the Propel peer class stored in the collection

in PropelCollection at line 403
public setFormatter(PropelFormatter $formatter)

Parameters

PropelFormatter $formatter

in PropelCollection at line 408
public getFormatter()

in PropelCollection at line 420
public PropelPDO getConnection(string $type = Propel::CONNECTION_READ)

Get a connection object for the database containing the elements of the collection

Parameters

string $type The connection type (Propel::CONNECTION_READ by default; can be Propel::connection_WRITE)

Return Value

PropelPDO a connection object

in PropelCollection at line 441
public BaseObject importFrom(mixed $parser, string $data)

Populate the current collection from a string, using a given parser format <code> $coll = new PropelObjectCollection(); $coll->setModel('Book'); $coll->importFrom('JSON', '{{"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}}'); </code>

Parameters

mixed $parser A PropelParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV')
string $data The source data to import from

Return Value

BaseObject The current object, for fluid interface

in PropelCollection at line 461
public string exportTo(mixed $parser)

Export the current collection to a string, using a given parser format <code> $books = BookQuery::create()->find(); echo $book->exportTo('JSON'); => {{"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}}'); </code>

Parameters

mixed $parser A PropelParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV')

Return Value

string The exported data

in PropelCollection at line 474
public __call($name, $params)

Catches calls to undefined methods.

Provides magic import/export method support (fromXML()/toXML(), fromYAML()/toYAML(), etc.).
Allows to define default __call() behavior if you use a custom BaseObject

Parameters

$name
$params

in PropelCollection at line 490
public __toString()

Returns a string representation of the current collection.

Based on the string representation of the underlying objects, defined in
the Peer::DEFAULT_STRING_FORMAT constant

at line 25
public initIterator(PropelFormatter $formatter, PDOStatement $stmt)

Parameters

PropelFormatter $formatter
PDOStatement $stmt

at line 39
public offsetExists($offset)

Parameters

$offset

at line 47
public offsetGet($offset)

Parameters

$offset

at line 55
public offsetSet($offset, $value)

Parameters

$offset
$value

at line 60
public offsetUnset($offset)

Parameters

$offset

at line 85
public int count()

Returns the number of rows in the resultset Warning: this number is inaccurate for most databases.

Do not rely on it for a portable application.

Return Value

int number of results

at line 92
public append($value)

Parameters

$value

at line 102
public asort()

at line 107
public exchangeArray($input)

Parameters

$input

at line 112
public getArrayCopy()

at line 117
public getFlags()

at line 122
public ksort()

at line 127
public natcasesort()

at line 132
public natsort()

at line 137
public setFlags($flags)

Parameters

$flags

at line 142
public uasort($cmp_function)

Parameters

$cmp_function

at line 147
public uksort($cmp_function)

Parameters

$cmp_function