Précédent   Forum des professionnels en informatique > PHP > Bibliothèques et frameworks > symfony
symfony Forum d'entraide sur le framework PHP symfony. Avant de poster : cours symfony et FAQ symfony
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 22/06/2011, 11h01   #1
Futur Membre du Club
 
Homme
Étudiant
Inscription : novembre 2008
Messages : 67
Détails du profil
Informations personnelles :
Sexe : Homme
Localisation : France

Informations professionnelles :
Activité : Étudiant
Secteur : High Tech - Éditeur de logiciels

Informations forums :
Inscription : novembre 2008
Messages : 67
Points : 16
Points : 16
Par défaut Héritage de tables d'assocation ?

Bonjour !

Je continues de m'initier à Symfony et à ses merveilles et je me pose une question existentielle sur l'héritage concret et les tables d'assocations.

j'ai dans mon schéma une super-classe "Relation" de laquelle hérite (héritage concret) une collaboration et une Mobilité.

Si la super-classe est en relation via une table d'association avec un élément X, est-ce qu'il sera possible d'ajouter un lien entre cet élément X et une classe-fille de ma super-classe dans cette même table d'association ?

En somme comment marche l'héritage concret combiné avec des assocations par table ?

Merci d'avance,

Noobboy
Noobboy est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 23/06/2011, 09h09   #2
Modérateur
 
Avatar de Michel Rotta
 
Homme Michel Rotta
Responsable d'exploitation informatique
Inscription : septembre 2005
Messages : 4 913
Détails du profil
Informations personnelles :
Nom : Homme Michel Rotta
Âge : 49
Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

Informations professionnelles :
Activité : Responsable d'exploitation informatique
Secteur : Distribution

Informations forums :
Inscription : septembre 2005
Messages : 4 913
Points : 7 505
Points : 7 505
Tu sais que pour ce type de question tu te dois de fournir le paracétamol ?

Dans ton cas, je ne générerais pas de relation sur la classe principales. En principe rien n’émèche une entité d'être en relation deux fois avec une autre entité, il faut juste que le nom des relations des deux côtés soient bien différents.

Met ton shema.yml si tu as des doutes...
__________________
Si tu donnes un poisson à un homme, il mangera un jour. Si tu lui apprends à pêcher, il mangera toujours (Lao Tseu).
  • Pensez à valoriser les réponses pertinantes, cliquez sur le bouton vert +1 pour indiquer votre accord avec la solution proposée.
  • Pensez à utiliser la balise [code] pour afficher du code, elle est cachée sous le bouton [#] dans l'éditeur.
  • Une discussion est terminée ? Alors le bouton est votre ami !
Michel Rotta est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 23/06/2011, 09h34   #3
Futur Membre du Club
 
Homme
Étudiant
Inscription : novembre 2008
Messages : 67
Détails du profil
Informations personnelles :
Sexe : Homme
Localisation : France

Informations professionnelles :
Activité : Étudiant
Secteur : High Tech - Éditeur de logiciels

Informations forums :
Inscription : novembre 2008
Messages : 67
Points : 16
Points : 16
Désolé si c'est un peu tordu ce que je demande. Donne moi l'adresse, j'enverrais un carton d'aspirine.

L'idée est qu'un partenaire ne peut intervenir qu'une seule fois dans une même relation mais qu'une relation peut demander l'intervention de plusieurs partenaires.

*rajoute un tube de paracétamol dans le carton*

Et j'ai du mal à voir -et à trouver en compulsant internet à coup de moteur de recherche- comment réaliser une liaison n-n (many-to-many) sans passer par une table d'association...

Pour ce qui est du schema.yml :
Code :
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
Relation:
  connection: doctrine
  tableName: Relation
  columns:
    id:
      type: integer(8)
      fixed: false
      unsigned: false
      primary: true
      autoincrement: true
  relations:
    Partenaires:
      class: PartenaireIU
      local: Relation_id
      foreign: PIU_id
      refClass: RelationPartenaireIU
 
PartenaireIU:
  connection: doctrine
  tableName: PartenaireIU
  columns:
    idPIU:
      type: integer(8)
      primary: true
      fixed: false
      unsigned: false
    equipeprojetdept:
      type: string(255)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
    domainedept:
      type: string(255)
      fixed: false
      unsigned: false
      primary: false
      notnull: false
      autoincrement: false
    theme:
      type: string(255)
      fixed: false
      unsigned: false
      primary: false
      notnull: false
      autoincrement: false
  relations:
    Relations:
      class: Relation
      local: PIU_id
      foreign: Relation_id
      refClass: RelationPartenaireIU
 
RelationPartenaireIU:
  connection: doctrine
  tableName: RelationPartenaireIU
  columns:
    PIU_id:
      type: integer
      primary: true
    Relation_id:
      type: integer
      primary: true
  relations:
    PartenaireIU:
      local: PIU_id
      foreign: idPIU
      onDelete: CASCADE
    Relation:
      onDelete: CASCADE
 
CollaborationInternationale:
  connection: doctrine
  tableName: CollaborationInternationale
  inheritance:
    type:             concrete
    extends:          Relation
  columns:
    porteurIU_id:
      type: integer(8)
      notnull: true
    porteurInternational_id:
      type: integer(8)
      notnull: true
  relations:
#pour faire court, j'ai coupé les relations mais il y en a une pour chaque attribut "id" au dessus.
 
Formelle:
  connection: doctrine
  tableName: Formelle
  inheritance:
    type:             concrete
    extends:          CollaborationInternationale
  columns:
    programme_accord_id:
      type: integer(8)
      fixed: false
      unsigned: false
      notnull: true
    projet_id:
      type: integer(8)
      fixed: false
      unsigned: false
      notnull: true
    appelaprojet_id:
      type: integer(8)
      fixed: false
      unsigned: false
      notnull: true
  relations:
#la même ici.
 
Informelle:
  connection: doctrine
  tableName: Informelle
  inheritance:
    type:             concrete
    extends:          CollaborationInternationale
Noobboy est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 23/06/2011, 13h54   #4
Modérateur
 
Avatar de Michel Rotta
 
Homme Michel Rotta
Responsable d'exploitation informatique
Inscription : septembre 2005
Messages : 4 913
Détails du profil
Informations personnelles :
Nom : Homme Michel Rotta
Âge : 49
Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

Informations professionnelles :
Activité : Responsable d'exploitation informatique
Secteur : Distribution

Informations forums :
Inscription : septembre 2005
Messages : 4 913
Points : 7 505
Points : 7 505
Shema : à ma façon
Code :
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
 
Relation:
  tableName: Relation
  columns:
    # champ id se crée seul
    # manque un champ Relation_id pour la relation avec partenaires
  relations:
    Partenaires:
      class: PartenaireIU
      refClass: RelationPartenaireIU
      foreignAlias: Relations
 
PartenaireIU:
  tableName: PartenaireIU
  columns:
    idPIU: # en principe l'id c'est id, pas idPIU 
      type: integer(8)
      primary: true
      fixed: false
      unsigned: false
    equipeprojetdept:
      type: string(255)
      notnull: true
    domainedept:
      type: string(255)
    theme:
      type: string(255)
 
RelationPartenaireIU:
  tableName: RelationPartenaireIU
  columns:
    PIU_id:
      type: integer(8)
      primary: true
    Relation_id:
      type: integer
      primary: true
  relations:
    PartenaireIU:
      local: PIU_id
      foreign: idPIU
      foreignAlias: RelationPartenaireIUs
      onDelete: CASCADE
    Relation:
      foreignAlias: RelationPartenaireIUs
      onDelete: CASCADE
 
CollaborationInternationale:
  connection: doctrine
  tableName: CollaborationInternationale
  inheritance:
    type:             concrete
    extends:          Relation
  columns:
    porteurIU_id:
      type: integer
      notnull: true
    porteurInternational_id:
      type: integer(8)
      notnull: true
  relations:
#pour faire court, j'ai coupé les relations mais il y en a une pour chaque attribut "id" au dessus.
# Les problèmes sont souvent issus de relation mal définie, ne pas les afficher ne permet pas leur relecture
 
Formelle:
  tableName: Formelle
  inheritance:
    type:             concrete
    extends:          CollaborationInternationale
  columns:
    programme_accord_id:
      type: integer(8)
      notnull: true
    projet_id:
      type: integer(8)
      notnull: true
    appelaprojet_id:
      type: integer(8)
      notnull: true
  relations:
#la même ici.
# ben oui :(
 
Informelle:
  connection: doctrine
  tableName: Informelle
  inheritance:
    type:             concrete
    extends:          CollaborationInternationale
Ne jamais imaginer qu'il est possible de faire un shema à partir d'une structure existante (sauf s'il n'est vraiment pas possible d'envisager de faire autrement.

Il est impossible de faire une relation n-n sans une table intermédiaire.
Je ne comprend pas à quoi sert l'entité relation qui n'as pas d'attribut.
Sans au moins une des tables et une des relations sur les entités CollaborationInternationale et apparenté, impossible de savoir si elle sont cohérentes.
__________________
Si tu donnes un poisson à un homme, il mangera un jour. Si tu lui apprends à pêcher, il mangera toujours (Lao Tseu).
  • Pensez à valoriser les réponses pertinantes, cliquez sur le bouton vert +1 pour indiquer votre accord avec la solution proposée.
  • Pensez à utiliser la balise [code] pour afficher du code, elle est cachée sous le bouton [#] dans l'éditeur.
  • Une discussion est terminée ? Alors le bouton est votre ami !
Michel Rotta est déconnecté   Envoyer un message privé Réponse avec citation 10
Vieux 23/06/2011, 16h59   #5
Futur Membre du Club
 
Homme
Étudiant
Inscription : novembre 2008
Messages : 67
Détails du profil
Informations personnelles :
Sexe : Homme
Localisation : France

Informations professionnelles :
Activité : Étudiant
Secteur : High Tech - Éditeur de logiciels

Informations forums :
Inscription : novembre 2008
Messages : 67
Points : 16
Points : 16
En fait, j'ai mis tout le schema.yml pour faire simple et comme ça il ne manquera rien.

Pour ce qui est de l'entité relation, c'était pour faire une classe-mère qui englobait les trois types de relation que nous avons : mobilite, relation formelle et informelle. J'ai cru que faire de l'héritage serait mieux.

Avant de commencer, reprend donc un verre d'aspirine.

Code :
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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
Institution:
  connection: doctrine
  tableName: Institution
  columns:
    zone:
      type: string(255)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
    pays:
      type: string(255)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
    nomorga:
      type: string(255)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
    adresseorga:
      type: string(255)
      fixed: false
      unsigned: false
      primary: false
      notnull: false
      autoincrement: false
  relations:
    Collaborations:
      class: Collaboration_internationale
      local: institution_id
      foreign: collaboration_internationale_id
      refClass: InstitutionCollab
    Zone:
      local: zone
      foreign: nom_zone
      foreignType: one
    Pays:
      local: pays
      foreign: nom_pays
      foreignType: one
 
#For more flexibility enums are transformed into new tables
Zone:
  connection: doctrine
  tableName: Zone
  columns:
    nom_zone:
      type: string(255)
      primary: true
 
Pays:
  connection: doctrine
  tableName: Pays
  columns:
    nom_pays:
      type: string(255)
      primary: true
 
InstitutionCollab:
  connection: doctrine
  tableName: Institution_collab
  columns:
    collaboration_internationale_id:
      type: integer(8)
      primary: true
      autoincrement: false
    institution_id:
      type: integer(8)
      primary: true
      autoincrement: false
  relations:
    Institution:
      onDelete:       CASCADE
    Collaboration_internationale:
      onDelete:       CASCADE
 
Collaboration_internationale:
  connection: doctrine
  tableName: Collaboration_internationale
  inheritance:
    type:             concrete
    extends:          Relation
  columns:
    porteurIU_id:
      type: integer(8)
      notnull: true
    porteurInternational_id:
      type: integer(8)
      notnull: true
  relations:
    Institutions:
      class: Institution
      local: collaboration_internationale_id
      foreign: institution_id
      refClass: InstitutionCollab
      foreignAlias: CollaborationsInternationales
    Porteurs_iu:
      class: Personne
      local: porteurIU_id
      foreign: personne_id
      refClass: statutIU
    Porteur_inter:
      class: Personne
      local: porteurInternational_id
      foreign: personne_id
      refClass: statut_inter
 
Statut_inter:
  connection: doctrine
  tableName: statut_inter
  columns:
    collaboration_internationale_id:
      type: integer(8)
      primary: true
    personne_id:
      type: integer(8)
      primary: true
    libelle_statut:
       type: string(255)
       notnull: true
  relations:
    Personne:
      onDelete:       CASCADE
    Collaboration_internationale:
      onDelete:       CASCADE
    Libelle_statut_inter:
      local: libelle_statut
      foreign: nom_statut
      foreignType: one
 
#For more flexibility enums are transformed into new tables
LibelleStatutInter:
  connection: doctrine
  tableName: Libelle_statut_inter
  columns:
    nom_statut:
      type: string(255)
      primary: true
 
StatutIU:
  connection: doctrine
  tableName: statut_i_umr
  columns:
    personne_id:
      type: integer(8)
      primary: true
    collaboration_internationale_id:
      type: integer(8)
      primary: true
    libelle_statut:
      type: string(255)
      notnull: true
  relations:
    Personne:
      onDelete:       CASCADE
    Collaboration_internationale:
      onDelete:       CASCADE
    Libelle_statut_iu:
      local: libelle_statut
      foreign: nom_statut
 
#For more flexibility enums are transformed into new tables
LibelleStatutIU:
  connection: doctrine
  tableName: Libelle_statut_iu
  columns:
    nom_statut:
      type: string(255)
 
Personne:
  connection: doctrine
  tableName: Personne
  columns:
    nompersonne:
      type: string(255)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
    prenompersonne:
      type: string(255)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
    emailpersonne:
      type: string(255)
      fixed: false
      unsigned: false
      primary: false
      notnull: false
      autoincrement: false
#This enum will not to be changed so, it's still an enum.
    sexepersonne:
      type: enum(1)
      fixed: false
      unsigned: false
      values:
        - M
        - F
      primary: false
      notnull: true
      autoincrement: false
    institution_id:
      type: integer(8)
      fixed: false
      unsigned: false
      primary: false
      notnull: false
      autoincrement: false
  relations:
    PersonneIU:
      class: Collaboration_internationale
      local: personne_id
      foreign: porteurIU_id
      refClass: statutIU
    PersonneInter:
      class: Collaboration_internationale
      local: personne_id
      foreign: porteurInternational_id
      refClass: statut_inter
    PersonneMob:
      class: Mobilite
      local: personne_id
      foreign: personneMobilite_id
      refClass: statut_mob
    Institution:
      local: institution_id
      foreign: id
      type: one
      foreignType: one
    Invitants_mobilites:
      class: Mobilite
      local: personne_id
      foreign: mobilite_id
      refClass: Invitants_mobilite
 
Statut_mob:
  connection: doctrine
  tableName: statut_mob
  columns:
    personne_id:
      type: integer(8)
      primary: true
    mobilite_id:
      type: integer(8)
      primary: true
    libelle_statut:
      type: string(255)
      fixed: false
      unsigned: false
      notnull: true
  relations:
    Personne:
      onDelete:       CASCADE
    Mobilite:
      onDelete:       CASCADE
    Libelle_statut_mob: 
      local: libelle_statut
      foreign: nom_statut
 
#For more flexibility enums are transformed into new tables
Libelle_statut_mob:
  connection: doctrine
  tableName: Libelle_statut_mob
  columns:
    nom_statut:
      type: string(255)
 
Mobilite:
  connection: doctrine
  tableName: Mobilite
  inheritance:
    type:             concrete
    extends:          Relation
  columns:
    type_mobilite:
      type: enum(9)
      fixed: false
      unsigned: false
      values:
        - Incoming
        - Outcoming
      notnull: true
      autoincrement: false
    nature:
      type: string(255)
      fixed: false
      unsigned: false
      notnull: true
      autoincrement: false
    financement:
      type: integer(4)
      fixed: false
      unsigned: true
      notnull: false
      autoincrement: false
    institutionAccueil_id:
      type: integer(8)
      notnull: true
  relations:
    PersonnesMob:
      class: Personne
      local: personneMobilite_id
      foreign: personne_id
      refClass: statut_mob
    Invitants:
      class: Personne
      local: mobilite_id
      foreign: personne_id
      refClass: Invitants_mobilite
    Institution:
      local: institutionAccueil_id
      foreign: id
      type: one
      foreignType: one
 
Invitants_mobilite:
  connection: doctrine
  tableName: Invitants_mobilite
  columns:
    mobilite_id:
      type: integer(8)
      primary: true
      autoincrement: false
    personne_id:
      type: integer(8)
      primary: true
      autoincrement: false
  relations:
    Personne:
      onDelete:       CASCADE
    Mobilite:
      onDelete:       CASCADE
 
Financement:
  connection: doctrine
  tableName: Financement
  columns:
    datedebut:
      type: date(25)
      fixed: false
      unsigned: false
      notnull: true
    datefin:
      type: date(25)
      fixed: false
      unsigned: false
      notnull: true
    montant:
      type: integer(8)
      fixed: false
      unsigned: true
      notnull: true
    institutionFinancement_id:
      type: integer(8)
      notnull: true
    contrat_id:
      type: integer(8)
      fixed: false
      unsigned: false
      notnull: true
  relations:
    Formelle:
      local: contrat_id
      foreign: id
      onDelete: cascade
      type: one
    Institution:
      local: institutionFinancement_id
      foreign: id
      foreignType: one
 
Projet:
  connection: doctrine
  tableName: Projet
  columns:
    titreprojet:
      type: string(255)
      fixed: false
      unsigned: false
      notnull: true
    acronymeprojet:
      type: string(255)
      fixed: false
      unsigned: false
    datedebut:
      type: date(25)
      fixed: false
      unsigned: false
      default: ''
      notnull: true
    datefininitiale:
      type: date(25)
      default: ''
      fixed: false
      unsigned: false
      notnull: true
    statut_p:
      type: string(255)
      fixed: false
      unsigned: false
      notnull: true
    typeprogacc:
      type: string(255)
      fixed: false
      unsigned: false
      notnull: true
  relations:
    RenouvellementProlongations:
      class: Renouvellement_prolongation
      local: id
      foreign: projet_id
      type: many
    Contrats:
      class: Formelle
      local: id
      foreign: projet_id
      type: many 
    Statut_p:
      local: statut_p
      foreign: nom_statutp
      type: one
    TypeProgAcc:
      local: typeprogacc
      foreign: nom_typeprogacc
      type: one
 
#For more flexibility enums are transformed into new tables
statut_p:
  connection: doctrine
  tableName: statut_p
  columns:
    nom_statutp:
      type: string(255)
      primary: true
 
TypeProgAcc:
  connection: doctrine
  tableName: Type_prog_acc
  columns:
    nom_typeprogacc:
      type: string(255)
      primary: true
 
Formelle:
  connection: doctrine
  tableName: Formelle
  inheritance:
    type:             concrete
    extends:          Collaboration_internationale
  columns:
    programme_accord_id:
      type: integer(8)
      fixed: false
      unsigned: false
      notnull: true
    projet_id:
      type: integer(8)
      fixed: false
      unsigned: false
      notnull: true
    appelaprojet_id:
      type: integer(8)
      fixed: false
      unsigned: false
      notnull: true
  relations:
    Projet:
      local: projet_id
      foreign: id
      onDelete: cascade
    ProgrammeAccord:
      foreignType: one
    Financements:
      class: Financement
      local: id
      foreign: contrat_id
      type: many
    AppelAProjet:
      local: AppelAProjet_id
      foreign: id
      onDelete: cascade
 
AppelAProjet:
  connection: doctrine
  tableName: Appel_a_projet
  columns:
    nomAppel:
      type: string(255)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
    dateAppel:
      type: date(25)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
    duree:
      type: integer(4)
      fixed: false
      unsigned: true
      primary: false
      notnull: true
      autoincrement: false
    Gestionnaire_nat_id:
      type: integer(8)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
    Gestionnaire_centre_id:
      type: integer(8)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
    equipeAssociee:
      type: string(255)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
  relations:
    Personne:
      class: Personne
      local: Gestionnaire_centre_id
      foreign: id
      type: one
      foreignType: one
    Personne:
      class: Personne
      local: Gestionnaire_nat_id
      foreign: id
      type: one
      foreignType: one
    ContratsLies:
      class: Formelle
      local: contrat_id
      foreign: id 
      type: many
 
 
Informelle:
  connection: doctrine
  tableName: Informelle
  inheritance:
    type:             concrete
    extends:          Collaboration_internationale
 
PartenaireIU:
  connection: doctrine
  tableName: Partenaire_iu
  columns:
    equipeprojetdept:
      type: string(255)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
    domainedept:
      type: string(255)
      fixed: false
      unsigned: false
      primary: false
      notnull: false
      autoincrement: false
    theme:
      type: string(255)
      fixed: false
      unsigned: false
      primary: false
      notnull: false
      autoincrement: false
  relations:
    Relations:
      class: Relation
      local: PIU_id
      foreign: Relation_id
      refClass: RelationPartenaireIU
 
 
RelationPartenaireIU:
  connection: doctrine
  tableName: Relation_partenaire_iu
  columns:
    PIU_id:
      type: integer
      primary: true
    Relation_id:
      type: integer
      primary: true
  relations:
    PartenaireIU:
      local: PIU_id
      foreign: id
      onDelete: CASCADE
    Relation:
      onDelete: CASCADE
 
ProgrammeAccord:
  connection: doctrine
  tableName: Programme_accord
  columns:
    referenceacc:
      type: string(255)
      fixed: false
      unsigned: false
      primary: false
      notnull: false
      autoincrement: false
    OrgaEmetteur_id:
      type: integer(8)
      fixed: false
      unsigned: false
      primary: false
      autoincrement: false
  relations:
    Institution:
      local: OrgaEmetteur_id
      foreign: id
      foreignType: one
 
Relation:
  connection: doctrine
  tableName: Relation
  columns:
  relations:
    Partenaires:
      class: PartenaireIU
      local: Relation_id
      foreign: PIU_id
      refClass: RelationPartenaireIU
 
RenouvellementProlongation:
  connection: doctrine
  tableName: Renouvellement_prolongation
  columns:
    projet_id:
      type: integer(8)
      fixed: false
      unsigned: false
      notnull: true
    datedebut:
      type: date(25)
      fixed: false
      unsigned: false
      notnull: true
    newdatefin:
      type: date(25)
      fixed: false
      unsigned: false
      notnull: true
#This enum is also not going to be changed either, so still an enum.
    typerp:
      type: enum(12)
      fixed: false
      unsigned: false
      values:
        - Renewal
        - Continuation
      notnull: true
  relations:
    Projet:
      local: projet_id
      foreign: id
      onDelete: cascade
Noobboy est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 23/06/2011, 19h33   #6
Modérateur
 
Avatar de Michel Rotta
 
Homme Michel Rotta
Responsable d'exploitation informatique
Inscription : septembre 2005
Messages : 4 913
Détails du profil
Informations personnelles :
Nom : Homme Michel Rotta
Âge : 49
Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

Informations professionnelles :
Activité : Responsable d'exploitation informatique
Secteur : Distribution

Informations forums :
Inscription : septembre 2005
Messages : 4 913
Points : 7 505
Points : 7 505
Je fais surtout commencer par te faire travailler....

Supprime toutes les options qui ont leur valeurs par défaut, au moins pour les fields, en gros, tous ce qui ce termine par false...

Tu peux aussi supprimer les : "connection: doctrine" qui ne servent à rien, sauf si tu envisages de gérer simultanément plusieurs bases de données.

Remets ton shema.yml allégé une fois la cure de jouvence terminée
__________________
Si tu donnes un poisson à un homme, il mangera un jour. Si tu lui apprends à pêcher, il mangera toujours (Lao Tseu).
  • Pensez à valoriser les réponses pertinantes, cliquez sur le bouton vert +1 pour indiquer votre accord avec la solution proposée.
  • Pensez à utiliser la balise [code] pour afficher du code, elle est cachée sous le bouton [#] dans l'éditeur.
  • Une discussion est terminée ? Alors le bouton est votre ami !
Michel Rotta est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 23/06/2011, 22h25   #7
Futur Membre du Club
 
Homme
Étudiant
Inscription : novembre 2008
Messages : 67
Détails du profil
Informations personnelles :
Sexe : Homme
Localisation : France

Informations professionnelles :
Activité : Étudiant
Secteur : High Tech - Éditeur de logiciels

Informations forums :
Inscription : novembre 2008
Messages : 67
Points : 16
Points : 16
Effectivement, ces 155 lignes superflues ne servaient qu'à rendre le code encore plus illisible...

Ok, voici :

Code :
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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
Institution:
  tableName: Institution
  columns:
    zone:
      type: string(255)
      notnull: true
    pays:
      type: string(255)
      notnull: true
    nomorga:
      type: string(255)
      notnull: true
    adresseorga:
      type: string(255)
  relations:
    Collaborations:
      class: Collaboration_internationale
      local: institution_id
      foreign: collaboration_internationale_id
      refClass: InstitutionCollab
    Zone:
      local: zone
      foreign: nom_zone
      foreignType: one
    Pays:
      local: pays
      foreign: nom_pays
      foreignType: one
 
#For more flexibility enums are transformed into new tables
Zone:
  tableName: Zone
  columns:
    nom_zone:
      type: string(255)
      primary: true
 
Pays:
  tableName: Pays
  columns:
    nom_pays:
      type: string(255)
      primary: true
 
InstitutionCollab:
  tableName: Institution_collab
  columns:
    collaboration_internationale_id:
      type: integer(8)
      primary: true
    institution_id:
      type: integer(8)
      primary: true
  relations:
    Institution:
      onDelete:       CASCADE
    Collaboration_internationale:
      onDelete:       CASCADE
 
Collaboration_internationale:
  tableName: Collaboration_internationale
  inheritance:
    type:             concrete
    extends:          Relation
  columns:
    porteurIU_id:
      type: integer(8)
      notnull: true
    porteurInternational_id:
      type: integer(8)
      notnull: true
  relations:
    Institutions:
      class: Institution
      local: collaboration_internationale_id
      foreign: institution_id
      refClass: InstitutionCollab
      foreignAlias: CollaborationsInternationales
    Porteurs_iu:
      class: Personne
      local: porteurIU_id
      foreign: personne_id
      refClass: statutIU
    Porteur_inter:
      class: Personne
      local: porteurInternational_id
      foreign: personne_id
      refClass: statut_inter
 
Statut_inter:
  tableName: statut_inter
  columns:
    collaboration_internationale_id:
      type: integer(8)
      primary: true
    personne_id:
      type: integer(8)
      primary: true
    libelle_statut:
       type: string(255)
       notnull: true
  relations:
    Personne:
      onDelete:       CASCADE
    Collaboration_internationale:
      onDelete:       CASCADE
    Libelle_statut_inter:
      local: libelle_statut
      foreign: nom_statut
      foreignType: one
 
#For more flexibility enums are transformed into new tables
LibelleStatutInter:
  tableName: Libelle_statut_inter
  columns:
    nom_statut:
      type: string(255)
      primary: true
 
StatutIU:
  tableName: statut_i_umr
  columns:
    personne_id:
      type: integer(8)
      primary: true
    collaboration_internationale_id:
      type: integer(8)
      primary: true
    libelle_statut:
      type: string(255)
      notnull: true
  relations:
    Personne:
      onDelete:       CASCADE
    Collaboration_internationale:
      onDelete:       CASCADE
    Libelle_statut_iu:
      local: libelle_statut
      foreign: nom_statut
 
#For more flexibility enums are transformed into new tables
LibelleStatutIU:
  tableName: Libelle_statut_iu
  columns:
    nom_statut:
      type: string(255)
 
Personne:
  tableName: Personne
  columns:
    nompersonne:
      type: string(255)
      notnull: true
    prenompersonne:
      type: string(255)
      notnull: true
    emailpersonne:
      type: string(255)
#This enum will not to be changed so, it's still an enum.
    sexepersonne:
      type: enum(1)
      values:
        - M
        - F
      notnull: true
    institution_id:
      type: integer(8)
      notnull: false
  relations:
    PersonneIU:
      class: Collaboration_internationale
      local: personne_id
      foreign: porteurIU_id
      refClass: statutIU
    PersonneInter:
      class: Collaboration_internationale
      local: personne_id
      foreign: porteurInternational_id
      refClass: statut_inter
    PersonneMob:
      class: Mobilite
      local: personne_id
      foreign: personneMobilite_id
      refClass: statut_mob
    Institution:
      local: institution_id
      foreign: id
      type: one
      foreignType: one
    Invitants_mobilites:
      class: Mobilite
      local: personne_id
      foreign: mobilite_id
      refClass: Invitants_mobilite
 
Statut_mob:
 
  tableName: statut_mob
  columns:
    personne_id:
      type: integer(8)
      primary: true
    mobilite_id:
      type: integer(8)
      primary: true
    libelle_statut:
      type: string(255)
      notnull: true
  relations:
    Personne:
      onDelete:       CASCADE
    Mobilite:
      onDelete:       CASCADE
    Libelle_statut_mob: 
      local: libelle_statut
      foreign: nom_statut
 
#For more flexibility enums are transformed into new tables
Libelle_statut_mob:
  tableName: Libelle_statut_mob
  columns:
    nom_statut:
      type: string(255)
 
Mobilite:
  tableName: Mobilite
  inheritance:
    type:             concrete
    extends:          Relation
  columns:
    type_mobilite:
      type: enum(9)
      values:
        - Incoming
        - Outcoming
      notnull: true
    nature:
      type: string(255)
      notnull: true
    financement:
      type: integer(4)
      unsigned: true
    institutionAccueil_id:
      type: integer(8)
      notnull: true
  relations:
    PersonnesMob:
      class: Personne
      local: personneMobilite_id
      foreign: personne_id
      refClass: statut_mob
    Invitants:
      class: Personne
      local: mobilite_id
      foreign: personne_id
      refClass: Invitants_mobilite
    Institution:
      local: institutionAccueil_id
      foreign: id
      type: one
      foreignType: one
 
Invitants_mobilite:
  tableName: Invitants_mobilite
  columns:
    mobilite_id:
      type: integer(8)
      primary: true
    personne_id:
      type: integer(8)
      primary: true
  relations:
    Personne:
      onDelete:       CASCADE
    Mobilite:
      onDelete:       CASCADE
 
Financement:
  tableName: Financement
  columns:
    datedebut:
      type: date(25)
      notnull: true
    datefin:
      type: date(25)
      notnull: true
    montant:
      type: integer(8)
      unsigned: true
      notnull: true
    institutionFinancement_id:
      type: integer(8)
      notnull: true
    contrat_id:
      type: integer(8)
      notnull: true
  relations:
    Formelle:
      local: contrat_id
      foreign: id
      onDelete: cascade
      type: one
    Institution:
      local: institutionFinancement_id
      foreign: id
      foreignType: one
 
Projet:
  tableName: Projet
  columns:
    titreprojet:
      type: string(255)
      notnull: true
    acronymeprojet:
      type: string(255)
    datedebut:
      type: date(25)
      default: ''
      notnull: true
    datefininitiale:
      type: date(25)
      default: ''
      notnull: true
    statut_p:
      type: string(255)
      notnull: true
    typeprogacc:
      type: string(255)
      notnull: true
  relations:
    RenouvellementProlongations:
      class: Renouvellement_prolongation
      local: id
      foreign: projet_id
      type: many
    Contrats:
      class: Formelle
      local: id
      foreign: projet_id
      type: many 
    Statut_p:
      local: statut_p
      foreign: nom_statutp
      type: one
    TypeProgAcc:
      local: typeprogacc
      foreign: nom_typeprogacc
      type: one
 
#For more flexibility enums are transformed into new tables
statut_p:
  tableName: statut_p
  columns:
    nom_statutp:
      type: string(255)
      primary: true
 
TypeProgAcc:
  tableName: Type_prog_acc
  columns:
    nom_typeprogacc:
      type: string(255)
      primary: true
 
Formelle:
  tableName: Formelle
  inheritance:
    type:             concrete
    extends:          Collaboration_internationale
  columns:
    programme_accord_id:
      type: integer(8)
      notnull: true
    projet_id:
      type: integer(8)
      notnull: true
    appelaprojet_id:
      type: integer(8)
      notnull: true
  relations:
    Projet:
      local: projet_id
      foreign: id
      onDelete: cascade
    ProgrammeAccord:
      foreignType: one
    Financements:
      class: Financement
      local: id
      foreign: contrat_id
      type: many
    AppelAProjet:
      local: AppelAProjet_id
      foreign: id
      onDelete: cascade
 
AppelAProjet:
 
  tableName: Appel_a_projet
  columns:
    nomAppel:
      type: string(255)
      notnull: true
    dateAppel:
      type: date(25)
      notnull: true
    duree:
      type: integer(4)
      unsigned: true
      notnull: true
    Gestionnaire_nat_id:
      type: integer(8)
      notnull: true
    Gestionnaire_centre_id:
      type: integer(8)
      notnull: true
    equipeAssociee:
      type: string(255)
      notnull: true
  relations:
    Personne:
      class: Personne
      local: Gestionnaire_centre_id
      foreign: id
      type: one
      foreignType: one
    Personne:
      class: Personne
      local: Gestionnaire_nat_id
      foreign: id
      type: one
      foreignType: one
    ContratsLies:
      class: Formelle
      local: contrat_id
      foreign: id 
      type: many
 
 
Informelle:
  tableName: Informelle
  inheritance:
    type:             concrete
    extends:          Collaboration_internationale
 
PartenaireIU:
  tableName: Partenaire_iu
  columns:
    equipeprojetdept:
      type: string(255)
      notnull: true
    domainedept:
      type: string(255)
    theme:
      type: string(255)
  relations:
    Relations:
      class: Relation
      local: PIU_id
      foreign: Relation_id
      refClass: RelationPartenaireIU
 
 
RelationPartenaireIU:
  tableName: Relation_partenaire_iu
  columns:
    PIU_id:
      type: integer
      primary: true
    Relation_id:
      type: integer
      primary: true
  relations:
    PartenaireIU:
      local: PIU_id
      foreign: id
      onDelete: CASCADE
    Relation:
      onDelete: CASCADE
 
ProgrammeAccord:
  tableName: Programme_accord
  columns:
    referenceacc:
      type: string(255)
    OrgaEmetteur_id:
      type: integer(8)
  relations:
    Institution:
      local: OrgaEmetteur_id
      foreign: id
      foreignType: one
 
Relation:
  tableName: Relation
  columns:
  relations:
    Partenaires:
      class: PartenaireIU
      local: Relation_id
      foreign: PIU_id
      refClass: RelationPartenaireIU
 
RenouvellementProlongation:
  tableName: Renouvellement_prolongation
  columns:
    projet_id:
      type: integer(8)
      notnull: true
    datedebut:
      type: date(25)
      notnull: true
    newdatefin:
      type: date(25)
      notnull: true
#This enum is also not going to be changed either, so still an enum.
    typerp:
      type: enum(12)
      values:
        - Renewal
        - Continuation
      notnull: true
  relations:
    Projet:
      local: projet_id
      foreign: id
      onDelete: cascade
Noobboy est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 24/06/2011, 09h39   #8
Modérateur
 
Avatar de Michel Rotta
 
Homme Michel Rotta
Responsable d'exploitation informatique
Inscription : septembre 2005
Messages : 4 913
Détails du profil
Informations personnelles :
Nom : Homme Michel Rotta
Âge : 49
Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

Informations professionnelles :
Activité : Responsable d'exploitation informatique
Secteur : Distribution

Informations forums :
Inscription : septembre 2005
Messages : 4 913
Points : 7 505
Points : 7 505
Partiellement retouché
Code :
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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
 
Institution:
  tableName: Institution
  columns:
    zone:
      type: string(255)
      notnull: true
    pays:
      type: string(255)
      notnull: true
    nomorga:
      type: string(255)
      notnull: true
    adresseorga:
      type: string(255)
  relations:
    Collaborations:
      class:        Collaboration_internationale
      refClass:     InstitutionCollab
      foreignAlias: Institutions
    Zone:
      local: zone
      foreign: nom_zone
      foreignAlias: Institutions
    Pays:
      local: pays
      foreign: nom_pays
      foreignAlias: Institutions
 
#For more flexibility enums are transformed into new tables
Zone:
  tableName: Zone
  columns:
    nom_zone:
      type: string(255)
      primary: true
 
Pays:
  tableName: Pays
  columns:
    nom_pays:
      type: string(255)
      primary: true
 
InstitutionCollab:
  tableName: Institution_collab
  columns:
    collaboration_internationale_id:
      type: integer(8)
      primary: true
    institution_id:
      type: integer(8)
      primary: true
  relations:
    Institution:
      onDelete:       CASCADE
      foreignAlias:   InstitutionCollabs
    Collaboration_internationale:
      onDelete:       CASCADE
      foreignAlias:   InstitutionCollabs
 
Collaboration_internationale:
  tableName: Collaboration_internationale
  inheritance:
    type:             concrete
    extends:          Relation
  columns:
    porteurIU_id:
      type: integer(8)
      notnull: true
    porteurInternational_id:
      type: integer(8)
      notnull: true
  relations:
    Porteurs_iu:
      class: Personne
      local: porteurIU_id
      foreignAlias: CollaborationInternationalesIUs
    Porteur_inter:
      class: Personne
      local: porteurInternational_id
      foreignAlias: CollaborationInternationalesInters
 
Statut_inter:
  tableName: statut_inter
  columns:
    collaboration_internationale_id:
      type: integer(8)
      primary: true
    personne_id:
      type: integer(8)
      primary: true
    libelle_statut:
       type: string(255)
       notnull: true
  relations:
    Personne:
      onDelete:       CASCADE
      foreignAlias:   StatutInters
    Collaboration_internationale:
      onDelete:       CASCADE
      foreignAlias:   StatutInters
    Libelle_statut_inter:
      class:          LibelleStatutInter
      local:          libelle_statut
      foreign:        nom_statut
      foreignAlias:   StatutInters
 
#For more flexibility enums are transformed into new tables
LibelleStatutInter:
  tableName: Libelle_statut_inter
  columns:
    nom_statut:
      type: string(255)
      primary: true
 
StatutIU:
  tableName: statut_i_umr
  columns:
    personne_id:
      type: integer(8)
      primary: true
    collaboration_internationale_id:
      type: integer(8)
      primary: true
    libelle_statut:
      type: string(255)
      notnull: true
  relations:
    Personne:
      onDelete:       CASCADE
      foreignAlias:   StatutIUs
    Collaboration_internationale:
      onDelete:       CASCADE
      foreignAlias:   StatutIUs
    Libelle_statut_iu:
      class: LibelleStatutIU
      local: libelle_statut
      foreign: nom_statut
      foreignAlias:   StatutIUs
 
#For more flexibility enums are transformed into new tables
LibelleStatutIU:
  tableName: Libelle_statut_iu
  columns:
    nom_statut:
      type: string(255)
 
Personne:
  tableName: Personne
  columns:
    nompersonne:
      type: string(255)
      notnull: true
    prenompersonne:
      type: string(255)
      notnull: true
    emailpersonne:
      type: string(255)
#This enum will not to be changed so, it's still an enum.
#Les enum sont toujours de mauvaises idée... même si cela ne change pas.
    sexepersonne:
      type: enum(1)
      values:
        - M
        - F
      notnull: true
    institution_id:
      type: integer(8)
      notnull: false
  relations:
    Institution:
      foreignAlias: Personnes
 
Statut_mob:
  tableName: statut_mob
  columns:
    personne_id:
      type: integer(8)
      primary: true
    mobilite_id:
      type: integer(8)
      primary: true
    libelle_statut:
      type: string(255)
      notnull: true
  relations:
    Personne:
      onDelete:       CASCADE
      foreignAlias:   StatutMobs
    Mobilite:
      onDelete:       CASCADE
      foreignAlias:   StatutMobs
    Libelle_statut_mob: 
      local:          libelle_statut
      foreign:        nom_statut
      foreignAlias:   StatutMobs
 
#For more flexibility enums are transformed into new tables
Libelle_statut_mob:
  tableName: Libelle_statut_mob
  columns:
    nom_statut:
      type: string(255)
      primary: true
 
Mobilite:
  tableName: Mobilite
  inheritance:
    type:             concrete
    extends:          Relation
  columns:
    type_mobilite:
      type: enum(9)
      values:
        - Incoming
        - Outcoming
      notnull: true
      # Mais que diantre cet enum venait-il faire dans cette gallère
    nature:
      type: string(255)
      notnull: true
    financement:
      type: integer(4)
      unsigned: true
    institutionAccueil_id:
      type: integer(8)
      notnull: true
  relations:
    Invitant:
      class: Personne
      local: mobilite_id
      foreignAlias: Mobilites
    Institution:
      local: institutionAccueil_id
      foreignAlias: Mobilites
      # En relation 1-1 ? M'étonnerait, repassé en 1-n
#-----------------------------------------------------------------------
# Fin de la relecture ici... 30m max atteind !
# Regardes toutes les modifications (même des s de ci de là)
# Et inspire toi de ce qui est au dessus pour terminer ce qui est au dessous
 
Invitants_mobilite:
  tableName: Invitants_mobilite
  columns:
    mobilite_id:
      type: integer(8)
      primary: true
    personne_id:
      type: integer(8)
      primary: true
  relations:
    Personne:
      onDelete:       CASCADE
    Mobilite:
      onDelete:       CASCADE
 
Financement:
  tableName: Financement
  columns:
    datedebut:
      type: date(25)
      notnull: true
    datefin:
      type: date(25)
      notnull: true
    montant:
      type: integer(8)
      unsigned: true
      notnull: true
    institutionFinancement_id:
      type: integer(8)
      notnull: true
    contrat_id:
      type: integer(8)
      notnull: true
  relations:
    Formelle:
      local: contrat_id
      foreign: id
      onDelete: cascade
      type: one
    Institution:
      local: institutionFinancement_id
      foreign: id
      foreignType: one
 
Projet:
  tableName: Projet
  columns:
    titreprojet:
      type: string(255)
      notnull: true
    acronymeprojet:
      type: string(255)
    datedebut:
      type: date(25)
      default: ''
      notnull: true
    datefininitiale:
      type: date(25)
      default: ''
      notnull: true
    statut_p:
      type: string(255)
      notnull: true
    typeprogacc:
      type: string(255)
      notnull: true
  relations:
    RenouvellementProlongations:
      class: Renouvellement_prolongation
      local: id
      foreign: projet_id
      type: many
    Contrats:
      class: Formelle
      local: id
      foreign: projet_id
      type: many 
    Statut_p:
      local: statut_p
      foreign: nom_statutp
      type: one
    TypeProgAcc:
      local: typeprogacc
      foreign: nom_typeprogacc
      type: one
 
#For more flexibility enums are transformed into new tables
statut_p:
  tableName: statut_p
  columns:
    nom_statutp:
      type: string(255)
      primary: true
 
TypeProgAcc:
  tableName: Type_prog_acc
  columns:
    nom_typeprogacc:
      type: string(255)
      primary: true
 
Formelle:
  tableName: Formelle
  inheritance:
    type:             concrete
    extends:          Collaboration_internationale
  columns:
    programme_accord_id:
      type: integer(8)
      notnull: true
    projet_id:
      type: integer(8)
      notnull: true
    appelaprojet_id:
      type: integer(8)
      notnull: true
  relations:
    Projet:
      local: projet_id
      foreign: id
      onDelete: cascade
    ProgrammeAccord:
      foreignType: one
    Financements:
      class: Financement
      local: id
      foreign: contrat_id
      type: many
    AppelAProjet:
      local: AppelAProjet_id
      foreign: id
      onDelete: cascade
 
AppelAProjet:
 
  tableName: Appel_a_projet
  columns:
    nomAppel:
      type: string(255)
      notnull: true
    dateAppel:
      type: date(25)
      notnull: true
    duree:
      type: integer(4)
      unsigned: true
      notnull: true
    Gestionnaire_nat_id:
      type: integer(8)
      notnull: true
    Gestionnaire_centre_id:
      type: integer(8)
      notnull: true
    equipeAssociee:
      type: string(255)
      notnull: true
  relations:
    Personne:
      class: Personne
      local: Gestionnaire_centre_id
      foreign: id
      type: one
      foreignType: one
    Personne:
      class: Personne
      local: Gestionnaire_nat_id
      foreign: id
      type: one
      foreignType: one
    ContratsLies:
      class: Formelle
      local: contrat_id
      foreign: id 
      type: many
 
 
Informelle:
  tableName: Informelle
  inheritance:
    type:             concrete
    extends:          Collaboration_internationale
 
PartenaireIU:
  tableName: Partenaire_iu
  columns:
    equipeprojetdept:
      type: string(255)
      notnull: true
    domainedept:
      type: string(255)
    theme:
      type: string(255)
  relations:
    Relations:
      class: Relation
      local: PIU_id
      foreign: Relation_id
      refClass: RelationPartenaireIU
 
 
RelationPartenaireIU:
  tableName: Relation_partenaire_iu
  columns:
    PIU_id:
      type: integer
      primary: true
    Relation_id:
      type: integer
      primary: true
  relations:
    PartenaireIU:
      local: PIU_id
      foreign: id
      onDelete: CASCADE
    Relation:
      onDelete: CASCADE
 
ProgrammeAccord:
  tableName: Programme_accord
  columns:
    referenceacc:
      type: string(255)
    OrgaEmetteur_id:
      type: integer(8)
  relations:
    Institution:
      local: OrgaEmetteur_id
      foreign: id
      foreignType: one
 
Relation:
  tableName: Relation
  columns:
  relations:
    Partenaires:
      class: PartenaireIU
      local: Relation_id
      foreign: PIU_id
      refClass: RelationPartenaireIU
 
RenouvellementProlongation:
  tableName: Renouvellement_prolongation
  columns:
    projet_id:
      type: integer(8)
      notnull: true
    datedebut:
      type: date(25)
      notnull: true
    newdatefin:
      type: date(25)
      notnull: true
#This enum is also not going to be changed either, so still an enum.
    typerp:
      type: enum(12)
      values:
        - Renewal
        - Continuation
      notnull: true
  relations:
    Projet:
      local: projet_id
      foreign: id
      onDelete: cascade
Corrections partiels
Regarde, pose les questions qui ne semblent pas évidentes, tiens compte de tout (le plus petit s est significatif)
Retouche le reste du shema.yml et revient par ici
__________________
Si tu donnes un poisson à un homme, il mangera un jour. Si tu lui apprends à pêcher, il mangera toujours (Lao Tseu).
  • Pensez à valoriser les réponses pertinantes, cliquez sur le bouton vert +1 pour indiquer votre accord avec la solution proposée.
  • Pensez à utiliser la balise [code] pour afficher du code, elle est cachée sous le bouton [#] dans l'éditeur.
  • Une discussion est terminée ? Alors le bouton est votre ami !
Michel Rotta est déconnecté   Envoyer un message privé Réponse avec citation 10
Vieux 24/06/2011, 11h02   #9
Futur Membre du Club
 
Homme
Étudiant
Inscription : novembre 2008
Messages : 67
Détails du profil
Informations personnelles :
Sexe : Homme
Localisation : France

Informations professionnelles :
Activité : Étudiant
Secteur : High Tech - Éditeur de logiciels

Informations forums :
Inscription : novembre 2008
Messages : 67
Points : 16
Points : 16
Ok, alors les questions qui me viennent :

- Pourquoi les foreignAlias ? Quel est son utilité ? Si j'ai bien compris, ça sert à customiser le nom de ce sur quoi on pointe mais là, je ne vois pas trop...

J'ai donc déduit de la disparition que Doctrine détecte automatiquement les id sur auquels on veut qu'il fasse référence, ok, je n'avais pas saisi ce point.

- Faire référence à une table d'associations n'est pas obligatoire dans les deux tables qui sont référencés ?

- Dans quel cas la mention "foreign" est-elle obligatoire dans une relation ?

Code :
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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
Institution:
  tableName: Institution
  columns:
    zone:
      type: string(255)
      notnull: true
    pays:
      type: string(255)
      notnull: true
    nomorga:
      type: string(255)
      notnull: true
    adresseorga:
      type: string(255)
  relations:
    Collaborations:
      class:        Collaboration_internationale
      refClass:     InstitutionCollab
      foreignAlias: Institutions
    Zone:
      local: zone
      foreign: nom_zone
      foreignAlias: Institutions
    Pays:
      local: pays
      foreign: nom_pays
      foreignAlias: Institutions
 
#For more flexibility, enums are transformed into new tables
Zone:
  tableName: Zone
  columns:
    nom_zone:
      type: string(255)
      primary: true
 
Pays:
  tableName: Pays
  columns:
    nom_pays:
      type: string(255)
      primary: true
 
InstitutionCollab:
  tableName: Institution_collab
  columns:
    collaboration_internationale_id:
      type: integer(8)
      primary: true
    institution_id:
      type: integer(8)
      primary: true
  relations:
    Institution:
      onDelete:       CASCADE
      foreignAlias:   InstitutionCollabs
    Collaboration_internationale:
      onDelete:       CASCADE
      foreignAlias:   InstitutionCollabs
 
Collaboration_internationale:
  tableName: Collaboration_internationale
  inheritance:
    type:             concrete
    extends:          Relation
  columns:
    porteurIU_id:
      type: integer(8)
      notnull: true
    porteurInternational_id:
      type: integer(8)
      notnull: true
  relations:
    Porteurs_iu:
      class: Personne
      local: porteurIU_id
      foreignAlias: CollaborationInternationalesIUs
    Porteur_inter:
      class: Personne
      local: porteurInternational_id
      foreignAlias: CollaborationInternationalesInters
 
Statut_inter:
  tableName: statut_inter
  columns:
    collaboration_internationale_id:
      type: integer(8)
      primary: true
    personne_id:
      type: integer(8)
      primary: true
    libelle_statut:
       type: string(255)
       notnull: true
  relations:
    Personne:
      onDelete:       CASCADE
      foreignAlias:   StatutInters
    Collaboration_internationale:
      onDelete:       CASCADE
      foreignAlias:   StatutInters
    Libelle_statut_inter:
      class:          LibelleStatutInter
      local:          libelle_statut
      foreign:        nom_statut
      foreignAlias:   StatutInters
 
#For more flexibility enums are transformed into new tables
LibelleStatutInter:
  tableName: Libelle_statut_inter
  columns:
    nom_statut:
      type: string(255)
      primary: true
 
StatutIU:
  tableName: statut_i_umr
  columns:
    personne_id:
      type: integer(8)
      primary: true
    collaboration_internationale_id:
      type: integer(8)
      primary: true
    libelle_statut:
      type: string(255)
      notnull: true
  relations:
    Personne:
      onDelete:       CASCADE
      foreignAlias:   StatutIUs
    Collaboration_internationale:
      onDelete:       CASCADE
      foreignAlias:   StatutIUs
    Libelle_statut_iu:
      class: LibelleStatutIU
      local: libelle_statut
      foreign: nom_statut
      foreignAlias:   StatutIUs
 
#For more flexibility enums are transformed into new tables
LibelleStatutIU:
  tableName: Libelle_statut_iu
  columns:
    nom_statut:
      type: string(255)
 
Personne:
  tableName: Personne
  columns:
    nompersonne:
      type: string(255)
      notnull: true
    prenompersonne:
      type: string(255)
      notnull: true
    emailpersonne:
      type: string(255)
    sexepersonne:
      type: string(255)
      notnull: true
    institution_id:
      type: integer(8)
      notnull: false
  relations:
    Institution:
      foreignAlias: Personnes
    Sexe:
      class: Sexe
      local: sexepersonne
      foreign: sexe
      foreignAlias: Personnes
Sexe:
  tableName: Sexe
  columns:
    sexe:
      type: string(255)
      primary: true
 
Statut_mob:
  tableName: statut_mob
  columns:
    personne_id:
      type: integer(8)
      primary: true
    mobilite_id:
      type: integer(8)
      primary: true
    libelle_statut:
      type: string(255)
      notnull: true
  relations:
    Personne:
      onDelete:       CASCADE
      foreignAlias:   StatutMobs
    Mobilite:
      onDelete:       CASCADE
      foreignAlias:   StatutMobs
    Libelle_statut_mob: 
      local:          libelle_statut
      foreign:        nom_statut
      foreignAlias:   StatutMobs
 
#For more flexibility enums are transformed into new tables
Libelle_statut_mob:
  tableName: Libelle_statut_mob
  columns:
    nom_statut:
      type: string(255)
      primary: true
 
Mobilite:
  tableName: Mobilite
  inheritance:
    type:             concrete
    extends:          Relation
  columns:
    type_mobilite:
      type: string(255)
      notnull: true
    nature:
      type: string(255)
      notnull: true
    financement:
      type: integer(4)
      unsigned: true
    institutionAccueil_id:
      type: integer(8)
      notnull: true
  relations:
    Invitant:
      class: Personne
      local: id
      foreignAlias: Mobilites
    Institution:
      local: institutionAccueil_id
      foreignAlias: Mobilites
    TypeMobilite:
      local: type_mobilite
      foreign: type_m
      foreignAlias: Mobilites
 
TypeMobilite:
  tableName: Type_mobilite
  columns:
    type_m:
      type: string(255)
      primary: true
 
#-----------------------------------------------------------------------
# Fin de la relecture ici... 30m max atteind !
# Regardes toutes les modifications (même des s de ci de là)
# Et inspire toi de ce qui est au dessus pour terminer ce qui est au dessous
 
Invitants_mobilite:
  tableName: Invitants_mobilite
  columns:
    mobilite_id:
      type: integer(8)
      primary: true
    personne_id:
      type: integer(8)
      primary: true
  relations:
    Personne:
      onDelete:       CASCADE
      foreignAlias: Invitants_mobilites
    Mobilite:
      onDelete:       CASCADE
      foreignAlias: Invitants_mobilites
 
Financement:
  tableName: Financement
  columns:
    datedebut:
      type: date(25)
      notnull: true
    datefin:
      type: date(25)
      notnull: true
    montant:
      type: integer(8)
      unsigned: true
      notnull: true
    institutionFinancement_id:
      type: integer(8)
      notnull: true
    contrat_id:
      type: integer(8)
      notnull: true
  relations:
    Formelle:
      local: contrat_id
      foreign: id
      onDelete: CASCADE
      foreignAlias: Financements
    Institution:
      local: institutionFinancement_id
      foreign: id
      foreignAlias: Financements
 
Projet:
  tableName: Projet
  columns:
    titreprojet:
      type: string(255)
      notnull: true
    acronymeprojet:
      type: string(255)
    datedebut:
      type: date(25)
      default: ''
      notnull: true
    datefininitiale:
      type: date(25)
      default: ''
      notnull: true
    statut_p:
      type: string(255)
      notnull: true
    typeprogacc:
      type: string(255)
      notnull: true
  relations:
    RenouvellementProlongations:
      class: Renouvellement_prolongation
      local: id
      foreign: projet_id
      type: many
    Contrats:
      class: Formelle
      local: id
      foreign: projet_id
      type: many 
    Statut_p:
      local: statut_p
      foreign: nom_statutp
      foreignAlias: Financements
    TypeProgAcc:
      local: typeprogacc
      foreign: nom_typeprogacc
      foreignAlias: Financements
 
#For more flexibility enums are transformed into new tables
statut_p:
  tableName: statut_p
  columns:
    nom_statutp:
      type: string(255)
      primary: true
 
TypeProgAcc:
  tableName: Type_prog_acc
  columns:
    nom_typeprogacc:
      type: string(255)
      primary: true
 
Formelle:
  tableName: Formelle
  inheritance:
    type:             concrete
    extends:          Collaboration_internationale
  columns:
    programme_accord_id:
      type: integer(8)
      notnull: true
    projet_id:
      type: integer(8)
      notnull: true
    appelaprojet_id:
      type: integer(8)
      notnull: true
  relations:
    Projet:
      local: projet_id
      onDelete: cascade
      foreignAlias: Formelles
    ProgrammeAccord:
      local: programme_accord_id
      foreignAlias: Formelles
    AppelAProjet:
      local: AppelAProjet_id
      onDelete: cascade
      foreignAlias: Formelles
 
AppelAProjet:
  tableName: Appel_a_projet
  columns:
    nomAppel:
      type: string(255)
      notnull: true
    dateAppel:
      type: date(25)
      notnull: true
    duree:
      type: integer(4)
      unsigned: true
      notnull: true
    Gestionnaire_nat_id:
      type: integer(8)
      notnull: true
    Gestionnaire_centre_id:
      type: integer(8)
      notnull: true
    equipeAssociee:
      type: string(255)
      notnull: true
  relations:
    Personne:
      class: Personne
      local: Gestionnaire_centre_id
      foreignAlias: AppelAProjets
    Personne:
      class: Personne
      local: Gestionnaire_nat_id
      foreignAlias: AppelAProjets
    ContratsLies:
      class: Formelle
      local: contrat_id
      type: many
      foreignAlias: AppelAProjets
 
 
Informelle:
  tableName: Informelle
  inheritance:
    type:             concrete
    extends:          Collaboration_internationale
 
PartenaireIU:
  tableName: Partenaireiu
  columns:
    equipeprojetdept:
      type: string(255)
      notnull: true
    domainedept:
      type: string(255)
    theme:
      type: string(255)
 
 
PartenaireIURelation:
  tableName: partenaireiu_Relation
  columns:
    id:
      type: integer
      primary: true
    id:
      type: integer
      primary: true
  relations:
    PartenaireIU:
      onDelete: CASCADE
      local: id
      foreign: id
      foreignAlias: PartenaireIURelations
    Relation:
      onDelete: CASCADE
      local: id
      foreign: id
      foreignAlias: PartenaireIURelations
 
Relation:
  tableName: Relation
  columns:
  relations:
    Partenaires:
      class: PartenaireIU
      local: id
      foreign: id
      foreignAlias: Relations
 
ProgrammeAccord:
  tableName: Programme_accord
  columns:
    referenceacc:
      type: string(255)
    OrgaEmetteur_id:
      type: integer(8)
  relations:
    Institution:
      local: OrgaEmetteur_id
      foreignAlias: ProgrammeAccords
 
RenouvellementProlongation:
  tableName: Renouvellement_prolongation
  columns:
    projet_id:
      type: integer(8)
      notnull: true
    datedebut:
      type: date(25)
      notnull: true
    newdatefin:
      type: date(25)
      notnull: true
#This enum is also not going to be changed either, so still an enum.
    typerp:
      type: string(12)
      notnull: true
  relations:
    Projet:
      local: projet_id
      onDelete: cascade
      foreignAlias: RenouvellementProlongations
    TypeRP:
      local: typerp
      foreign: typerp
      foreignAlias: RenouvellementProlongations
 
TypeRP:
  tableName: Type_rp
  columns:
    typerp:
      type: string(12)
      primary: true
Noobboy est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 24/06/2011, 17h43   #10
Modérateur
 
Avatar de Michel Rotta
 
Homme Michel Rotta
Responsable d'exploitation informatique
Inscription : septembre 2005
Messages : 4 913
Détails du profil
Informations personnelles :
Nom : Homme Michel Rotta
Âge : 49
Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

Informations professionnelles :
Activité : Responsable d'exploitation informatique
Secteur : Distribution

Informations forums :
Inscription : septembre 2005
Messages : 4 913
Points : 7 505
Points : 7 505
Citation:
- Pourquoi les foreignAlias ? Quel est son utilité ? Si j'ai bien compris, ça sert à customiser le nom de ce sur quoi on pointe mais là, je ne vois pas trop...
Une relation ne doit être décrite que sur une des deux tables mise en relation. Le nom de la relation depuis cette table est ... le nom de la relation. Le foreignAlias permet de définir le nom de la relation depuis l'autre table mise en relation.

Citation:
J'ai donc déduit de la disparition que Doctrine détecte automatiquement les id sur auquels on veut qu'il fasse référence, ok, je n'avais pas saisi ce point.
Le local est par défaut "<NomDeLaClasse>_id" et le foreign est "id".

Citation:
- Faire référence à une table d'associations n'est pas obligatoire dans les deux tables qui sont référencés ?
La table de relation n'est utilisée que dans le cas de la description d'une relation n-n et seulement pour la déclaration qui permet de "chuinter" la vision de la table intermédiaire.

Citation:
- Dans quel cas la mention "foreign" est-elle obligatoire dans une relation ?
! A chaque fois qu'elle est différente de sa valeur par défaut ! Ce qui est logique et vrai pour toutes les autres options local, type, foreignType,...
__________________
Si tu donnes un poisson à un homme, il mangera un jour. Si tu lui apprends à pêcher, il mangera toujours (Lao Tseu).
  • Pensez à valoriser les réponses pertinantes, cliquez sur le bouton vert +1 pour indiquer votre accord avec la solution proposée.
  • Pensez à utiliser la balise [code] pour afficher du code, elle est cachée sous le bouton [#] dans l'éditeur.
  • Une discussion est terminée ? Alors le bouton est votre ami !
Michel Rotta est déconnecté   Envoyer un message privé Réponse avec citation 10
Vieux 27/06/2011, 10h22   #11
Futur Membre du Club
 
Homme
Étudiant
Inscription : novembre 2008
Messages : 67
Détails du profil
Informations personnelles :
Sexe : Homme
Localisation : France

Informations professionnelles :
Activité : Étudiant
Secteur : High Tech - Éditeur de logiciels

Informations forums :
Inscription : novembre 2008
Messages : 67
Points : 16
Points : 16
Voici donc mon schema.yml, épuré. (Encore plus qu'au dessus.)

Merci de tes explications, ça allège bien le code. ^^"

Question liée : en générant les modules et les CRUD associés, lors de la création d'un Projet, je me retrouve avec un champ texte pour le statut_p mais une liste déroulante pour mon typeProgAcc, pourquoi ?

Code :
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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
Institution:
  tableName: Institution
  columns:
    zone:
      type: string(255)
      notnull: true
    pays:
      type: string(255)
      notnull: true
    nomorga:
      type: string(255)
      notnull: true
    adresseorga:
      type: string(255)
  relations:
    Collaborations:
      class:        Collaboration_internationale
      refClass:     InstitutionCollab
      foreignAlias: Institutions
    Zone:
      local: zone
      foreign: nom_zone
      foreignAlias: Institutions
    Pays:
      local: pays
      foreign: nom_pays
      foreignAlias: Institutions
 
#For more flexibility, enums are transformed into new tables
Zone:
  tableName: Zone
  columns:
    nom_zone:
      type: string(255)
      primary: true
 
Pays:
  tableName: Pays
  columns:
    nom_pays:
      type: string(255)
      primary: true
 
InstitutionCollab:
  tableName: Institution_collab
  columns:
    collaboration_internationale_id:
      type: integer(8)
      primary: true
    institution_id:
      type: integer(8)
      primary: true
  relations:
    Institution:
      onDelete:       CASCADE
      foreignAlias:   InstitutionCollabs
    Collaboration_internationale:
      onDelete:       CASCADE
      foreignAlias:   InstitutionCollabs
 
Relation:
  tableName: Relation
  columns:
  relations:
    Partenaires:
      class: PartenaireIU
      foreignAlias: Relations
 
Collaboration_internationale:
  tableName: Collaboration_internationale
  inheritance:
    type:             concrete
    extends:          Relation
  columns:
    porteurIU_id:
      type: integer(8)
      notnull: true
    porteurInternational_id:
      type: integer(8)
      notnull: true
  relations:
    Porteurs_iu:
      class: Personne
      local: porteurIU_id
      foreignAlias: CollaborationInternationalesIUs
    Porteur_inter:
      class: Personne
      local: porteurInternational_id
      foreignAlias: CollaborationInternationalesInters
 
Statut_inter:
  tableName: statut_inter
  columns:
    collaboration_internationale_id:
      type: integer(8)
      primary: true
    personne_id:
      type: integer(8)
      primary: true
    libelle_statut:
       type: string(255)
       notnull: true
  relations:
    Personne:
      onDelete:       CASCADE
      foreignAlias:   StatutInters
    Collaboration_internationale:
      onDelete:       CASCADE
      foreignAlias:   StatutInters
    Libelle_statut_inter:
      class:          LibelleStatutInter
      local:          libelle_statut
      foreign:        nom_statut
      foreignAlias:   StatutInters
 
#For more flexibility enums are transformed into new tables
LibelleStatutInter:
  tableName: Libelle_statut_inter
  columns:
    nom_statut:
      type: string(255)
      primary: true
 
StatutIU:
  tableName: statut_i_umr
  columns:
    personne_id:
      type: integer(8)
      primary: true
    collaboration_internationale_id:
      type: integer(8)
      primary: true
    libelle_statut:
      type: string(255)
      notnull: true
  relations:
    Personne:
      onDelete:       CASCADE
      foreignAlias:   StatutIUs
    Collaboration_internationale:
      onDelete:       CASCADE
      foreignAlias:   StatutIUs
    Libelle_statut_iu:
      class: LibelleStatutIU
      local: libelle_statut
      foreign: nom_statut
      foreignAlias:   StatutIUs
 
#For more flexibility enums are transformed into new tables
LibelleStatutIU:
  tableName: Libelle_statut_iu
  columns:
    nom_statut:
      type: string(255)
 
Personne:
  tableName: Personne
  columns:
    nompersonne:
      type: string(255)
      notnull: true
    prenompersonne:
      type: string(255)
      notnull: true
    emailpersonne:
      type: string(255)
    sexepersonne:
      type: string(255)
      notnull: true
    institution_id:
      type: integer(8)
      notnull: false
  relations:
    Institution:
      foreignAlias: Personnes
    Sexe:
      class: Sexe
      local: sexepersonne
      foreign: sexe
      foreignAlias: Personnes
Sexe:
  tableName: Sexe
  columns:
    sexe:
      type: string(255)
      primary: true
 
Statut_mob:
  tableName: statut_mob
  columns:
    personne_id:
      type: integer(8)
      primary: true
    mobilite_id:
      type: integer(8)
      primary: true
    libelle_statut:
      type: string(255)
      notnull: true
  relations:
    Personne:
      onDelete:       CASCADE
      foreignAlias:   StatutMobs
    Mobilite:
      onDelete:       CASCADE
      foreignAlias:   StatutMobs
    Libelle_statut_mob: 
      local:          libelle_statut
      foreign:        nom_statut
      foreignAlias:   StatutMobs
 
#For more flexibility enums are transformed into new tables
Libelle_statut_mob:
  tableName: Libelle_statut_mob
  columns:
    nom_statut:
      type: string(255)
      primary: true
 
Mobilite:
  tableName: Mobilite
  inheritance:
    type:             concrete
    extends:          Relation
  columns:
    type_mobilite:
      type: string(255)
      notnull: true
    nature:
      type: string(255)
      notnull: true
    financement:
      type: integer(4)
      unsigned: true
    institutionAccueil_id:
      type: integer(8)
      notnull: true
  relations:
    Invitant:
      class: Personne
      local: id
      foreignAlias: Mobilites
    Institution:
      local: institutionAccueil_id
      foreignAlias: Mobilites
    TypeMobilite:
      local: type_mobilite
      foreign: type_m
      foreignAlias: Mobilites
 
TypeMobilite:
  tableName: Type_mobilite
  columns:
    type_m:
      type: string(255)
      primary: true
 
#-----------------------------------------------------------------------
 
Invitants_mobilite:
  tableName: Invitants_mobilite
  columns:
    mobilite_id:
      type: integer(8)
      primary: true
    personne_id:
      type: integer(8)
      primary: true
  relations:
    Personne:
      onDelete:       CASCADE
      foreignAlias: Invitants_mobilites
    Mobilite:
      onDelete:       CASCADE
      foreignAlias: Invitants_mobilites
 
Financement:
  tableName: Financement
  columns:
    datedebut:
      type: date(25)
      notnull: true
    datefin:
      type: date(25)
      notnull: true
    montant:
      type: integer(8)
      unsigned: true
      notnull: true
    institutionFinancement_id:
      type: integer(8)
      notnull: true
    contrat_id:
      type: integer(8)
      notnull: true
  relations:
    Formelle:
      local: contrat_id
      onDelete: CASCADE
      foreignAlias: Financements
    Institution:
      local: institutionFinancement_id
      foreignAlias: Financements
 
Projet:
  tableName: Projet
  columns:
    titreprojet:
      type: string(255)
      notnull: true
    acronymeprojet:
      type: string(255)
    datedebut:
      type: date(25)
      default: ''
      notnull: true
    datefininitiale:
      type: date(25)
      default: ''
      notnull: true
    statut_p:
      type: string(255)
      notnull: true
    typeprogacc:
      type: string(255)
      notnull: true
  relations:
    RenouvellementProlongations:
      class: Renouvellement_prolongation
      local: id
      foreign: projet_id
      type: many
    Contrats:
      class: Formelle
      local: id
      foreign: projet_id
      type: many 
    Statut_p:
      local: statut_p
      foreign: nom_statutp
      foreignAlias: Financements
    TypeProgAcc:
      local: typeprogacc
      foreign: nom_typeprogacc
      foreignAlias: Financements
 
#For more flexibility enums are transformed into new tables
statut_p:
  tableName: statut_p
  columns:
    nom_statutp:
      type: string(255)
      primary: true
 
TypeProgAcc:
  tableName: Type_prog_acc
  columns:
    nom_typeprogacc:
      type: string(255)
      primary: true
 
Formelle:
  tableName: Formelle
  inheritance:
    type:             concrete
    extends:          Collaboration_internationale
  columns:
    programme_accord_id:
      type: integer(8)
      notnull: true
    projet_id:
      type: integer(8)
      notnull: true
    appelaprojet_id:
      type: integer(8)
      notnull: true
  relations:
    Projet:
      local: projet_id
      onDelete: cascade
      foreignAlias: Formelles
    ProgrammeAccord:
      local: programme_accord_id
      foreignAlias: Formelles
    AppelAProjet:
      local: AppelAProjet_id
      onDelete: cascade
      foreignAlias: Formelles
 
AppelAProjet:
  tableName: Appel_a_projet
  columns:
    nomAppel:
      type: string(255)
      notnull: true
    dateAppel:
      type: date(25)
      notnull: true
    duree:
      type: integer(4)
      unsigned: true
      notnull: true
    Gestionnaire_nat_id:
      type: integer(8)
      notnull: true
    Gestionnaire_centre_id:
      type: integer(8)
      notnull: true
    equipeAssociee:
      type: string(255)
      notnull: true
  relations:
    Personne:
      class: Personne
      local: Gestionnaire_centre_id
      foreignAlias: AppelAProjets
    Personne:
      class: Personne
      local: Gestionnaire_nat_id
      foreignAlias: AppelAProjets
    ContratsLies:
      class: Formelle
      local: contrat_id
      type: many
      foreignAlias: AppelAProjets
 
 
Informelle:
  tableName: Informelle
  inheritance:
    type:             concrete
    extends:          Collaboration_internationale
 
Partenaireiu:
  tableName: Partenaireiu
  columns:
    equipeprojetdept:
      type: string(255)
      notnull: true
    domainedept:
      type: string(255)
    theme:
      type: string(255)
 
 
PartenaireIURelation:
  tableName: partenaireiu_Relation
  columns:
    partenaireiu_id:
      type: integer
      primary: true
    relation_id:
      type: integer
      primary: true
  relations:
    PartenaireIU:
      onDelete: CASCADE
      foreignAlias: PartenaireIURelations
    Relation:
      onDelete: CASCADE
      foreignAlias: PartenaireIURelations
 
ProgrammeAccord:
  tableName: Programme_accord
  columns:
    referenceacc:
      type: string(255)
    OrgaEmetteur_id:
      type: integer(8)
  relations:
    Institution:
      local: OrgaEmetteur_id
      foreignAlias: ProgrammeAccords
 
RenouvellementProlongation:
  tableName: Renouvellement_prolongation
  columns:
    projet_id:
      type: integer(8)
      notnull: true
    datedebut:
      type: date(25)
      notnull: true
    newdatefin:
      type: date(25)
      notnull: true
#This enum is also not going to be changed either, so still an enum.
    typerp:
      type: string(12)
      notnull: true
  relations:
    Projet:
      onDelete: cascade
      foreignAlias: RenouvellementProlongations
    TypeRP:
      local: typerp
      foreign: typerp
      foreignAlias: RenouvellementProlongations
 
TypeRP:
  tableName: Type_rp
  columns:
    typerp:
      type: string(12)
      primary: true
Noobboy est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 28/06/2011, 13h56   #12
Modérateur
 
Avatar de Michel Rotta
 
Homme Michel Rotta
Responsable d'exploitation informatique
Inscription : septembre 2005
Messages : 4 913
Détails du profil
Informations personnelles :
Nom : Homme Michel Rotta
Âge : 49
Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

Informations professionnelles :
Activité : Responsable d'exploitation informatique
Secteur : Distribution

Informations forums :
Inscription : septembre 2005
Messages : 4 913
Points : 7 505
Points : 7 505
Ton statut_p est une clef d'association utilisée dans la relation statut_p (accessoirement, il devrait plutôt être numérique et s'appeler statut_p_id).

Dans le cas d'une clef d'association, il crée une sélect. Tu peux modifier dans l'objet form er redéfinissant le widget (et le validator probablement). Attention, si tu as une valeur dans statut_p qui n'existe pas dans la table associée, ceci pourrait générer des problèmes.

Pas eu trop le temps de relire le modèle.
__________________
Si tu donnes un poisson à un homme, il mangera un jour. Si tu lui apprends à pêcher, il mangera toujours (Lao Tseu).
  • Pensez à valoriser les réponses pertinantes, cliquez sur le bouton vert +1 pour indiquer votre accord avec la solution proposée.
  • Pensez à utiliser la balise [code] pour afficher du code, elle est cachée sous le bouton [#] dans l'éditeur.
  • Une discussion est terminée ? Alors le bouton est votre ami !
Michel Rotta est déconnecté   Envoyer un message privé Réponse avec citation 10
Vieux 08/07/2011, 15h52   #13
Futur Membre du Club
 
Homme
Étudiant
Inscription : novembre 2008
Messages : 67
Détails du profil
Informations personnelles :
Sexe : Homme
Localisation : France

Informations professionnelles :
Activité : Étudiant
Secteur : High Tech - Éditeur de logiciels

Informations forums :
Inscription : novembre 2008
Messages : 67
Points : 16
Points : 16
Bon, je croyais le soucis résolu mais...non.

J'ai toujours un soucis quand j'ajoute une nouvelle "informelle" : il n'apprécie pas que je veuille mettre un id d'une classe fille à la place d'un id de sa classe mère dans une table de liaison.

Y-a-t-il un moyen de contourner ça ?

Je vois la solution évidente de supprimer la classe mère et de séparer complètement les deux tables mais ça fait de la redondance de code inutiles et des tables supplémentaires. Si c'est la seule solution, je suis près à la mettre en place mais ça me paraît lourd...

Code :
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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
Institution:
  tableName: Institution
  columns:
    zone:
      type: string(255)
      notnull: true
    pays:
      type: string(255)
      notnull: true
    nominstitution:
      type: string(255)
      notnull: true
    codepostalorga:
      type: int(5)
      unsigned: true
    ville:
      type: string(255)
    Etat:
      type: string(255)
  relations:
    Zone:
      local: zone
      foreign: nom_zone
      foreignAlias: Institutions
    Pays:
      local: pays
      foreign: nom_pays
      foreignAlias: Institutions
 
#For more flexibility, enums are transformed into new tables
Zone:
  tableName: Zone
  columns:
    nom_zone:
      type: string(255)
      primary: true
 
Pays:
  tableName: Pays
  columns:
    nom_pays:
      type: string(255)
      primary: true
 
#-----------------------------------------------
 
InstitutionInformelle:
  tableName: Institutioninformelle
  columns:
    informelle_id:
      type: integer(8)
      primary: true
    institution_id:
      type: integer(8)
      primary: true
  relations:
    Institution:
      onDelete:       CASCADE
      foreignAlias:   InstitutionInformelles
    Informelle:
      onDelete:       CASCADE
      foreignAlias:   InstitutionInformelles
 
#-----------------------------------------------
 
InstitutionFormelle:
  tableName: Institutionformelle
  columns:
    formelle_id:
      type: integer(8)
      primary: true
    institution_id:
      type: integer(8)
      primary: true
    financement_id:
      type: integer(8)
  relations:
    Institution:
      onDelete:       CASCADE
      foreignAlias:   InstitutionFormelles
    Formelle:
      onDelete:       CASCADE
      foreignAlias:   InstitutionFormelles
    Financement:
      foreignAlias: InstitutionFormelles
 
#-----------------------------------------------
 
Collaboration_internationale:
  tableName: Collaboration_internationale
  columns:
  relations:
    EquipeiuCollabs:
      class: Equipeiu
      refClass: EquipeiuCollab
      foreignAlias: CollaborationInternationales
    Porteurs_iu:
      class: Personne
      refClass: Collaboration_internationale_porteurius
      foreignAlias: CollaborationInternationales
    Porteur_inter:
      class: Personne
      refClass: Collaboration_internationale_porteurinters
      foreignAlias: CollaborationInternationales
 
Collaboration_internationale_porteurinters:
  tableName: Collaboration_internationale_porteurinters
  columns:
    Collaboration_internationale_id:
      type: integer(8)
      primary: true
    personne_id:
      type: integer(8)
      primary: true
 
Collaboration_internationale_porteurius:
  tableName: Collaboration_internationale_porteurius
  columns:
   Collaboration_internationale_id:
      type: integer(8)
      primary: true
   personne_id:
      type: integer(8)
      primary: true
 
 
 #-----------------------------------------------
 
Statut_inter:
  tableName: statut_inter
  columns:
    collaboration_internationale_id:
      type: integer(8)
      primary: true
    personne_id:
      type: integer(8)
      primary: true
    libelle_statut:
       type: string(255)
       notnull: true
  relations:
    Personne:
      onDelete:       CASCADE
      foreignAlias:   StatutInters
    Collaboration_internationale:
      onDelete:       CASCADE
      foreignAlias:   StatutInters
    Libelle_statut_inter:
      class:          LibelleStatutInter
      local:          libelle_statut
      foreign:        nom_statut
      foreignAlias:   StatutInters
 
#For more flexibility enums are transformed into new tables
LibelleStatutInter:
  tableName: Libelle_statut_inter
  columns:
    nom_statut:
      type: string(255)
      primary: true
 
#-----------------------------------------------
 
StatutIU:
  tableName: statutiu
  columns:
    personne_id:
      type: integer(8)
      primary: true
    collaboration_internationale_id:
      type: integer(8)
      primary: true
    libelle_statut:
      type: string(255)
      notnull: true
  relations:
    Personne:
      onDelete:       CASCADE
      foreignAlias:   StatutIUs
    Collaboration_internationale:
      onDelete:       CASCADE
      foreignAlias:   StatutIUs
    Libelle_statut_iu:
      class: LibelleStatutIU
      local: libelle_statut
      foreign: nom_statut
      foreignAlias:   StatutIUs
 
#For more flexibility enums are transformed into new tables
LibelleStatutIU:
  tableName: Libelle_statut_iu
  columns:
    nom_statut:
      type: string(255)
 
#-----------------------------------------------
 
Personne:
  tableName: Personne
  columns:
    nompersonne:
      type: string(255)
      notnull: true
    nom2personne:
      type: string(255)
      notnull: true
    prenompersonne:
      type: string(255)
    prenom2personne:
      type: string(255)
    emailpersonne:
      type: string(255)
    sexepersonne:
      type: string(255)
      notnull: true
    institution_id:
      type: integer(8)
      notnull: false
    statut_personne:
      type: string(255)
      notnull: true
  relations:
    Institution:
      foreignAlias: Personnes
    Sexe:
      class: Sexe
      local: sexepersonne
      foreign: sexe
      foreignAlias: Personnes
    Libelle_statut_personne:
      class: Libelle_statut_personne
      local: statut_personne
      foreign: nom_statut
      foreignAlias: Personnes
Sexe:
  tableName: Sexe
  columns:
    sexe:
      type: string(255)
      primary: true
 
#-----------------------------------------------
 
Personne_concernee:
  tableName: personne_concernee
  columns:
    personne_id:
      type: integer(8)
      primary: true
    mobilite_id:
      type: integer(8)
      primary: true
    institution_id:
      type: integer(8)
      notnull: true
    libelle_statut:
      type: string(255)
      notnull: true
  relations:
    Personne:
      onDelete:       CASCADE
      foreignAlias:   PersonneConcernees
    Mobilite:
      onDelete:       CASCADE
      foreignAlias:   PersonneConcernees
    Libelle_statut_personneconcernee: 
      local:          libelle_statut
      foreign:        nom_statut
      foreignAlias:   PersonneConcernees
    Instution:
      foreignAlias:   PersonneConcernees
 
#For more flexibility enums are transformed into new tables
Libelle_statut_personne:
  tableName: Libelle_statut_personne
  columns:
    nom_statut:
      type: string(255)
      primary: true
 
Libelle_statut_personneconcernee:
  tableName: Libelle_statut_personneconcernee
  columns:
    nom_statut:
      type: string(255)
      primary: true
 
#-----------------------------------------------
 
Mobilite:
  tableName: Mobilite
  columns:
    type_mobilite:
      type: string(255)
      notnull: true
    nature:
      type: string(255)
      notnull: true
    financement:
      type: integer(4)
      notnull: true
    institutionPartenaire_id:
      type: integer(8)
      notnull: true
    Equipeiu_id:
      type: integer(8)
    CollaborationInternationale_liee:
      type: integer(8)
  relations:
    Invitant:
      class: Personne
      refClass: Invitants_mobilite
      foreignAlias: Mobilites
    Institution:
      local: institutionPartenaire_id
      foreignAlias: Mobilites
    TypeMobilite:
      local: type_mobilite
      foreign: type_m
      foreignAlias: Mobilites
    CollaborationInternationale:
      local: CollaborationInternationale_liee
      foreignAlias: Mobilites
    Equipeiu:
      foreignAlias: Mobilites
 
TypeMobilite:
  tableName: Type_mobilite
  columns:
    type_m:
      type: string(255)
      primary: true
 
#-----------------------------------------------
 
Invitants_mobilite:
  tableName: Invitants_mobilite
  columns:
    mobilite_id:
      type: integer(8)
      primary: true
    personne_id:
      type: integer(8)
      primary: true
  relations:
    Personne:
      onDelete:       CASCADE
      foreignAlias: Invitants_mobilites
    Mobilite:
      onDelete:       CASCADE
      foreignAlias: Invitants_mobilites
 
#-----------------------------------------------
 
Financement:
  tableName: Financement
  columns:
    datedebut:
      type: date(25)
      notnull: true
    datefin:
      type: date(25)
      notnull: true
    montant:
      type: integer(8)
      unsigned: true
      notnull: true
    institutionFinancement_id:
      type: integer(8)
      notnull: true
  relations:
    Institution:
      local: institutionFinancement_id
      foreignAlias: Financements
 
#-----------------------------------------------
 
Projet:
  tableName: Projet
  columns:
    titreprojet:
      type: string(255)
      notnull: true
    acronymeprojet:
      type: string(255)
    datedebut:
      type: date(25)
      default: ''
      notnull: true
    datefininitiale:
      type: date(25)
      default: ''
      notnull: true
    statut_p:
      type: string(255)
      notnull: true
    typeprogacc:
      type: string(255)
      notnull: true
  relations:
    RenouvellementProlongations:
      class: Renouvellement_prolongation
      local: id
      foreign: projet_id
      type: many
    Contrats:
      class: Formelle
      local: id
      foreign: projet_id
      type: many 
    Statut_p:
      local: statut_p
      foreign: nom_statutp
      foreignAlias: Financements
    TypeProgAcc:
      local: typeprogacc
      foreign: nom_typeprogacc
      foreignAlias: Financements
 
#For more flexibility enums are transformed into new tables
statut_p:
  tableName: statut_p
  columns:
    nom_statutp:
      type: string(255)
      primary: true
 
TypeProgAcc:
  tableName: Type_prog_acc
  columns:
    nom_typeprogacc:
      type: string(255)
      primary: true
 
#-----------------------------------------------
 
Formelle:
  tableName: Formelle
  inheritance:
    type:             concrete
    extends:          Collaboration_internationale
  columns:
    programme_accord_id:
      type: integer(8)
      notnull: true
    projet_id:
      type: integer(8)
      notnull: true
    appelaprojet_id:
      type: integer(8)
      notnull: true
    coordinator_id:
      type: integer(8)
  relations:
    Projet:
      local: projet_id
      onDelete: cascade
      foreignAlias: Formelles
    ProgrammeAccord:
      local: programme_accord_id
      foreignAlias: Formelles
    AppelAProjet:
      local: AppelAProjet_id
      onDelete: cascade
      foreignAlias: Formelles
    Institutions:
      class:        Institution
      refClass:     InstitutionFormelle
      foreignAlias: Formelles
    Personne:
      local: coordinator_id
      foreignAlias: Formelles
 
#-----------------------------------------------
 
AppelAProjet:
  tableName: Appel_a_projet
  columns:
    nomAppel:
      type: string(255)
      notnull: true
    dateAppel:
      type: date(25)
      notnull: true
    dateFin:
      type: date(25)
      unsigned: true
      notnull: true
    Gestionnaire_nat_id:
      type: integer(8)
      notnull: true
    Gestionnaire_centre_id:
      type: integer(8)
      notnull: true
  relations:
    Personne:
      class: Personne
      local: Gestionnaire_centre_id
      foreignAlias: AppelAProjets
    Personne:
      class: Personne
      local: Gestionnaire_nat_id
      foreignAlias: AppelAProjets
    ContratsLies:
      class: Formelle
      local: contrat_id
      type: many
      foreignAlias: AppelAProjets
 
 #-----------------------------------------------
 
Informelle:
  tableName: Informelle
  inheritance:
    type:             concrete
    extends:          Collaboration_internationale
  relations:
    Institutions:
      class:	    Institution
      refClass:     InstitutionInformelle
      foreignAlias: Informelles
 
 
#-----------------------------------------------
 
Equipeiu:
  tableName: Equipeiu
  columns:
    equipeprojetdept:
      type: string(255)
      notnull: true
    domainedept:
      type: string(255)
    theme:
      type: string(255)
 
#-----------------------------------------------
 
#EquipeiuCollab:
  tableName: equipeiu_Collab
  columns:
    equipeiu_id:
      type: integer
      primary: true
    Collaboration_internationale_id:
      type: integer
      primary: true
  relations:
     Equipeiu:
      onDelete: CASCADE
      foreignAlias: EquipeiuCollabs
    CollaborationInternationale:
      onDelete: CASCADE
      foreignAlias: EquipeiuCollabs
 
#-----------------------------------------------
 
ProgrammeAccord:
  tableName: Programme_accord
  columns:
    referenceacc:
      type: string(255)
    OrgaEmetteur_id:
      type: integer(8)
  relations:
    Institution:
      local: OrgaEmetteur_id
      foreignAlias: ProgrammeAccords
 
#-----------------------------------------------
 
RenouvellementProlongation:
  tableName: Renouvellement_prolongation
  columns:
    projet_id:
      type: integer(8)
      notnull: true
    datedebut:
      type: date(25)
      notnull: true
    newdatefin:
      type: date(25)
      notnull: true
#This enum is also not going to be changed either, so still an enum.
    typerp:
      type: string(12)
      notnull: true
  relations:
    Projet:
      onDelete: cascade
      foreignAlias: RenouvellementProlongations
    TypeRP:
      local: typerp
      foreign: typerp
      foreignAlias: RenouvellementProlongations
 
TypeRP:
  tableName: Type_rp
  columns:
    typerp:
      type: string(12)
      primary: true
Noobboy est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 09/07/2011, 22h10   #14
Modérateur
 
Avatar de Michel Rotta
 
Homme Michel Rotta
Responsable d'exploitation informatique
Inscription : septembre 2005
Messages : 4 913
Détails du profil
Informations personnelles :
Nom : Homme Michel Rotta
Âge : 49
Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

Informations professionnelles :
Activité : Responsable d'exploitation informatique
Secteur : Distribution

Informations forums :
Inscription : septembre 2005
Messages : 4 913
Points : 7 505
Points : 7 505
Faut que tu fasses plus de tris dans les informations données, l'abondance nuit à la recherche du problème...

Met la partie du schéma qui semble te poser problème, même si la totalité est aussi intéressante.

A priori, tu utilises des inheritance de type concret hors les tables générées et le modèle objet qui en découlent donne des tables et objets indépendants. Je ne suis pas très sur qu'il y ait un grand intérêt à une table parent qui n'embarque qu'une id. Accessoirement, une table qui s'appelle relation ne favorise pas la recherche vu que des relations... il y en a beaucoup
__________________
Si tu donnes un poisson à un homme, il mangera un jour. Si tu lui apprends à pêcher, il mangera toujours (Lao Tseu).
  • Pensez à valoriser les réponses pertinantes, cliquez sur le bouton vert +1 pour indiquer votre accord avec la solution proposée.
  • Pensez à utiliser la balise [code] pour afficher du code, elle est cachée sous le bouton [#] dans l'éditeur.
  • Une discussion est terminée ? Alors le bouton est votre ami !
Michel Rotta est déconnecté   Envoyer un message privé Réponse avec citation 10
Vieux 10/07/2011, 09h26   #15
Futur Membre du Club
 
Homme
Étudiant
Inscription : novembre 2008
Messages : 67
Détails du profil
Informations personnelles :
Sexe : Homme
Localisation : France

Informations professionnelles :
Activité : Étudiant
Secteur : High Tech - Éditeur de logiciels

Informations forums :
Inscription : novembre 2008
Messages : 67
Points : 16
Points : 16
J'ai mis tout car tu me l'avais demandé la dernière fois. ^^"

Ok, je te fais ça.

Note par ailleurs que j'ai supprimé ma super-super-classe "Relation"...

Code :
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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
Institution:
  tableName: Institution
  columns:
    zone:
      type: string(255)
      notnull: true
    pays:
      type: string(255)
      notnull: true
    nominstitution:
      type: string(255)
      notnull: true
    codepostalorga:
      type: int(5)
      unsigned: true
    ville:
      type: string(255)
    Etat:
      type: string(255)
  relations:
    Zone:
      local: zone
      foreign: nom_zone
      foreignAlias: Institutions
    Pays:
      local: pays
      foreign: nom_pays
      foreignAlias: Institutions
 
#For more flexibility, enums are transformed into new tables
Zone:
[BLABLA]
Pays:
[BLABLA]
#-----------------------------------------------
 
InstitutionInformelle:
  tableName: Institutioninformelle
  columns:
    informelle_id:
      type: integer(8)
      primary: true
    institution_id:
      type: integer(8)
      primary: true
  relations:
    Institution:
      onDelete:       CASCADE
      foreignAlias:   InstitutionInformelles
    Informelle:
      onDelete:       CASCADE
      foreignAlias:   InstitutionInformelles
 
#-----------------------------------------------
 
InstitutionFormelle:
  tableName: Institutionformelle
  columns:
    formelle_id:
      type: integer(8)
      primary: true
    institution_id:
      type: integer(8)
      primary: true
    financement_id:
      type: integer(8)
  relations:
    Institution:
      onDelete:       CASCADE
      foreignAlias:   InstitutionFormelles
    Formelle:
      onDelete:       CASCADE
      foreignAlias:   InstitutionFormelles
    Financement:
      foreignAlias: InstitutionFormelles
 
#-----------------------------------------------
 
Collaboration_internationale:
  tableName: Collaboration_internationale
  columns:
  relations:
    EquipeiuCollabs:
      class: Equipeiu
      refClass: EquipeiuCollab
      foreignAlias: CollaborationInternationales
    Porteurs_iu:
      class: Personne
      refClass: Collaboration_internationale_porteurius
      foreignAlias: CollaborationInternationales
    Porteur_inter:
      class: Personne
      refClass: Collaboration_internationale_porteurinters
      foreignAlias: CollaborationInternationales
 
Collaboration_internationale_porteurinters:
  tableName: Collaboration_internationale_porteurinters
  columns:
    Collaboration_internationale_id:
      type: integer(8)
      primary: true
    personne_id:
      type: integer(8)
      primary: true
 
Collaboration_internationale_porteurius:
  tableName: Collaboration_internationale_porteurius
  columns:
   Collaboration_internationale_id:
      type: integer(8)
      primary: true
   personne_id:
      type: integer(8)
      primary: true
 
 
 #-----------------------------------------------
 
Formelle:
  tableName: Formelle
  inheritance:
    type:             concrete
    extends:          Collaboration_internationale
  columns:
    programme_accord_id:
      type: integer(8)
      notnull: true
    projet_id:
      type: integer(8)
      notnull: true
    appelaprojet_id:
      type: integer(8)
      notnull: true
    coordinator_id:
      type: integer(8)
  relations:
    Projet:
      local: projet_id
      onDelete: cascade
      foreignAlias: Formelles
    ProgrammeAccord:
      local: programme_accord_id
      foreignAlias: Formelles
    AppelAProjet:
      local: AppelAProjet_id
      onDelete: cascade
      foreignAlias: Formelles
    Institutions:
      class:        Institution
      refClass:     InstitutionFormelle
      foreignAlias: Formelles
    Personne:
      local: coordinator_id
      foreignAlias: Formelles
 
#-----------------------------------------------
 
Informelle:
  tableName: Informelle
  inheritance:
    type:             concrete
    extends:          Collaboration_internationale
  relations:
    Institutions:
      class:        Institution
      refClass:     InstitutionInformelle
      foreignAlias: Informelles
 
 
#-----------------------------------------------
 
Equipeiu:
  tableName: Equipeiu
  columns:
    equipeprojetdept:
      type: string(255)
      notnull: true
    domainedept:
      type: string(255)
    theme:
      type: string(255)
 
#-----------------------------------------------
 
#EquipeiuCollab:
  tableName: equipeiu_Collab
  columns:
    equipeiu_id:
      type: integer
      primary: true
    Collaboration_internationale_id:
      type: integer
      primary: true
  relations:
     Equipeiu:
      onDelete: CASCADE
      foreignAlias: EquipeiuCollabs
    CollaborationInternationale:
      onDelete: CASCADE
      foreignAlias: EquipeiuCollabs
 
#-----------------------------------------------
 
Statut_inter:
[BLABLA]
 
#For more flexibility enums are transformed into new tables
LibelleStatutInter:
[BLABLA]
 
#-----------------------------------------------
 
StatutIU:
 [BLABLA]
 
#For more flexibility enums are transformed into new tables
LibelleStatutIU:
[BLABLA]
 
#-----------------------------------------------
 
Personne:
[BLABLA]
Sexe:
[BLABLA]
#-----------------------------------------------
 
Personne_concernee:
[BLABLA] 
#For more flexibility enums are transformed into new tables
Libelle_statut_personne:
[BLABLA]
Libelle_statut_personneconcernee:
[BLABLA]
 
#-----------------------------------------------
 
Financement:
[BLABLA]
#-----------------------------------------------
 
Projet:
[BLABLA]
 
#For more flexibility enums are transformed into new tables
statut_p:
[BLABLA]
 
TypeProgAcc:
[BLABLA]
 
#-----------------------------------------------
 
AppelAProjet:
[BLABLA]
 
 #-----------------------------------------------
 
ProgrammeAccord:
[BLABLA]
 
#-----------------------------------------------
 
RenouvellementProlongation:
[BLABLA]
 
TypeRP:
[BLABLA]
Noobboy est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 11/07/2011, 19h38   #16
Modérateur
 
Avatar de Michel Rotta
 
Homme Michel Rotta
Responsable d'exploitation informatique
Inscription : septembre 2005
Messages : 4 913
Détails du profil
Informations personnelles :
Nom : Homme Michel Rotta
Âge : 49
Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

Informations professionnelles :
Activité : Responsable d'exploitation informatique
Secteur : Distribution

Informations forums :
Inscription : septembre 2005
Messages : 4 913
Points : 7 505
Points : 7 505
Tu as une classe collaboration_international qui est vide hors un id et des relations qui est hérité en concret par Informel, qui lui aussi n'a aucun champs et ce contente de rajouter une quatrième relation...

J'ai un peu de mal à visualiser, dans ton schéma, l'intérêt de telles tables, même si je peux concevoir qu'il existe. Par contre, je ne vois pas vraiment, ici, l'intérêt de l'héritage, définir les relations depuis les deux tables devraient être suffisant.

Après, j'ai de gros doutes sur les relations héritées dans ce cas (pour la table Informel). En effet, tu n'as que des relations de type n-n. Et tu vas utiliser les mêmes tables intermédiaires entre la classe parent et la (ou les) classes qui héritent. Le problème est que comme les héritages sont concret, tu as une table différente pour chaque classe, donc une clef incrémenté indépendamment et la plus grande possibilité d'arriver dans une des tables de liaison avec deux enregistrements qui partent d'une table différente, mais avec des id identique vers un même enregistrement lié. De plus, tu vas récupérer les enregistrements lié pour ton enregistrement et ceux de toutes la "famille" des tables hérités qui auront le même id..

Je ne vois pas comment cela pourrait être gérable.


Pour ce qui est du code a donner, il faut faire la part des choses, tout est intéressant et dois être donné, mettre en sus le code qui te semble poser problème est un plus pour ceux qui répondent. Si je (ou un autre) passe 40 mn à lire ton code je ne pourrais pas répondre à 4 questions qui m'auraient pris 10mn chacune... Alors, si je gagne 20 minutes pour comprendre ton problème, deux personnes de plus auront une réponse.
__________________
Si tu donnes un poisson à un homme, il mangera un jour. Si tu lui apprends à pêcher, il mangera toujours (Lao Tseu).
  • Pensez à valoriser les réponses pertinantes, cliquez sur le bouton vert +1 pour indiquer votre accord avec la solution proposée.
  • Pensez à utiliser la balise [code] pour afficher du code, elle est cachée sous le bouton [#] dans l'éditeur.
  • Une discussion est terminée ? Alors le bouton est votre ami !
Michel Rotta est déconnecté   Envoyer un message privé Réponse avec citation 10
Vieux 13/07/2011, 14h56   #17
Futur Membre du Club
 
Homme
Étudiant
Inscription : novembre 2008
Messages : 67
Détails du profil
Informations personnelles :
Sexe : Homme
Localisation : France

Informations professionnelles :
Activité : Étudiant
Secteur : High Tech - Éditeur de logiciels

Informations forums :
Inscription : novembre 2008
Messages : 67
Points : 16
Points : 16
Effectivement, la réponse à ma question se trouvait dans la définition même d'un héritage concret sous symfony...

Si la table Collaboration_Internationale n'a vraiment aucun intérêt et a donc disparu de mon schéma, la classe Informelle est utile car symbolise autre chose que formelle (normal tu me diras dans le fond...) et dans la forme la séparation des données entre ces deux tables me paraît plus approprié pour des traitements simplifiés sur la base par la suite.

J'ai donc enlevé l'héritage qui n'était pas approprié dans ce projet.

Effectivement, je comprend bien que tu prends du temps pour répondre aux personnes ayant des soucis comme moi et qu'un texte long et indigeste te prend du temps supplémentaire que tu aurais consacré à aider d'autres personnes.

Tout fonctionne à part quelques fonctions générées automatique car Symfony a l'air d'avoir des petits problèmes avec la casse dans les noms de tables et de relations. Chose très facilement corrigeable dans les modèles.

Je m'attaque maintenant à la recherche dans un la base via symfony avec l'aide du tuto Jobeet.

Merci beaucoup du temps passé à essayer de me comprendre.
Noobboy est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 15/07/2011, 10h58   #18
Modérateur
 
Avatar de Michel Rotta
 
Homme Michel Rotta
Responsable d'exploitation informatique
Inscription : septembre 2005
Messages : 4 913
Détails du profil
Informations personnelles :
Nom : Homme Michel Rotta
Âge : 49
Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

Informations professionnelles :
Activité : Responsable d'exploitation informatique
Secteur : Distribution

Informations forums :
Inscription : septembre 2005
Messages : 4 913
Points : 7 505
Points : 7 505
Les remarques que j'ai faîtes ne concernait que la structure, pas la qualification et la pertinence du modèle. Il faudrait bien plus de données pour pouvoir y arriver...

Bonne chance pour la suite.
__________________
Si tu donnes un poisson à un homme, il mangera un jour. Si tu lui apprends à pêcher, il mangera toujours (Lao Tseu).
  • Pensez à valoriser les réponses pertinantes, cliquez sur le bouton vert +1 pour indiquer votre accord avec la solution proposée.
  • Pensez à utiliser la balise [code] pour afficher du code, elle est cachée sous le bouton [#] dans l'éditeur.
  • Une discussion est terminée ? Alors le bouton est votre ami !
Michel Rotta est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité Cette discussion est résolue.
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 23h07.


 
 
 
 
Partenaires

Hébergement Web