• support@answerspoint.com

Cakephp 2 call a model function from view

2745

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

2Answer


0

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

0

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

    Facebook Share        
       
  • asked 9 years ago
  • viewed 2745 times
  • active 9 years ago

Best Rated Questions