xPDO.getCollection

xPDO::getCollection

Retrieves a collection of xPDOObjects by the specified xPDOCriteria.

If none are found, returns an empty array.

Syntax

API Docs: http://api.modxcms.com/xpdo/xPDO.html#getCollection

array|null getCollection (string $className, [object|array|string $criteria = null], [mixed $cacheFlag = true])

Example

Get a collection of Box objects with a width of 40.

$boxes = $xpdo->getCollection('Box',array(
   'width' => 40,
));

See Also

Suggest an edit to this page on GitHub (Requires GitHub account. Opens a new window/tab) or become an editor of the MODX Documentation.