We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28984
    • 6 Posts
    Is it possible to get a collection of objects filtered by template variable values which come from different template variables. I am trying to do this with getCollectionGraph with no success:
    $objects = $modx->getCollectionGraph('modResource', '{"TemplateVarResources":{}}' , array(
      'TemplateVarResources.value' => '1991', /* "1991" is a value from "YearsTV" template variable */
      'TemplateVarResources.value' => 'Peter', /* "Peter" is a value from "NameTV" template variable */
      ));
    

    I had tried with
    'TemplateVarResources.value:AND' => array('1991', 'Peter')
    but had no success too.
    Any idea?
    Thanks a lot.
      Apache 2.0.63 (MacOS X)
      PHP Version 5.2.13
      MySQL 5.1.44
      MODx Revolution 2.0.8-pl (traditional)

      Made By Many
      • 28984
      • 6 Posts
      When I do this:
      $objects = $modx->getCollectionGraph('modResource', '{"TemplateVarResources":{}}' , array(
        'TemplateVarResources.value:IN' => array('1991', 'Peter')
        ));
      

      I get all the resources that have value "1991" plus all the resources that have value "Peter". This values come from different template variables ("YearsTV" and "PersonsTV").
      What should I do to get only the resources that have the both values ( a resources that have a template variable ’YearsTV’ with a value set to ’1991’ and a template variable ’PersonsTV’ with a value set to ’Peter’.
      Any help would be appreciated.
      Thanks.
        Apache 2.0.63 (MacOS X)
        PHP Version 5.2.13
        MySQL 5.1.44
        MODx Revolution 2.0.8-pl (traditional)

        Made By Many