Friday, February 8, 2013

Plugin Query / Find Fails

I am having problems pulling User data in my plugin and cannot figure out why. If I run the same code in the controller it returns the data, but if I try to access it thru the model find method it fails.

 

In the UserController:

 

$model_find = $this->User->findUser($id = '510324ea-f78c-4ff6-a5e9-11c479ea19b9'); <- this results in
Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'findUser' at line 1

 

Yet if I run the same code as in the findUser() in the controller directly it works as expected.

 

/*$controller_find = $this->User->find('first', array(

                'conditions' => array(

                                'User.id' => '510324ea-f78c-4ff6-a5e9-11c479ea19b9')));*/

 

 

UserModel:

 

public function findUser($id){

                return $this->find('first', array(

                                'conditions' => array(

                                                'id' => $id)));

}

 

Any ideas where I am going wrong here?

 

Thanks,

 

Dave

 

 

No comments: