Symfony2:等价于 flush()/perist() 与 DBAL

Symfony2 : Equivalent of flush()/perist() with DBAL

我想知道是否有与 $em->persist($entity) 或 $em->flush() 等效的 DBAL?

我的意思是,DBAL 如何与实体一起工作?我正在处理不受学说处理的实体:使用 SELECT 的 DBAL 检索水合物实体的数据......,如果我必须更新数据库中的内容,我是否必须使用 DBAL insert()/update () 函数如下所述:http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/data-retrieval-and-manipulation.html ?

您知道在使用表单时记录对实体所做更改的简单方法吗?

希望我能理解,感谢您的阅读。

DBAL 中你没有实体,因为这只是 D 数据库 Abstraction Layer - 它的职责是确保当您 运行 查询时,它将在各种数据库引擎上正确地 运行。

处理实体是 Object-Relational Mapping 库的职责(比如 DoctrineORM)。

因此 DBAL 中没有 flushpersist 的等价物。要对数据库执行更新,您需要 运行 查询

$conn->executeUpdate('UPDATE user SET username = ? WHERE id = ?', array('jwage', 1))