我确实读过这个答案 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/