私はMVCとCodeigniterを初めて使用し、クラスを機能させようとしています。
CodeIgniter2.1.0とDoctrine2.2.1を実行しています
私のコードがsubmit()関数を呼び出すと、次のようなClass 'Myclass_model' not found
行への参照が表示されます。$u = new Myclass_model();
(下部の編集ノートを参照してください。現在、Class 'Doctrine_Record' not found
拡張されたモデルに入ります)
私のコントローラーには次のコードがあります:
public function submit() {
if ($this->_submit_validate() === FALSE) {
$this->index();
return;
}
$u = new Myclass_model();
$u->username = $this->input->post('username');
$u->password = $this->input->post('password');
$u->email = $this->input->post('email');
$u->save();
$this->load->view('submit_success');
}
そして、私の/ application /models/フォルダーにmyclass.phpがあります。
class Myclass extends Doctrine_Record {
public function setTableDefinition() {
$this->hasColumn('username', 'string', 255, array('unique' => 'true'));
$this->hasColumn('password', 'string', 255);
$this->hasColumn('email', 'string', 255, array('unique' => 'true'));
}
public function setUp() {
$this->setTableName('testtable1');
$this->actAs('Timestampable');
//$this->hasMutator('password', '_encrypt_password');
}
protected function _encrypt_password($value) {
$salt = '#*seCrEt!@-*%';
$this->_set('password', md5($salt . $value));
//Note: For mutators to work, auto_accessor_override option needs to be enabled. We have already done it, in our plugin file doctrine_pi.php.
}
}
私の問題はDoctrine_Recordの拡張にあると思います。doctrine2がインストールされており、/ application /libraries/にDoctrine.phpとDoctrineフォルダーがあります。しかし、どこでチェックするか、Doctrine_Recordが使用可能であるか、構成されているかなどをチェックして確認する方法さえわかりません。
誰かが私がこれをトラブルシューティングし、問題がどこにあるのかを理解するのを手伝ってもらえますか?私のクラスで何か簡単なことはありますか?Doctrineのインストール/設定に問題がありますか?
編集:私は次のようにクラスを呼び出すという提案に従いました:
$this->load->model('Myclass_model','u');
そして今Class 'Doctrine_Record' not found
、モデルがDoctrine_Recordを拡張する場所を取得しています