Hi guys,
I’m quite a newbie in Yii but managed to get some stuff done reading this forum.
There’s an issue I’m dealing with right now and I’d appreciate some help.
There are three tables:
----------- ----------- -----------
| Box | | Address | | Street |
----------- ----------- -----------
| boxID | | addrID | | streetID|
|FK_addrID| |FK_strID | | name |
----------- ----------- -----------
What I want a dropDownList() in the Managing-Pane of Box showing the ‘name’ of the ‘Street’, the ‘FK_addrID’ is in.
To get that I inserted the following in the _form.php:
<?php
$boxModel = Box::model()->findAll(array('order' => 'boxID'));
$boxList = CHTML::listData($boxModel , 'boxID', Address::getAdress('FK_addrID'));
echo $form->dropDownList($model,'attributeOfFoo', $boxList , array('empty'=>'auswählen'));
?>
In Address.php there is a function called as above returning the specific value as string. But all I get is a PHP Error saying he’s unable getting property of non-object.
What I know is, that he passes the String ‘FK_addrID’ to the function getAdress($id) instead of the actual value.
Can anyone give me a hint how to pass the actual value to the function or solve the problem another way?
Thanks