CakePHP Spark_plug error : Fatal error: Uncaught exception 'Exception' with message 'User::authsomeLogin() is not implemented!'
-
28-09-2019 - |
Question
I am using spark_plug in my cakephp project and I am having this error when I view my app from a guest account:
Fatal error: Uncaught exception 'Exception' with message 'User::authsomeLogin() is not implemented!'
The website works fine when I am logged in, and I have tried a lot, but still have no idea what's going wrong. Can somebody help me with this? I will be thankful.
Solution
I encountered this issue too. I found that the problem stems from associating the plugin User model with a separate model in your app without specifying the plugin prefix in the className parameter.
So for instance, I had a belongsTo association in a model in my app that looked like this:
var $belongsTo = array(
'User' => array(
'className' => 'User',
'foreignKey' => 'user_id',
'conditions' => '',
'fields' => '',
'order' => ''
)
);
Changing it to this:
var $belongsTo = array(
'User' => array(
'className' => 'SparkPlug.User',
'foreignKey' => 'user_id',
'conditions' => '',
'fields' => '',
'order' => ''
)
);
Fixed the issue.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow