我在 codeigniter 2 中集成了学说 2。我将数据库转换为存储在模型/实体中的实体
我的控制器是这样的..
public function __construct() {
parent::__construct();
$this->em = $this->doctrine->em;
$this->load->model('doctrine_model');
}
public function index()
{
$this->doctrine_model->get_object();
}
}
模型是这样的......
Class Doctrine_model extends CI_Controller
{
function __construct() {
parent::__construct();
//$this->load->library('doctrine');
//$accountTable = Doctrine_Core::getTable('ss_class');
$this->em = $this->doctrine->em;
}
function get_object()
{
$records = $this->em->getRepository("Entity\SsClass")->findAll();
}
}
当我运行此代码时,我收到此错误
Fatal error: Cannot redeclare class SsClass in D:\xampp\htdocs\new_doctrine\application\models\Entity\SsClass.php on line 14
因为我已经在自动加载中加载了学说库,但无法弄清楚这里发生了什么......