Hello,
I’m developing a new template for crud form. The current class model is always acessed by $this->modelClass on this form. At some point i needed to use another model to generate a dropbox using data istead of just showing the foreign key. How can i get another model within this context, here goes the code:
foreach($this->tableSchema->columns as $column)
{
if($column->isPrimaryKey)
continue;
if($column->isForeignKey) {
?>
<div class="row">
<?php echo "<?php echo ".$this->generateActiveLabel($this->modelClass,$column)."; ?>\n"; ?>
<?php echo "<?php echo CHtml::activeDropDownList(\$model,'{$column->name}', CHtml::listData(".
[color="#FF0000"]$this->modelClass[/color]."::model()->findAll(), '{$column->name}', 'Nome')); ?>\n"; ?>
<?php echo "<?php echo \$form->error(\$model,'{$column->name}'); echo CHtml::link('New', 'index.php?r=".strtolower(str_replace(array('id','_'),'',"{$column->name}"))."', array('target'=>'_blank'));"; ?> ?>
</div>
[color="#FF0000"]$this->modelClass[/color] should be replaced with another model i choose, how do i get another model? anything would help, getting by its name, by database’s table name… etc
Thanks.