Amazon Aurora 数据库与 Doctrine

Amazon Aurora db with Doctrine

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

那么,极光和学说还有别的用法吗?????

更新 1

这是我在使用 Daniel 的配置后得到的错误

A new entity was found through the relationship 'Litigon\UserBundle\Entity\User#authorizationRoles' that was not configured to cascade persist operations for entity: SuperAdministrador. To solve this issue: Either explicitly call EntityManager#persist() on this unknown entity or configure cascade persist this association in the mapping for example @ManyToOne(..,cascade={"persist"}).

所以,如果我像很多人建议的那样合并默认实体管理器,我会遇到 aurora 问题,因为另一个管理器是针对 reader 实例的,然后在刷新时 aurora 说那不是'不允许写。

您需要指定模型或实体在学说配置中的实际位置,同样重要的是要注意 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: ~