开发者

Can I use controller methods in a observer?

开发者 https://www.devze.com 2023-01-12 20:34 出处:网络
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

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

精彩评论

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