Hi all,
I have 3 tables with relations between them as follows:-
Table Client
'orders' => array(self::HAS_MANY, 'Order', 'client_id'),
Table Order
'client' => array(self::BELONGS_TO, 'Client', 'client_id'),
'orderpayments'=> array(self::HAS_MANY, 'Orderpayment', 'order_id'),
Table Orderpayment
'order' => array(self::BELONGS_TO, 'Order', 'order_id'),
In my controllerclient, I want to create a function which will retrieve all the payments made by a specific client. Is there a way using findAll() which can do this?
How do I refer to the client_id of the table orders which is related to the table orderpayment (see code below)
$payments=Orderpayment::model()->findAll('what to put here=:id', array(':id'=>$clientId));