Reputation: 4495
What am I doing wrong here?
$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',
)
));
Somehow the final statement is not being generated correctly. That's that part where I get a SQL error:
... 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 ...
Upvotes: 0
Views: 319
Reputation: 2580
Should it be
'conditions' => array(
'Subtype.id' => 'Subscriber.plan',
)
Or am I just crazy?
EDIT:
Do you perhaps need to add another level of array() in there? i.e.
'joins' => array( array ( 'table' => ...
Upvotes: 1