Jump to main content Jump to doc navigation

xPDOObject::getMany()

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

Syntax

API Docs: http://api.modx.com/revolution/2.2/db_core_xpdo_om_xpdoobject.class.html#%5CxPDOObject::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