New Community Forums are coming. Watch this space for news.
Subscribe: RSS
  • I had to upgrade to 2.6.5 for Security reasons (was 2.3.3; very old, I know).
    I get a lot of errors. I have fixed some, but I have no solution for or ideas about this one.

    I have a snippet that generates a filter for BloX:
    prepareStateFilter -- outputs --> {"state:IN":[1,2,8,12]}],[{"debtor_id:IN":[1,45,47,48,33,39,119,120,125]},{"OR:type:IN":[10]}

    I have a resource which outputs a JSON file:

    [[!If? &subject=`filter` &operator=`GT` &operand=`0` 
    &then=`[[!bloX? 
    	&packageName=`clients`
    	&classname=`requests`
    	&where=`[[!prepareStateFilter]]`
    	&tpls=`bloxouter:tplRequestOuterJson||row:tplRequestJson` 
            &outputSeparator=`,`
            &limit=`0`,
    	&debug=`0`
          ]]`


    The &where-value is dynamic:
    &where=`[[!prepareStateFilter]]`


    Since the update I get this error:

    (ERROR @ /core/model/modx/modparser.class.php : 540) Could not find snippet with name {"state:IN":[1,2,8,12]}],[{"debtor_id:IN":[1,45,47,48,33,39,119,120,125]},{"OR:type:IN":[10]}.

    I don't know how to fix this. I tried to use migxLoopCollection but that gives the wrong result when the resultarray is empty. And I am not sure if I won't get the same error as well.

    Thanks for the help,

    Erwin
    • Because my errorlog is flooding with (ERROR @ /core/model/modx/modparser.class.php : 540) Could not find snippet with name... I need some kind of quickfix. Thanks to this webpage https://sepiariver.ca/blog/modx-web/5-modx-methods-you-need-to-know-about/ I thought of the idea of using a placeholder.

      [[!prepareStateFilter? &usePlaceholder=`dynamic_where`]]
      
      [[!If? &subject=`filter` &operator=`GT` &operand=`0` 
      &then=`[[!bloX? 
          &packageName=`clients`
          &classname=`requests`
          &where=`[[+dynamic_where]]`
          &tpls=`bloxouter:tplRequestOuterJson||row:tplRequestJson` 
          &outputSeparator=`,`
          &limit=`0`,
          &debug=`0`
        ]]`
      ... (etc)
      



      This seems to do the trick. No idea of this is best practice, but this prevents the "snippet not found" error.
      I still like to know if this error is a bug or by design.