[英]CAKEPHP SQLSTATE[42S02]: Base table or view not found: 1146 Table 'cms_database.users' doesn't exist. iam using cakephp 4
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'cms_database.users' doesn't exist SQLSTATE [42S02]:未找到基表或视图:1146 表“cms_database.users”不存在
Could this be caused by using Auto-Tables?这可能是由使用自动表引起的吗? Some of the Table objects in your application were created by instantiating "Cake\ORM\Table" instead of any other specific subclass.您的应用程序中的某些 Table 对象是通过实例化“Cake\ORM\Table”而不是任何其他特定子类来创建的。
This could be the cause for this exception.这可能是此异常的原因。 Auto-Tables are created for you under the following circumstances:在以下情况下会为您创建自动表:
The class for the specified table does not exist.指定表的 class 不存在。 The Table was created with a typo: $this->getTableLocator()->get('Atricles');该表是用错字创建的: $this->getTableLocator()->get('Atricles'); The class file has a typo in the name or incorrect namespace: class Atricles extends Table The file containing the class has a typo or incorrect casing: Atricles.php The Table was used using associations but the association has a typo: $this->belongsTo('Atricles') The table class resides in a Plugin but no plugin notation was used in the association definition. The class file has a typo in the name or incorrect namespace: class Atricles extends Table The file containing the class has a typo or incorrect casing: Atricles.php The Table was used using associations but the association has a typo: $this->belongsTo ('Atricles') 表 class 驻留在插件中,但在关联定义中未使用插件符号。
Please try correcting the issue for the following table aliases:请尝试更正下表别名的问题:
Users用户
Thanks for your concern..感谢你的关心..
I solved my error..我解决了我的错误..
I place this resolver method code in my Application.php file to change default users table to admins table.我将此解析器方法代码放在我的 Application.php 文件中,以将默认用户表更改为管理员表。 here is the code-这是代码-
$authenticationService->loadIdentifier('Authentication.Password', [
'fields' => [
'username' => 'username',
'password' => 'password',
],
'resolver' => [
'className' => 'Authentication.Orm',
'userModel' => 'Admins',
]
]);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.