我需要一些帮助,我正在使用mysql和doctrine,一切都很完美,但现在我正在使用使用两个实例(读取器和写入器)的Auroradb。起初我尝试使用两个实体管理器,一个用于写入,另一个用于读取,但是SyliusRbacBundle遇到了问题。
那么,有没有另一种方式来使用极光和教义呢?????
更新 1
这是我在使用丹尼尔的配置后得到的错误
通过关系"Litigon\UserBundle\Entity\User#authorizationRoles"找到一个新实体,该实体未配置为级联实体:SuperAdministrador的持久操作。要解决此问题:在此未知实体上显式调用 EntityManager#persist(),或者配置级联在映射中保留此关联,例如 @ManyToOne(..,cascade={"persist"})。
因此,如果我像很多人建议的那样合并默认实体管理器,我会遇到 Aurora 的问题,因为另一个管理器是针对读取器实例的,然后在刷新时 Aurora 说不允许写入。
您需要指定模型或实体在 doctrine 配置中的实际位置,同样重要的是要注意 Sylius 模型通常位于组件上而不是在捆绑包中。最后,但并非最不重要的是,只能有一个与自动映射的连接:
orm:
auto_generate_proxy_classes: "%kernel.debug%"
default_entity_manager: default
entity_managers:
default:
connection: default
mappings:
loggable:
type: annotation
alias: Gedmo
prefix: GedmoLoggableEntity
dir: "%kernel.root_dir%/../vendor/gedmo/doctrine-extensions/lib/Gedmo/Loggable/Entity"
FOSUserBundle:
type: xml
dir: Resources/config/doctrine-mapping
prefix: FOSUserBundleModel
SyliusRbacBundle:
type: xml
dir: Resources/config/doctrine/model
prefix: SyliusComponentRbacModel
SyliusResourceBundle: ~
OtherBundle: ~
writer:
connection: writer
mappings:
loggable:
type: annotation
alias: Gedmo
prefix: GedmoLoggableEntity
dir: "%kernel.root_dir%/../vendor/gedmo/doctrine-extensions/lib/Gedmo/Loggable/Entity"
FOSUserBundle:
type: xml
dir: Resources/config/doctrine-mapping
prefix: FOSUserBundleModel
SyliusRbacBundle:
type: xml
dir: Resources/config/doctrine/model
prefix: SyliusComponentRbacModel
SyliusResourceBundle: ~