【问题标题】:Doctrine 2 Single Computation Exception ErrorDoctrine 2 单次计算异常错误
【发布时间】:2012-07-05 01:30:05
【问题描述】:

我一直在尝试将我的学说 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();

【问题讨论】:

    标签: zend-framework doctrine doctrine-orm


    【解决方案1】:

    该死的……

    我很尴尬!这是一个黄金法则问题...

    修复:

    /* 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();
    

    【讨论】:

      猜你喜欢
      • 2012-06-20
      • 2012-02-14
      • 2015-10-12
      • 1970-01-01
      • 2021-03-29
      • 2011-04-08
      • 1970-01-01
      • 1970-01-01
      • 2016-05-04
      相关资源
      最近更新 更多