Cakephp 2 call a model function from view
is it possible to call a model function directly from a view in Cakephp 2? I know I could call it from controller and set the value to the view, but if I could call it in the view it would be better...
Thanks
cakephp
- asked 9 years ago
- G John
2Answer
Can using in View same in Controller:
App::import('Model', 'Department');
$this->Department = new Department();
$users = $this->Department->getUserOfDepartment($id);
- answered 8 years ago
- G John
No, it goes against the whole point of the framework and core MVC principles.
Just don't do it.
- answered 8 years ago
- Gul Hafiz
Your Answer