私は Cakephp 2.x で開発したサイトを持っています。私は自分のコントローラーに次のような別のコントローラーの関数を呼び出したいと思っています:
class ProductsController extends AppController {
public $name = 'Products';
public $scaffold;
public $uses = array('Product','Unit');
public function testFunction(){
$this->loadModel('Unit');
$this->Unit->test();
}
}
UintController.php への関数テストは次のとおりです。
public function test(){
echo("test");
}
私のモデル名は Product と Unit です。関数 test を呼び出すと、次のエラーが表示されます。
Error: SQLSTATE[42000]: Syntax error or access violation: 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 'prova' at line 1
関数では今は空ですが、このエラーが発生します。私は試してみました:
public $uses = array('Unit');
$uses で行をキャンセルします。
どうすれば解決できますか?