开发者

How do I track my parent find function call in beforeFind() for CakePHP

I am currently using CakePHP beforeFind() to filter my search queries based on the current logged in user. It seems great at the moment and everything is working smoothly, the only problem is that I need to know where the find function was initially called so that I can apply different query filters based on the parent find function call; is there anyway开发者_StackOverflow中文版 to achieve that?


That seems like coupling your models to your controllers/actions, which in general is a bad idea.

Try creating a custom method in your model instead. You can have whatever method signature you need, and just call find from within and return its results as needed.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜