Hi.
Considering the DB ER in the attachment, what params do I need to pass to CHtml::activeDropDownList() in runtimes' _form.php so it lists the movie titles, with their ids as values, instead of a simple text input?
Hi.
Considering the DB ER in the attachment, what params do I need to pass to CHtml::activeDropDownList() in runtimes' _form.php so it lists the movie titles, with their ids as values, instead of a simple text input?
you can use:
<?php echo CHtml::activeDropDownList($model,‘movieid’, CHtml::listData(movie::model()->findAll(), ‘id’, ‘title’)); ?>
Thank you, but do you know if it's possible to get the movie::model() object through $model?
you can use this in model 'runtime' :
public function relations() { return array ( 'movie'=>array(self::BELONGS_TO, 'movie', 'movieid'), 'hall'=>array(self::BELONGS_TO, 'halls', 'hall'), ); }
what software did you use for this ER
Oh, I thought since 1.0.6 yii would do that automatically for me, upon creating the skeleton with the yii CLI tool (they're InnoDb tables).
On the main page it says "In addition, the command also generates the relations it discovers in the tables."
I’m using phpMyADmin
yii 1.0.6 do automatically for you