有没有办法在实体管理器(doctrine)中手动指定symfony2中的事务,或者是在单个事务中完成我在下面做的两个事情的一种自然方式?Transactions和symfony2实体管理器
// creating screen object...
//Creating user object...
//flush the screen into database in order to get the Id to relate the server (user) to
$em->persist($screen);
$em->flush();
//Get id of just inserted screen and attach that to new server (user)
$tempRecordId = $screen->getId();
$tempEntity = $em->getRepository('BizTVContainerManagementBundle:Container')->find($tempRecordId);
$entity->setScreen($tempEntity);
//Flush the user also into database
$em->persist($entity);
$em->flush();
见我必须刷新我的第一个实体,以获取它的ID了,所以我可以与我的第二个实体给我的第一...
不知道这是那么简单!我想我会让它变得比它需要的更复杂! – 2012-08-17 19:56:09