Bonjour.
Je débute sur Symfony (1.4) et je ne sais pas comment faire pour afficher (proprement) des données d'une table liée.

Je m'explique (je copie mon schema.yml par la suite) :
J'ai créé le module client et l'affichage de la liste des clients avec les données de la table se fait correctement.
Je voudrai pouvoir afficher le nom de la civilité et non son ID ainsi que le nom du type de personne et non son ID.

J'y arrive en rajoutant ce code dans indexSuccess.php (pour le type) :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
<td class="typepersonne"><?php echo Doctrine::getTable('typePersonne')->find($client->getTypePersonneId())->getName() ?></td>
Mais cela ne me semble pas très propre vu que ce code se trouve dans la vue et ne respecte donc pas le MVC. Comment faire pour arranger ça ?

D'autre part, je voudrais pouvoir afficher dans la ligne correspondant au client, ces différentes adresses, téléphones, emails..., avec leur type aussi.
En gros, je voudrais toutes les infos, ou presque, sur la même ligne.
Et la je ne sais pas trop comment faire.

Est-ce que quelqu'un peut me donner un coup de main ?

Voici le schema.yml :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
---
detect_relations: true
options:
  charset: utf8
  type: InnoDB
 
client:
  actAs:
    Timestampable: ~
  columns:
    id:
      type: integer(4)
      primary: true
      notnull: true
      autoincrement: true
    lastname:
      type: string(60)
      notnull: true
    firstname:
      type: string(60)
      notnull: true
    birth_date:
      type: date
    birth_hour:
      type: time
    birth_place:
      type: string(60)
    independance_date:
      type: date
    civilite_id:
      type: integer(4)
      notnull: true
    type_personne_id:
      type: integer(4)
      notnull: true
  relations:
    civilite:
      class: civilite
      local: civilite_id
      foreign: id
      foreignAlias: clients
    typePersonne:
      class: typePersonne
      local: type_personne_id
      foreign: id
      foreignAlias: clients
  indexes:
    fk_client_civilite:
      fields: [civilite_id]
    fk_client_type_personne1:
      fields: [type_personne_id]
 
civilite:
  actAs:
    Timestampable: ~
  columns:
    id:
      type: integer(4)
      primary: true
      notnull: true
      autoincrement: true
    long_name:
      type: string(45)
    name:
      type: string(45)
 
adresse:
  actAs:
    Timestampable: ~
  columns:
    id:
      type: integer(4)
      primary: true
      notnull: true
      autoincrement: true
    street:
      type: string(45)
    zip:
      type: string(45)
    city:
      type: string(45)
    client_id:
      type: integer(4)
      primary: true
      notnull: true
    type_adresse_id:
      type: integer(4)
      notnull: true
  relations:
    client:
      class: client
      local: client_id
      foreign: id
      foreignAlias: adresses
      onDelete: cascade
    typeAdresse:
      class: typeAdresse
      local: type_adresse_id
      foreign: id
      foreignAlias: adresses
  indexes:
    fk_adresse_client1:
      fields: [client_id]
    fk_adresse_type_adresse1:
      fields: [type_adresse_id]
 
typeAdresse:
  actAs:
    Timestampable: ~
  tableName: type_adresse
  columns:
    id:
      type: integer(4)
      primary: true
      notnull: true
      autoincrement: true
    name:
      type: string(45)
      notnull: true
 
telephone:
  actAs:
    Timestampable: ~
  columns:
    id:
      type: integer(4)
      primary: true
      notnull: true
      autoincrement: true
    number:
      type: string(45)
      notnull: true
    client_id:
      type: integer(4)
      primary: true
      notnull: true
    type_telephone_id:
      type: integer(4)
      notnull: true
  relations:
    client:
      class: client
      local: client_id
      foreign: id
      foreignAlias: telephones
      onDelete: cascade
    typeTelephone:
      class: typeTelephone
      local: type_telephone_id
      foreign: id
      foreignAlias: telephones
  indexes:
    fk_telephone_client1:
      fields: [client_id]
    fk_telephone_type_telephone1:
      fields: [type_telephone_id]
 
typeTelephone:
  actAs:
    Timestampable: ~
  tableName: type_telephone
  columns:
    id:
      type: integer(4)
      primary: true
      notnull: true
      autoincrement: true
    name:
      type: string(45)
      notnull: true
 
email:
  actAs:
    Timestampable: ~
  columns:
    id:
      type: integer(4)
      primary: true
      notnull: true
      autoincrement: true
    email:
      type: string(50)
      notnull: true
    client_id:
      type: integer(4)
      primary: true
      notnull: true
    type_email_id:
      type: integer(4)
      notnull: true
  relations:
    client:
      class: client
      local: client_id
      foreign: id
      foreignAlias: emails
      onDelete: cascade
    typeEmail:
      class: typeEmail
      local: type_email_id
      foreign: id
      foreignAlias: emails
  indexes:
    fk_email_client1:
      fields: [client_id]
    fk_email_type_email1:
      fields: [type_email_id]
 
typeEmail:
  actAs:
    Timestampable: ~
  tableName: type_email
  columns:
    id:
      type: integer(4)
      primary: true
      notnull: true
      autoincrement: true
    name:
      type: string(45)
      notnull: true
 
typePersonne:
  actAs:
    Timestampable: ~
  tableName: type_personne
  columns:
    id:
      type: integer(4)
      primary: true
      notnull: true
      autoincrement: true
    long_name:
      type: string(45)
    name:
      type: string(45)
Il a été généré par un plugin de MysqlWorkBench.

Merci pour votre aide.

Eric

P.S : au besoin je peux fournir le schéma UML de la base.