と呼ばれる仮想フィールドUser
を持つと呼ばれるモデルがあります。find()クエリでモデルにアクセスすると、次のような問題なく仮想フィールドに条件を設定できます。full_name
User
$user = $this->User->find('first', array(
'recursive' => -1,
'conditions' => array(
'User.full_name' => 'Bruce Thomas'
)
));
上記のクエリは、BruceThomasというユーザーのデータを正常に返します。しかし、次のようなContainable動作を介して、別のモデルを介してモデルUserを使用しようとすると、問題が発生します。
$user = $this->MyOtherModel->find('first', array(
'contain' => array('User'),
'conditions' => array(
'MyOtherModel.id' => $my_other_model_id
'User.full_name' => 'Bruce Thomas'
)
));
(上記の例では、が私のモデルと関係MyOtherModel
があることを前提としています)belongsTo
MyOtherModel
上記のクエリでは、次のエラーが発生します。
警告(512):SQLエラー:1054:'on句'の不明な列'User.full_name' [CORE \cake \ libs \ model \ datasources \ dbo_source.php、line 681]
私がこれをどのように行うことができるかについて何か助けがありますか?ありがとうございました