[英]How to extend Cakedc Users plugin to use own table in Cakephp 3
I want to extend users plugin so that i can remove username field and customize my table according to needs. 我想扩展用户插件,以便我可以删除用户名字段并根据需要自定义表格。 I have seen the github documentation for extending plugin but that doesn't help me much.
我已经看到了用于扩展插件的github文档,但这并没有太大帮助。 I tried to extend UserTable.php but it gives me error Unknown method "register".
我尝试扩展UserTable.php,但它给我错误未知方法“注册”。 Please suggest best way or simple code.
请提出最佳方法或简单代码。
Check this cloud9 environment created specifically to show how to extend the model and table as an example: https://ide.c9.io/steinkel/users-example-custom-table 检查专门创建的这个cloud9环境,以显示如何扩展模型和表格为例: https ://ide.c9.io/steinkel/users-example-custom-table
Basically changes done to use a custom table are: 使用自定义表所做的更改基本上是:
Set your table in configuration key 'Users.table' like we did in 'config/users.php' 像在“ config / users.php”中一样在配置项“ Users.table”中设置表
$config = [ 'Users' => [ //Table used to manage users 'table' => 'MyUsers', ] ]; return $config;
And you are done :) 你完成了:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.