We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 39653
    • 13 Posts
    Hey all,

    I use getResources quite a bit, and i ran into an something that i'm curious if people can explain something.

    I have a bunch of getResources call that look a lot like this:

    $params = array(
    'limit'=>'1',
    'parents' => '143',
    'context' => 'web',
    'resources'=>$resourceList,
    'includeTVs' => true,
    'includeContent' => true,
    'tpl' => 'articlelist.tpl'
    );

    When you set debug to true for the getResources call, the query that gets run includes a section like this: modResource.parent IN (list of parents from above, plus the ids of all the children of that parent) then an OR of the resources in the list.


    I have a couple of questions:

    1. if I am supplying a list of resources to include, and a parent(s) to include, what's the logic behind also including the child id's of the parents that are specified?
    2. Should it be an OR of parents and the resource list? Seems that if a resource list is included, that should constrain the set to only the things in that list.

    I ran into an issue when using getResources from a cron job. If you specify a resource list, but not a parent, the getResources query includes EVERY resource in the parent list. (this seems bad..)

    Note: I know the easy solution is to include a parent. that does solve my problem..