• 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 7 years ago
  • G John


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

Just don't do it.

  • answered 7 years ago
  • Gul Hafiz

Your Answer

    Facebook Share        
  • asked 8 years ago
  • viewed 2464 times
  • active 8 years ago

Best Rated Questions