Using Parameterized Scopes From A Related Model?

I have a question regarding parameterized scopes that take an array parameter:

If I have the scope:


public function myScope($arrayParam) {

  ...

}

I can apply this successfully using:


MyModel::model()->myScope(array(4, 5, 6))->findAll();

However, if MyModel appears in a relation (e.g. ‘myRelation’) within a different model (e.g. ‘AnotherModel’), and I attempt to apply the scope using:


AnotherModel::model() -> findAll(array(

  'with' => array(

      'myRelation' => array(

         'scopes' => array('myScope' => array(4, 5, 6))

       ),

   )

));



…then this does not work. Specifically because only the first value in the array parameter (in this case, 4) reaches myScope.

My relation is written correctly and as far as I understand the construction of the query is correct, so what am I doing wrong here?

you must pass ARRAY of parameters to scope function, and your param is another array - so it should be array with another array as first element:




AnotherModel::model() -> findAll(array(

  'with' => array(

      'myRelation' => array(

         'scopes' => array('myScope' => array(array(4, 5, 6)))

       ),

   )

));



This worked - thanks!