我在這裏做錯了什麼?加入和CakePHP時出錯
$sub_data = $this->Subscriber->find('all', array(
'joins' => array(
'table' => 'subtypes',
'alias' => 'Subtype',
'type' => 'LEFT',
'conditions' => array(
'Subtype.id = Subscriber.plan',
)
),
'conditions' => array(
'Subscriber.plan' => $plan['Subtype']['id'],
'Subscriber.authcode !=' => '',
'Subscriber.subended' => '0000-00-00 00:00:00',
'Subtype.authorize_trial_only' => '1',
)
));
不知何故,最終的聲明沒有被正確生成。這是一部分,我得到一個SQL錯誤:
... FROM
subscribers
ASSubscriber
subtypes Subtype LEFT Array WHERESubscriber
.plan
= '10' ANDSubscriber
.authcode
!= '' ANDSubscriber
.subended
= '0000-00-00 00:00:00' ANDSubtype
.authorize_trial_only
= '1' AND ...
順便說一句,$ plan ['Subtype'] ['id']是一個字符串 – Raisen 2011-04-05 18:35:25