Here is an example.php on the Web:

...
$page = new SomeEntity();
$page->setName("xx");  // name is primary key
$em->persist($page);
....

Question: what would happen, when example2.php asks:

$result = $em->find('SomeEntity', 'xx');

? null or object $page?

I'm assuming example.php is still running and didn't call $em->flush() yet.

Edit:

Maybe it's also decisive how I call $em:

$em = \Zend_Controller_Front::getInstance()->getParam('bootstrap')->getResource('doctrine');
有帮助吗?

解决方案

Until no flush operation has been performed, data is not persisted. Therefore, data is not shared with other processes.

Your $result variable will be null.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top