• support@answerspoint.com

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...




Can using in View same in Controller:

    App::import('Model', 'Department');
    $this->Department = new Department();
    $users = $this->Department->getUserOfDepartment($id);
  • answered 5 years ago
  • G John


No, it goes against the whole point of the framework and core MVC principles.

Just don't do it.

  • answered 5 years ago
  • Gul Hafiz

Your Answer

    Facebook Share        
  • asked 6 years ago
  • viewed 1521 times
  • active 6 years ago

Hot Questions