IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Symfony PHP Discussion :

Héritage de tables d'assocation ? [1.x]


Sujet :

Symfony PHP

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre confirmé
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Novembre 2008
    Messages
    76
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Loire Atlantique (Pays de la Loire)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Novembre 2008
    Messages : 76
    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

  2. #2
    Expert confirmé
    Avatar de Michel Rotta
    Homme Profil pro
    DPO
    Inscrit en
    Septembre 2005
    Messages
    4 954
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 62
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : DPO
    Secteur : Distribution

    Informations forums :
    Inscription : Septembre 2005
    Messages : 4 954
    Par défaut
    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...

  3. #3
    Membre confirmé
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Novembre 2008
    Messages
    76
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Loire Atlantique (Pays de la Loire)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Novembre 2008
    Messages : 76
    Par défaut
    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 : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    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

  4. #4
    Expert confirmé
    Avatar de Michel Rotta
    Homme Profil pro
    DPO
    Inscrit en
    Septembre 2005
    Messages
    4 954
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 62
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : DPO
    Secteur : Distribution

    Informations forums :
    Inscription : Septembre 2005
    Messages : 4 954
    Par défaut
    Shema : à ma façon
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
     
    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.

  5. #5
    Membre confirmé
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Novembre 2008
    Messages
    76
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Loire Atlantique (Pays de la Loire)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Novembre 2008
    Messages : 76
    Par défaut
    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 : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    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

  6. #6
    Expert confirmé
    Avatar de Michel Rotta
    Homme Profil pro
    DPO
    Inscrit en
    Septembre 2005
    Messages
    4 954
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 62
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : DPO
    Secteur : Distribution

    Informations forums :
    Inscription : Septembre 2005
    Messages : 4 954
    Par défaut
    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

  7. #7
    Membre confirmé
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Novembre 2008
    Messages
    76
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Loire Atlantique (Pays de la Loire)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Novembre 2008
    Messages : 76
    Par défaut
    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 : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    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

  8. #8
    Expert confirmé
    Avatar de Michel Rotta
    Homme Profil pro
    DPO
    Inscrit en
    Septembre 2005
    Messages
    4 954
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 62
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : DPO
    Secteur : Distribution

    Informations forums :
    Inscription : Septembre 2005
    Messages : 4 954
    Par défaut
    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

  9. #9
    Membre confirmé
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Novembre 2008
    Messages
    76
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Loire Atlantique (Pays de la Loire)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Novembre 2008
    Messages : 76
    Par défaut
    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 : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    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]

  10. #10
    Expert confirmé
    Avatar de Michel Rotta
    Homme Profil pro
    DPO
    Inscrit en
    Septembre 2005
    Messages
    4 954
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 62
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : DPO
    Secteur : Distribution

    Informations forums :
    Inscription : Septembre 2005
    Messages : 4 954
    Par défaut
    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.

  11. #11
    Membre confirmé
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Novembre 2008
    Messages
    76
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Loire Atlantique (Pays de la Loire)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Novembre 2008
    Messages : 76
    Par défaut
    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.

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [NHibernate] Héritage de tables
    Par gwendal86 dans le forum NHibernate
    Réponses: 2
    Dernier message: 13/01/2010, 11h55
  2. Héritage (single-table inheritance)
    Par Javix dans le forum Ruby on Rails
    Réponses: 1
    Dernier message: 27/01/2009, 13h04
  3. héritage de table sous ORACLE, AIDE SVP
    Par gilardino dans le forum Oracle
    Réponses: 4
    Dernier message: 18/10/2007, 23h44
  4. Héritage de table dans un dataset
    Par fantasiiio dans le forum Général Dotnet
    Réponses: 3
    Dernier message: 14/08/2007, 12h53
  5. Héritage avec tables liées à une autre base
    Par b_steph_2 dans le forum Access
    Réponses: 13
    Dernier message: 27/02/2007, 11h17

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo