0

ここおよびここにある問題と非常によく似た問題がありますが、これらの解決策は私のバージョンの問題を解決するのに役立ちません。私はCakePHP 1.3を使用しており、View Controller内からいくつかのモデル関数を呼び出そうとしています:

//Class setup
var $uses = array('StudentsTelephone', 'AddressesStudent');

//...

function someFunction(){
    $this->set('telephones', $this->StudentsTelephone->getActiveStudentTelepone($id));
    $this->set('addresses', $this->AddressesStudent->getActiveByStudentId($id));
}

この最初のモデル関数呼び出し (StudentsTelephone) は機能しますが、2 番目 (AddressesStudent) は失敗します。関数名を SQL 呼び出しとして使用しようとすると、次のようになります。

SQL Error: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'getActiveByStudentId' at line 1 [CORE\cake\libs\model\datasources\dbo_source.php, line 684]

少しデバッグしてみると、関数が AppModel で検索されており、AddressesStudent がチェックされていないことがわかりました。これらの他のソリューションに基づいて、名前のタイプミスであるように見えます。ただし、すべて正しく名前が付けられているようです。上記のコードは述べたとおりで、モデル ファイルはaddresses_student.php、クラス名は AddressesStudent で、これは Cake を更新する前 (最近 1.1 から 1.3 に切り替えたばかり) は正常に動作していました。問題の原因が命名エラーではないという提案はありますか? それとも、私が見逃している他の命名エラーですか? どうもありがとう!

編集: また、モデルの PHP ファイルが見つからなかったことを示すバックトレースは次のとおりです。

DboSource::showQuery() - CORE\cake\libs\model\datasources\dbo_source.php, line 684
DboSource::execute() - CORE\cake\libs\model\datasources\dbo_source.php, line 266
DboSource::fetchAll() - CORE\cake\libs\model\datasources\dbo_source.php, line 410
DboSource::query() - CORE\cake\libs\model\datasources\dbo_source.php, line 364
Model::call__() - CORE\cake\libs\model\model.php, line 502
Overloadable::__call() - CORE\cake\libs\overloadable_php5.php, line 50
AppModel::getActiveByStudentId() - [internal], line ??
StudentsController::edit() - APP\controllers\students_controller.php, line 277
Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 204
Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 171
[main] - APP\webroot\index.php, line 83
4

2 に答える 2