php - ZF2 更改供应商模块核心类的最佳实践?

标签 php zend-framework2 zfcuser

我确实读过这个答案 ZF2, what's the best practice for working with Vendor Module's Form classes? .所以主要清楚如何更改供应商模块的可配置部分,但是如果我想在 zfcUser 模块中向实体/用户添加新功能,我该怎么办?

简而言之,我想检查用户角色,我已经添加到数据库字段,最好的方法是什么?也许我应该在其他地方做,而不是在 zfcUSer 中,如果是的话在哪里?

最佳答案

看看 ZfcUser/config/zfcuser.global.php.dist

在那里你会看到这个

/**
 * User Model Entity Class
 *
 * Name of Entity class to use. Useful for using your own entity class
 * instead of the default one provided. Default is ZfcUser\Entity\User.
 * The entity class should implement ZfcUser\Entity\UserInterface
 */
//'user_entity_class' => 'ZfcUser\Entity\User',

说明很简单,将文件复制到./config/autoload/zfcuser.global.php,确保你的实体类实现了ZfcUser\Entity\UserInterface ,取消注释该行并更改 FQCN 以匹配您要使用的实体。

关于php - ZF2 更改供应商模块核心类的最佳实践?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15618038/

相关文章:

php - 为什么prepare语句没有执行?

php - MySQL数据库搜索php问题

php - ZF2 : autoloading libraries without namespaces

php - Zend Framework 2 如何设置 Doctrine 2 代理目录

symfony - 使用 for 循环表示 Twig 中的变量

php - 从字符串中删除空格和特殊字符

zend-framework2 - Zend Framework-2 : Best way to protect all Controllers?(ZfcUser/HybridAuth)

zend-framework2 - ZfcUser 中的用户状态究竟是什么?

module - zfcUser getState 在另一个模块中

php - 解释这个 UTF-8 检测正则表达式