我一直试图让我的学说2设置为模块化结构。尝试创建实体时收到此错误:
Entity has to be managed for single computation Entities\User@0000000078d19339000000004266cb59
代码:
/* Test Doctrine */
$em = Zend_Registry::get('em');
$user = new Entities\User();
$user->name = "Bob";
$user->username = "bob";
$user->email = "bob@live.com";
$user->password = "test";
$user->activation = "";
$em->flush($user);
$em->persist();
答案 0 :(得分:6)
上帝该死的......
我很尴尬自己!这是一个黄金法则问题......修复:
/* Test Doctrine */
$em = Zend_Registry::get('em');
$user = new Entities\User();
$user->name = "Bob";
$user->username = "bob";
$user->email = "bob@live.com";
$user->password = "test";
$user->activation = "";
$em->persist($user); // The other way around :D
$em->flush();