Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call to undefined method app\models\User::find() #18

Open
arjenmeijer opened this issue Jan 24, 2015 · 6 comments
Open

Call to undefined method app\models\User::find() #18

arjenmeijer opened this issue Jan 24, 2015 · 6 comments

Comments

@arjenmeijer
Copy link

Thank you for writing this module. It gives me a great example for my own project. I am learning a lot of it.

However, I do have problem.
If I lookup an answer I get the error:
Call to undefined method app\models\User::find()

Everything else is working fine.

On http://www.yiiframework.com/forum/index.php/topic/58356-call-to-undefined-method-appmodelsuserfind/
the answer is to: Try extending from yii\db\ActiveRecord instead.

That do I have to change in the code to solve this problem?

My config is:

    'qa' => 'artkost\qa\Module',
    'userClass' => 'dektrium\user\Module', 
    'userNameFormatter' => 'getUserName'

That is I am using the dektrium user class.

@JiLiZART
Copy link
Member

You have a typo in config, you need use ' \dektrium\user\models\User' class and need point same class for 'user' component. For ex:

'user' => [
    'identityClass' => ' \dektrium\user\models\User' 
]

@arjenmeijer
Copy link
Author

Thank you for the response. However, it still does not work.
On edit I get this error:

Call to undefined method app\models\User::find()

But there is not app\models\User entry in the config anymore.

My 'complete' user config is:
'modules' => [
'user' => [
'class' => 'dektrium\user\Module',
...
'modelMap' => ['User' => 'dektrium\user\models\User'],
],
'qa' => 'artkost\qa\Module',
'userClass' => 'dektrium\user\models\User',
'userNameFormatter' => 'getUserName'
],
'components' => [
'user' => [
'identityClass' => ' \dektrium\user\models\User',
'enableAutoLogin' => true,
],

And now I am lost. What do I have to change to get artkost working?

@JiLiZART
Copy link
Member

Thanks, i check it soon

@Benn
Copy link

Benn commented Sep 16, 2017

Hello,
@arjenmeijer : I'm having the exact same issue on edit. Did you end up solving the issue ?

Cheers

@arjenmeijer
Copy link
Author

No. I stopped using this module.

@sashadp
Copy link

sashadp commented May 20, 2019

If you use dektrium you need:
use app\models\User;
change to
use dektrium\user\models\User;
in your controller.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants