How to filter by template, avoiding using a foreach later?
$parentIDs = $modx->getParentIds($resID, 2, array('context' => 'web', 'published' => true, 'template' => 2)); //doesn't work
----------------------------------
canale irc Italiano #modx server: tophost.azzurra.org
discuss.answer
As far, as I can tell, 'context' is the only key, which you can send with the options-array.
But you can put the result into a new query for addional filtering.
$parentIDs = $modx->getParentIds($resID, 2, array('context' => 'web'));
$ids = array();
if ($collection = $modx->getCollection('modResource',array('id:IN'=>$parentIDs,'template'=>2,'published'=>1))){
foreach ($collection as $object){
$ids[] = $object->get('id');
}
}
As I suspected. it's a shame..
thank you Bruno
----------------------------------
canale irc Italiano #modx server: tophost.azzurra.org