我尝试安装Sonata用户软件包但在执行命令
时遇到配置问题app/console sonata:easy-extends:generate SonataUserBundle -d src
git bash显示此错误:
[Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException]
The service "sonata.user.orm.group_manager" has a dependency on a non-exist
ent parameter "fos_user.model.group.class". Did you mean this: "fos_user.mo
del.user.class"?
答案 0 :(得分:4)
在您的配置中,您必须具备以下条件:
# app/config/sonata/user.yml or app/config/config.yml
fos_user:
db_driver: orm # can be orm or odm
firewall_name: main
user_class: FOS\UserBundle\Entity\User #Default configuration
# ...
group:
group_class: FOS\UserBundle\Entity\Group
group_manager: sonata.user.orm.group_manager
您可以自己替换FOSUserBundle实体。
答案 1 :(得分:0)
您必须安装和配置FOSUserBundle,因为SonataUserBundle是用于将FOSUserBundle集成到SonataProject中的捆绑包。
您可以阅读此安装文档以了解:SonataUserBundle Install
你有没有注意到你的AppKernel.php文件中的FosUserBundle:
public function registerbundles()
{
return array(
new Sonata\CoreBundle\SonataCoreBundle(),
new Sonata\BlockBundle\SonataBlockBundle(),
new Sonata\EasyExtendsBundle\SonataEasyExtendsBundle(),
// ...
// You have 2 options to initialize the SonataUserBundle in your AppKernel,
// you can select which bundle SonataUserBundle extends
// Most of the cases, you'll want to extend FOSUserBundle though ;)
// extend the ``FOSUserBundle``
new FOS\UserBundle\FOSUserBundle(),
new Sonata\UserBundle\SonataUserBundle('FOSUserBundle'),
// OR
// the bundle will NOT extend ``FOSUserBundle``
new Sonata\UserBundle\SonataUserBundle(),
// ...
);
}