I develop a website using cakephp. But the response time is too slow. So, I want to implement fat model and skinny controller.
But i got
Call to a member function fashionpage() on a non-object
when calling fashionpage function in controller.
I have Home model(relationship: Home hasMany Cart)
My controller:
public function fashionlist() {
$user = $this->Auth->user('id');
$counter = $this->Home->fashionpage($user);
$this->set(compact('user', 'counter'));
}
My model:
public function fashionpage($user = null) {
return $this->Home->Cart->find('count', array('conditions'=>
array('conditions'=>array('User.id'=>$user))));
}
can anyone please help me.
Homemodel. Try via$this->loadModel('Home');or$uses =array('Home');. And do @arilia fix