0

我需要一些帮助,我正在使用 mysql 和教义,一切都很完美,但现在我使用的是 Auroradb,它使用两个实例(读取器和写入器)。起初我尝试使用两个实体管理器,一个用于写入,另一个用于读取,但我遇到了 SyliusRbacBundle 的问题。

那么,有没有其他方法可以使用极光和教义????

更新 1

这是我使用丹尼尔的配置后得到的错误

通过关系“Litigon\UserBundle\Entity\User#authorizationRoles”找到了一个新实体,该实体未配置为对实体进行级联持久操作:SuperAdministrador。要解决此问题:在此未知实体上显式调用 EntityManager#persist() 或配置级联在映射中保持此关联,例如 @ManyToOne(..,cascade={"persist"})。

所以,如果我按照很多人的建议合并默认实体管理器,我会遇到极光问题,因为另一个管理器是针对读取器实例的,然后在刷新极光时说不允许写入。

4

1 回答 1

1

您需要指定模型或实体实际存在于教义配置中的位置,同样重要的是要注意 Sylius 模型通常位于组件上而不是捆绑包中。最后,但同样重要的是,只能与自动映射有一个联系:

orm:
        auto_generate_proxy_classes: "%kernel.debug%"
        default_entity_manager: default
        entity_managers:
            default:
                connection: default
                mappings:
                    loggable:
                        type: annotation
                        alias: Gedmo
                        prefix: Gedmo\Loggable\Entity
                        dir: "%kernel.root_dir%/../vendor/gedmo/doctrine-extensions/lib/Gedmo/Loggable/Entity"
                    FOSUserBundle:
                        type: xml
                        dir: Resources/config/doctrine-mapping
                        prefix: FOS\UserBundle\Model
                    SyliusRbacBundle:
                      type: xml
                      dir: Resources/config/doctrine/model
                      prefix: Sylius\Component\Rbac\Model
                    SyliusResourceBundle: ~
                    OtherBundle: ~
            writer:
                connection: writer
                mappings:
                    loggable:
                        type: annotation
                        alias: Gedmo
                        prefix: Gedmo\Loggable\Entity
                        dir: "%kernel.root_dir%/../vendor/gedmo/doctrine-extensions/lib/Gedmo/Loggable/Entity"
                    FOSUserBundle:
                      type: xml
                      dir: Resources/config/doctrine-mapping
                      prefix: FOS\UserBundle\Model
                    SyliusRbacBundle:
                        type: xml
                        dir: Resources/config/doctrine/model
                        prefix: Sylius\Component\Rbac\Model
                    SyliusResourceBundle: ~
于 2016-02-24T12:05:00.150 回答