Modx getMany where?


I am trying to use the getMany method on an object to get its relations, but only if they fit between a date range?

I would have thought it would be something like this, but I cannot find any information online:

$object->getMany(‘Relation’, [
‘date:>’ => ‘2021-12-12 00:00:00’

Any help would be very appreciated!

Many thanks

I think you should be able to do something like this:

$c = $modx->newQuery('xy');
	'date:>' => '2021-12-12 00:00:00'
$relations = $object->getMany('Relation', $c);
1 Like

Thanks mate,

I got it working in the end, I was actually being a bit silly.

$collection = $modx->getCollection('Collection');

foreach ($collection as $object) {
    $relation = $object->getMany('Relation', [
        'date:>' => '2021-12-12 00:00:00'

I was so caught up in not being able to find this in the docs that i forgot to actually loop the collection haha!