开发者

Can I use controller methods in a observer?

I need to refer to a controller method from a cache observer, How开发者_JS百科 can I make it?


If you need to do it, then something goes wrong with architecture. It breaks MVC pattern because observers bind to models, and we should call model methods from controller and not vice-versa.


an observer binds to models, at least you can write some custom code in lib, then reuse it in obsever. by the way it may depend from what you're doing

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜