apprentice (77) [Avatar] Offline
#1
[nobr]

<h3>INTRO</h3>
I have 3 major questions regarding 1-to-Many relationships. So I will try and isolate my questions and not ask and show too much at once.
Basically I'm trying to expand my knowledge based upon Akrabat's Albums tutorial code by adding a Genre column to this application.
http://akrabat.com/zend-framework-tutorial/

<h2>1-To-Many, Question (1/3)</h2>
My (1/3) question is why doesn't my Edit page display the Genre value like it does with the Artist and Title columns?
What file holds the code that I need to correct?

<h3>Some visual aids:</h3>
http://i27.tinypic.com/2larj0h.jpg
http://i27.tinypic.com/acxs05.jpg

<h3>These are the relevant files:</h3>
I didn't write the file names for all I just wrote what gives out most information.

* class Model_DbTable_Albums
http://pastebin.com/m182ab17d
* IndexController.php
http://pastebin.com/m30426396
* class Form_Album
http://pastebin.com/m4d28f18f
* edit.phtml
http://pastebin.com/m108db77

[pre]
mysql> SELECT LEFT(title, 100), genre_id FROM `albums`;
+----------------------------------+----------+
| LEFT(title, 100) | genre_id |
+----------------------------------+----------+
| Together Through Life | 1 |
| Now That's what I Call Music! 72 | 2 |
| The Fame | 3 |
| It's Not Me, It's You | 4 |
| Only By The Night | 5 |
| Nah Nah, Nah Nah Nah! | 2 |
| Moulin Rouge | 2 |
| Hobo | 4 |
| test9 | 1 |
| Breeze | 4 |
| test1 | 1 |
| Media Circus | 1 |
| Predator | 3 |
| Shinji | 2 |
+----------------------------------+----------+
14 rows in set (0.00 sec)

mysql> SELECT * FROM genre;
+----+---------+
| id | name |
+----+---------+
| 1 | Hip Hop |
| 2 | Rock |
| 3 | Country |
| 4 | Techno |
| 5 | Pop |
+----+---------+
5 rows in set (0.00 sec)

mysql>
[/pre]

[/nobr]
apprentice (77) [Avatar] Offline
#2
Re: How to handle 1-to-Many relationships?
<h2>1-To-Many, Question (1/3) + (2/3)</h2>

Ignore this messy post!
I'll post a summary of my files at the end instead, that will be more helpful.
apprentice (77) [Avatar] Offline
#3
Re: How to handle 1-to-Many relationships?
...
apprentice (77) [Avatar] Offline
#4
Re: How to handle 1-to-Many relationships?
<h2>1-To-Many, Question (3/3)</h2>
2 down and 1 to go smilie I'll re-formulate my last question later this month when I've done some more researching and testing.


Regarding all my previous problems I changed every mention of $genre to $genre_id so that it matches the database field genre_id. That solved things but I don't know exactly where the problem is located, because you shouldn't have to mention the database field other than in the Db_Table_Albums file. But then I'm inexperienced so...


<h3>Some visual aids:</h3>
Question (1/3)+(2/3) - SOLVED
http://i28.tinypic.com/2regnja.jpg
http://i32.tinypic.com/5ze0b5.jpg
akrabat (479) [Avatar] Offline
#5
Re: How to handle 1-to-Many relationships?
sorry, too complicated a question for me ;(

Have you read http://framework.zend.com/manual/en/zend.db.table.relationships.html ?

Regards,

Rob...