Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

How To Load Relationshep Values In Listdata()

$
0
0
Hi

I need to know how to call relationship in listData() ,

For Example in normal way we can call it like :

$model->section->section_name ;


in my code i just print value as number but I need to print string value from courses table .


   public function coursesList($section_id) {
    	
    	
    	$data=Msection::model()->findAll('section_id=:section_id', 
              	array(':section_id'=>(int)$section_id));
          	
              	
    	return CHtml::listData($data,'course_id','course_id');
 //// can i call it like : ///listData($data,'course_id->course->course_name','course_id');
	}


Can I call it like?
listData($data,'course_id->course->course_name','course_id');


How To fix that ?

thanks in advance

Viewing all articles
Browse latest Browse all 18717

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>