用户
 找回密码
 入住 CI 中国社区
搜索
查看: 2503|回复: 2
收起左侧

[HELP] CodeIgniter 和 Doctrine 插入数据'持久化'异常

[复制链接]
发表于 2011-1-9 18:03:27 | 显示全部楼层 |阅读模式
大家好,如题...........请帮帮忙.................

代码-->
class User extends Doctrine_Record {
        public function setTableDefinition(){
                $this->hasColumn('username','string',255);
                $this->hasColumn('password','string',255);
                $this->hasColumn('first_name','string',255);
                $this->hasColumn('last_name','string',255);
        }
}
---------------------------------------------------
代码-->
class Hello extends Controller {
        function index(){
                //储存第一个对象
                $user1=new User();
                $user1->username='jack';
                $user1->password='123456';
                $user1->first_name='chen';
                $user1->last_name='fuck';
                $user1->save();
        }
}
--------------------------------------------
异常->

Fatal error: Uncaught exception 'Doctrine_Transaction_Exception' with message 'Rollback failed.

There is no active transaction.' in

C:\AppServ\www\CodeIgniter\system\application\plugins\doctrine\lib\Doctrine\Transaction.php:319

Stack trace: #0

C:\AppServ\www\CodeIgniter\system\application\plugins\doctrine\lib\Doctrine\Connection.php(1426):

Doctrine_Transaction->rollback(NULL) #1

C:\AppServ\www\CodeIgniter\system\application\plugins\doctrine\lib\Doctrine\Connection\UnitOfWork.ph

p(136): Doctrine_Connection->rollback() #2

C:\AppServ\www\CodeIgniter\system\application\plugins\doctrine\lib\Doctrine\Record.php(1599):

Doctrine_Connection_UnitOfWork->saveGraph(Object(User)) #3

C:\AppServ\www\CodeIgniter\system\application\controllers\hello.php(18): Doctrine_Record->save() #4

[internal function]: Hello->index() #5

C:\AppServ\www\CodeIgniter\system\codeigniter\CodeIgniter.php(236): call_user_func_array(Array,

Array) #6 C:\AppServ\www\CodeIgniter\index.php(115): require_once('C:\AppServ\www\...') #7 {main}

thrown in

C:\AppServ\www\CodeIgniter\system\application\plugins\doctrine\lib\Doctrine\Transaction.php on line

319
发表于 2011-1-10 00:54:33 | 显示全部楼层
。。。。没用过这个 ORM -_-
楼主可以看下他的源码,也许就会有新发现,呵呵
 楼主| 发表于 2011-1-10 19:20:50 | 显示全部楼层
怎么没有人回答呢?难道没有人会嘛?

本版积分规则