getMany

xPDOObject::getMany()

Gets a collection of objects related by aggregate or composite relations.

Syntax

API Docs: http://api.modxcms.com/xpdo/om/xPDOObject.html#getMany

array &getMany (
   string $alias,
   [object $criteria = null],
   [boolean|integer $cacheFlag = true]
)

Example

Get all the Chunks in a Category and output their names.

$category = $xpdo->getObject('Category',1);
$chunks = $category->getMany('Chunk');
foreach ($chunks as $chunk) {
   echo $chunk->get('name').'<br />';
}

See Also

Suggest an edit to this page on GitHub (Requires GitHub account. Opens a new window/tab).