我创建并持久化(不刷新)数据以确保交易。但是->getId()
返回NULL,而MySql最初可以在事务
答案 0 :(得分:1)
它将为null,但在Flush
doctrine将正确处理所有关系。
For the most part, Doctrine 2 already takes care of proper transaction demarcation for you: All the write operations (INSERT/UPDATE/DELETE) are queued until EntityManager#flush() is invoked which wraps all of these changes in a single transaction.