Jump to content
Larry Ullman's Book Forums

josh

Members
  • Posts

    3
  • Joined

  • Last visited

josh's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Thank you! I might not be the fastest but my perseverance paid off. I took another look at my database and fixed my FKs and now everything works. Thank you.
  2. Thank you Mr Ullman for your quick response. This should be simple and I apologize for my ignorance in this situation but I am simply not seeing my relation. MediaArchive is my main form. BibleDetails is a lookup table that is populating the dropdown list for the Bible field on the MediaArchive form. So in my MediaArchive form I established the following relation public function relations() { return array( 'Bible' => array(self::HAS_ONE, 'BibleDetails','BibleEnglish') ); } In BibleDetails I added this to my relations public function relations() { return array( 'BibleEnglish' => array(self::BELONGS_TO, 'MediaArchive','Bible') ); } and then in my _view.php for my MediaArchive form I inserted <?php echo CHtml::encode($model->Bible->BibleEnglish); ?> OK, after all the chuckles could you please advise. I am not understanding relations. Thank you!
  3. Greetings, Thank you in advance for your help. In the blog regarding handling related models in Yii it is stated: "And that’s all you need to do to get this to work. The dropDownList() method creates a SELECT menu. It’s associated with the departmentId attribute of this Model. The drop-down menu’s data has to come from CHtml::listData(). That part of the code says to fetch every Department, and to use the department’s id value for the menu value and its name value for the visible label." This works perfectly! Thank you. My question is when viewing, managing or updating the record I would like the value to show the name and not number associated with the entry. I have tried modifying my my model regarding the public function relations() { return array( ); } But to no avail. Please help. Thank you.
×
×
  • Create New...