I’m trying to get related data into a drop down list.
Here are my tables:
-
PROJECTS: The project BELONGS_TO the customer.
-
CUSTOMERS: The customer HAS_MANY contacts
-
CONTACTS
I need a list of contacts to appear in my projects view
but I only need the ones that are related to the customer.
I can set up the projects view easy enough, its the contacts model I can’t seem to get.
This is where I’m at with it any help would be appreciated.
class Projects extends CActiveRecord
{ ...
public function relations()
{
return array(
'Customer' => array(self::BELONGS_TO, 'Customers', 'CustomerID' ),
'Contacts' => array(self:: <img src='http://www.yiiframework.com/forum/public/style_emoticons/default/huh.gif' class='bbc_emoticon' alt='???' />? ),
);
}
... }