Transactions cakephp 1.3中的事务

Transactions cakephp 1.3中的事务,transactions,cakephp-1.3,Transactions,Cakephp 1.3,我的控制器中有: $dataSource = $this->getDataSource(); // line 141 $dataSource->begin($this); if(...){ $dataSource->commit($this); }else{ $dataSource->rollback($this); } 但不起作用,我得到以下错误: 致命错误:在C:…\app\controllers\appusuarios\u controller.php

我的控制器中有:

$dataSource = $this->getDataSource(); // line 141
$dataSource->begin($this);
if(...){
   $dataSource->commit($this);
}else{
   $dataSource->rollback($this);
}
但不起作用,我得到以下错误:

致命错误:在C:…\app\controllers\appusuarios\u controller.php的第141行调用未定义的方法appusuarios controller::getDataSource()


我必须导入getDataSource()

我找到了一个解决方案,我希望它对将来的人有所帮助

你应该把它作为一个答案发布并接受它。