zend framework - how to display parentrows in a view -


i building zend framework web app around mysql sakila db. have been able display basic films table details in films view. table contains among other columns, 'language_id' , 'original_language_id' columns reference language table. have set table relationships correctly in models. not sure how display language (not id's) in films view - how , use model relationships display langauge names in view? @ controller level? here's part of films controller:

    class filmscontroller extends zend_controller_action {     public function indexaction()     {         $this->view->title = 'films';         $this->view->headtitle($this->view->title);         $films = new application_model_dbtable_films();         $this->view->films = $films->fetchall(); 

here's part of view show table

   <td><?php echo $this->escape($film->title);?></td>  <td><?php echo $this->escape($film->description);?></td> <td><?php echo $this->escape($film->release_year);?></td>  <td><?php echo $this->escape($film->language_id);?></td> 

. . .

to parent row films (e.g. language), can use:

$languagerow = $filmrow->findparentrow('model_for_langauge_table'); 

simillarly dependant rowset of film table (e.g. actors), can use:

$actorrowset = $filmrow->finddependentrowset('model_for_actors_table'); 

to simplify define custom film db_row have method called, e.g. getlanguage(). more can read here. way e.g. language name do: $filmrow->getlanguage()->name;.


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -