Hi Brian, thank you for clearifing the difference between queryData in this both contextes, Behavior and Model. In this case, i need to use i in behavior context.
Can i do conditions there as well? If this is the case, how? (e.g., discard the given queryData and return an queryData-Strucure as array, or making an conditions entry in the given queryData-object- structure at a specific place....) Thanks for an hint again! Sam On 13 Aug., 11:37, brian <[email protected]> wrote: > On Thu, Aug 13, 2009 at 8:14 AM, subnoodle<[email protected]> wrote: > > > Hello, > > i'd like to add "ownership-support" in models in general way. > > > So, i put some filtering in beforeFind, first. > > SInce i regognized, that parameter $queryData does not work as > > expected. > > > In CakeDoc is described, that queryData is an arrray of find- > > parameters. But is 's actually the model object itself. > > No, in Model::beforeFind() the first (and only) param is the query > options array. The Behavior's beforeFind(), however, takes the model > as the 1st param. But this is something that Model takes care of when > it triggers beforeFind from find(). You don't have to pass the model > yourself. > > > So, adding 'conditions' to queryData does not work, additionally > > $queryData->conditions is an unknown property. > > $queryData is an array, not an object. You want to do > $queryData['conditions'] = array(...) > > Although there may already be conditions: > > function beforeFind)$queryData) > { > if (!isset($queryData['conditions'])) { > $queryData['conditions'] = array(); > } > > $queryData['conditions'][$model->alias.'.YOUR_FIELD' = > 'YOUR_CONDITION'; > > return $queryData; > > } > > So, my questions are: > > a) Can i cope queryData to filter via 'conditions' > > b) Can i achive filtering also in model relations (belogs to, etc.) > > and how? (I think, the join will be generated without the filter of > > the secondary table) > > c) Can i achive filtering in selectboxes of view in related tables? > > ==> And this all in only one behavior? > > > Thanks a lot, Sam --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
