を再宣言することはできません:CodeIgniterの致命的なエラー:クラスに私はエラーを取得しています
Fatal error: Cannot redeclare class News in application\models\Entities\News.php
2つのクラスは以下の通りです:
application/models/News_model.php
<?php
require_once(APPPATH."models/Entities/News.php");
class News_model extends CI_Model {
function __construct() {
parent::__construct();
}
}
application/models/Entities/News.php
<?php
use Doctrine\ORM\Mapping as ORM;
/**
* News
*
* @ORM\Table(name="news", indexes={@ORM\Index(name="slug", columns {"slug"})})
* @ORM\Entity
*/
class News {
}
最初のクラスはモデルで、最後のクラスはDoctrine
のエンティティクラスです。
2つの名前が異なるかどうかは、どちらが競合しているかわかりません。
私はCodeIgniter 3.1.4
を使用しています。
誰でもこの問題を解決する方法がありますか?
ありがとうございました!
'require_once'を取り出して、必要ないかもしれません。 – aynber
しかし、Entities/News.php、CRUD操作と対話する必要があります。 – omixam
既にCIのオートローダーを介してロードされている可能性があります。だから、クラスを2回宣言しようとしているのです。 – aynber