Closed TheMiller2015 closed 8 years ago
Index action triggers "beforePaginate" event not "beforeFind" so use that to modify the query. The "findMethod" option doesn't support extra options.
findMethod
is just quick way to change custom finder, relic from cake 2.x - today beforePaginate / beforeFind seems more sane to use imo
Thank you all for your answers. Will the beforePaginate triggered even when my index method dorsn't call paginated? Will this be right right way nevertheless?
I'm agree with @TheMiller2015, it would be great to pass args to the findMethod !
Hello,
I start using CRUD. In an index-action I want to use a custom finder. So I tried to modify the query with the onBeforeFind, but this event isn't triggered (idk why). So I read through the docs and found findMethod(). My TableObject has a custom finder which only retrieves the records the user-x owns. Therefore, I pass the User-ID with $options while calling the finder manually. That works. But how do I pass the User-ID via the CRUDs findMethod()? I don't want to use the Auth-Component within the TableObject and "hardcode" the origin of the user-id. I hope, you understand what I mean. If there is no possibility to pass an argument for findMethod - would this be an idea for improvement in the upcoming versions?
Thanks