AR Relations

i have 3 tables

Event

idevent

idobject

Object

idobject

idobject_parent

Event recurrence

idevent_recurrence

idobject

the values are

Event

idevent | idobject

1 | 1

Object

idobject | idobject_parent

1 | null

2 | 1

Event recurrence

idevent_recurrence | idobject

1 | 2

this is my code in Event Model function relations


'recurrence' => array(self::HAS_MANY, 'EventRecurrence', '','with'=>'idobject0','condition'=>'idobject_parent=:idobject','params'=>array(':idobjects'=>t.idobject)),

The query of this is

[color="#0000FF"]SELECT recurrence.idevent_recurrence AS t1_c0, recurrence.idobject AS t1_c1, recurrence.name AS t1_c2, idobject0.idobject AS t2_c0, idobject0.idobject_type AS t2_c1, idobject0.idobject_parent AS t2_c2

FROM event_recurrence recurrence LEFT OUTER JOIN object idobject0 ON (recurrence.idobject=idobject0.idobject) WHERE (idobject_parent=:idobject). Bound with :idobjects=‘t.idobject’[/color]

which is wrong!

How can i make the bound :idobjects=1 (which is the idobject of the event)

thanks

You cannot.

Parameters and binding is only for values. If you want SQL expression you have to just put it in query:




'recurrence' => array(self::HAS_MANY, 'EventRecurrence', '','with'=>'idobject0','condition'=>'idobject_parent=t.idobject'),