目前,我有两个数据库(一个是MySQL数据库,一个是SQLite数据库)。我只对两个日志实体使用SQLite数据库,这两个日志实体需要与主(MySQL)数据库保持分离。是否有可能只使用这两个实体更新SQLite数据库,而不对MySQL数据库进行任何操作?我找不到任何命令。
然而,我发现了以下选项:
尽管这些解决方案解决了问题,但它们并不是真正的最佳方案。是否有可能只更新某个实体管理器的特定实体?
发布于 2017-10-09 22:16:23
在您的配置中声明两个实体管理器之后,我们可以这样做。
orm:
default_entity_manager: <your_mysql_em>
entity_managers:
mysql_em:
connection: <mysql_connection_name>
mappings:
AppBundle:
type: 'annotation'
dir: 'Entity/'
logger_em:
connection: <sqlite_connection_name>
mappings:
AppBundle:
type: 'annotation'
dir: 'Logger/Entity'
可以选择em更新架构之后:
app/console doctrine:schema:update --em logger_em
https://stackoverflow.com/questions/46651740
复制相似问题