简体   繁体   English

fos_user配置的两个不同的user_class

[英]Two different user_class for fos_user configuration

I have web site based on Symfony 3.4 and Sonata Admin with SonataNews Bundle, SonataUser bundle etc. Everything works fine. 我有一个基于Symfony 3.4和Sonata Admin以及SonataNews Bundle,SonataUser bundle等的网站。一切正常。

Now my customer wants web shop, and I choose aimeos for symfony. 现在我的客户想要网上商店,我选择aimeos作为symfony。 Now the problem is with users. 现在问题出在用户身上。 In fos_user I have: 在fos_user中,我有:

 fos_user:
    db_driver: orm # other valid values are 'mongodb' and 'couchdb'
    firewall_name: main
    #user_class: Sonata\UserBundle\Entity\BaseUser
    user_class: Application\Sonata\UserBundle\Entity\User

    group:
        group_class:   Application\Sonata\UserBundle\Entity\Group
        group_manager: sonata.user.orm.group_manager # If you're using doctrine orm (use sonata.user.mongodb.group_manager for mongodb)

    service:
        user_manager: sonata.user.orm.user_manager

    from_email:
        address: "example@example.com"
        sender_name: "My website"

but Aimeos wants configuration like this: 但是Aimeos想要这样的配置:

fos_user:
    db_driver: orm
    user_class: Aimeos\ShopBundle\Entity\FosUser
    firewall_name: aimeos_myaccount
    from_email:
        address: "me@example.com"
        sender_name: "Test shop"

different firewall and user_class. 不同的防火墙和user_class。 If I change this, then there are problems with sonata admin, because some sonata bundles use SonataUserBundle, like News bundle for example. 如果我更改此设置,则Sonata admin会出现问题,因为某些奏鸣曲捆绑包使用SonataUserBundle,例如新闻捆绑包。 Without user_class: Aimeos\\ShopBundle\\Entity\\FosUser, aimeos doesn't work. 如果没有user_class:Aimeos \\ ShopBundle \\ Entity \\ FosUser,则aimeos不起作用。

My question is: Is it possible (and how) to tell Aimeos to use SonataUserBundle? 我的问题是:是否有可能(以及如何)告诉Aimeos使用SonataUserBundle? Or somehow extend this classes? 还是以某种方式扩展了此类?

扩展Sonata用户实体类,并从Aimeos FosUser实体类添加其他属性的代码

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM