Save sfForm Doctrine Relation 1-n
Bonjour, après plusieurs jour à corriger mon schéma yaml, je viens vers vous car je ne vois pas la solution. J'ai crée un schéma avec beaucoup de relations 1-n (normal :) ). Apres j'ai utilisé la commande symfony : php symfony doctrine:build --all --no-confirmation pour me créer le model, les formulaires, les validateurs... ca marche, je n'ai pas d'erreur sur cette commande. Les formulaires s'affichent bien :)
J'arrive à ajouter, modifier et supprimer les éléments des tables sans dépendances (droit, agence).
Par contre dès que je veux ajouter un GT (groupe de travail), je ne peux pas lui donner une agence. Avec la méthode __ToString() j'ai bien réussi à afficher des Noms dans le formulaire correspondant à la clé primaire du champ de l'agence : j'ai bien une entrée du select avec la value '1' et le texte du nom de mon agence qui a pour id 1.
Si je trafique mon code pour envoyer un mauvais id (2 par exemple), le validateur me dit bien qu'il y a une erreur sur mon id (donc il vérifie bien que l'id doit être un id d'agence et il fait bien le lien avec la table agence).
Par contre, si je sélectionne mon agence 1, ben il le prend pas en compte puisqu'il fait une requete sans id d'agence et donc une erreur :
log de symfony :
6 Doctrine_Connection_Statement execute : SELECT COUNT(*) AS num_results FROM agences a WHERE a.id = ? - (1)
7 Doctrine_Connection_Statement execute : INSERT INTO gts (name, agence_id) VALUES (?, ?) - (Lyon Metropole, )
8 Doctrine_Connection_Mysql_Exception SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'agence_id' cannot be null
Voilà, je suis perdu, je comprend pas pourquoi il ne veux pas de mon id d'agence, il prend bien le nom du gt (Lyon Metropole) mais l'idée de l'agence est vide...
voici mon schéma :
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 683 684 685 686 687 688 689 690 691
|
---
detect_relations: true
options:
collate: latin1_swedish_ci
charset: latin1
type: InnoDB
agence:
tableName: agences
columns:
id:
type: integer(11)
primary: true
notnull: true
autoincrement: true
name:
type: string(255)
notnull: true
agent:
tableName: agents
columns:
id:
type: integer(11)
primary: true
notnull: true
autoincrement: true
NNI:
type: string(10)
notnull: true
name:
type: string(100)
notnull: true
prenom:
type: string(100)
notnull: true
Agence_id:
type: integer(11)
notnull: false
GT_id:
type: integer(11)
notnull: false
Equipe_id:
type: integer(11)
notnull: false
Droit_id:
type: integer(4)
notnull: true
Agent_ajustement:
type: integer(3)
notnull: true
relations:
Agence:
class: agence
local: Agence_id
foreign: id
onUpdate: cascade
GT:
class: gt
local: GT_id
foreign: id
onUpdate: cascade
Equipe:
class: equipe
local: Equipe_id
foreign: id
onUpdate: cascade
Droit:
class: droit
local: Droit_id
foreign: id
onUpdate: cascade
commentaire:
tableName: commentaires
columns:
id:
type: integer(11)
primary: true
notnull: true
autoincrement: true
projet_id:
type: string(255)
notnull: true
Agent_id:
type: integer(11)
notnull: true
text:
type: clob(65535)
notnull: true
relations:
Agent:
class: agent
local: Agent_id
foreign: id
onUpdate: cascade
donneescuau:
columns:
num_aff:
type: string(255)
primary: true
notnull: true
AgentCE_id:
type: integer(11)
default: null
AgentCA_id:
type: integer(11)
default: null
CCS:
type: string(255)
notnull: true
Commune:
type: string(255)
notnull: true
Date_reception_demande:
type: date
notnull: true
Date_creation:
type: date
notnull: true
Date_reponse_prevue:
type: date
default: null
Date_reponse_reelle:
type: date
default: null
Etat:
type: string(255)
notnull: true
Date_demande_etude_MOA_Pilot:
type: date
default: null
Date_retour_etude_MOA_Pilot:
type: date
default: null
Type_raccordement:
type: string(255)
default: null
Niveau_tension_soutirage:
type: string(20)
default: null
MOA:
type: string(20)
default: null
Commentaires:
type: clob(65535)
default: null
Libelle_MOAP:
type: string(255)
default: null
Nom_charge_etude_MOAP:
type: string(255)
default: null
Prenom_charge_etude_MOAP:
type: integer(4)
default: null
relations:
AgentCA:
class: agent
local: AgentCA_id
foreign: id
onDelete: set null
onUpdate: cascade
AgentCE:
class: agent
local: AgentCE_id
foreign: id
onDelete: set null
onUpdate: cascade
donneesiep:
columns:
num_aff:
type: string(255)
primary: true
notnull: true
default: ''
AgentCE_id:
type: integer(11)
default: null
AgentCA_id:
type: integer(11)
default: null
aff_ctre_lib:
type: string(255)
notnull: true
aff_lib:
type: string(255)
notnull: true
aff_dt_crea:
type: date
notnull: true
aff_etat_iep:
type: string(255)
notnull: true
aff_processus:
type: string(255)
notnull: true
aff_processus_lib:
type: string(255)
notnull: true
aff_type_trav:
type: string(255)
notnull: true
aff_type_trav_lib:
type: string(255)
notnull: true
ce_nom_prenom:
type: string(255)
notnull: true
aff_commune:
type: string(255)
notnull: true
aff_er:
type: integer(1)
notnull: true
aff_pct_elig:
type: integer(1)
notnull: true
aff_poids:
type: integer(4)
notnull: true
aff_ccs:
type: string(255)
notnull: true
aff_ccs_lib:
type: string(255)
notnull: true
rdp_comm:
type: clob(65535)
notnull: true
aff_dt_dem_racc_prev:
type: date
notnull: true
aff_dt_dem_racc_rea:
type: date
notnull: true
aff_dt_dem_avis_moad_prev:
type: date
notnull: true
aff_dt_dem_avis_moad_rea:
type: date
notnull: true
aff_dt_rep_avis_moad_prev:
type: date
notnull: true
aff_dt_rep_avis_moad_rea:
type: date
notnull: true
aff_dt_prop_chif_prev:
type: date
notnull: true
aff_dt_prop_chif_rea:
type: date
notnull: true
aff_dt_acc_chif_prev:
type: date
notnull: true
aff_dt_acc_chif_rea:
type: date
notnull: true
aff_dt_env_ptf_prev:
type: date
notnull: true
aff_dt_env_ptf_rea:
type: date
notnull: true
aff_dt_recep_acc_prev:
type: date
notnull: true
aff_dt_recep_acc_rea:
type: date
notnull: true
aff_dt_trf_acc_prev:
type: date
notnull: true
aff_dt_trf_acc_rea:
type: date
notnull: true
aff_dt_recev_racc_prev:
type: date
notnull: true
aff_dt_recev_racc_rea:
type: date
notnull: true
aff_dt_env_pdr_com_prev:
type: date
notnull: true
aff_dt_env_pdr_com_rea:
type: date
notnull: true
aff_dt_recev_pdr_com_prev:
type: date
notnull: true
aff_dt_recev_pdr_com_rea:
type: date
notnull: true
aff_dt_trf_moar_prev:
type: date
notnull: true
aff_dt_trf_moar_rea:
type: date
notnull: true
aff_dt_dem_do_prev:
type: date
notnull: true
aff_dt_dem_do_rea:
type: date
notnull: true
aff_dt_val_ddesc_prev:
type: date
notnull: true
aff_dt_val_ddesc_rea:
type: date
notnull: true
aff_dt_val_crei_moad_prev:
type: date
notnull: true
aff_dt_val_crei_moad_rea:
type: date
notnull: true
relations:
AgentCA:
class: agent
local: AgentCA_id
foreign: id
onDelete: set null
onUpdate: cascade
AgentCE:
class: agent
local: AgentCE_id
foreign: id
onDelete: set null
onUpdate: cascade
donneesmoap:
columns:
num_aff:
type: string(255)
primary: true
notnull: true
AgentCE_id:
type: integer(11)
default: null
AgentCA_id:
type: integer(11)
default: null
Identifiant_MOA_Pilot:
type: string(20)
notnull: true
Etat_MOA_Pilot:
type: string(255)
notnull: true
Date_validation_DST:
type: date
default: null
Signataire_DST:
type: string(255)
default: null
Identifiant_AU:
type: string(255)
default: null
relations:
AgentCA:
class: agent
local: AgentCA_id
foreign: id
onDelete: set null
onUpdate: cascade
AgentCE:
class: agent
local: AgentCE_id
foreign: id
onDelete: set null
onUpdate: cascade
droit:
tableName: droits
columns:
id:
type: integer(4)
primary: true
notnull: true
autoincrement: true
name:
type: string(255)
notnull: true
detail:
type: clob(65535)
notnull: true
equipe:
tableName: equipes
columns:
id:
type: integer(11)
primary: true
notnull: true
autoincrement: true
name:
type: string(255)
notnull: true
GT_id:
type: integer(11)
notnull: true
Agence_id:
type: integer(11)
notnull: true
relations:
Agence:
class: agence
local: Agence_id
foreign: id
onDelete: cascade
onUpdate: cascade
GT:
class: gt
local: GT_id
foreign: id
onDelete: cascade
onUpdate: cascade
gt:
tableName: gts
columns:
id:
type: integer(11)
primary: true
notnull: true
autoincrement: true
name:
type: string(255)
notnull: true
Agence_id:
type: integer(11)
notnull: true
relations:
Agence_id:
class: agence
local: Agence_id
foreign: id
onDelete: cascade
onUpdate: cascade
jalon:
tableName: jalons
columns:
id:
type: integer(4)
primary: true
notnull: true
autoincrement: true
name:
type: string(255)
notnull: true
ordre:
type: integer(4)
notnull: true
detail:
type: clob(65535)
default: null
Agence_id:
type: integer(11)
notnull: true
Champdateprevue:
type: string(255)
default: null
Champdaterealisee:
type: string(255)
default: null
relations:
Agence_id:
class: agence
local: Agence_id
foreign: id
onDelete: cascade
onUpdate: cascade
listeparametre:
tableName: listeparametres
columns:
id:
type: integer(11)
primary: true
notnull: true
default: '0'
name:
type: string(255)
notnull: true
pgigta:
columns:
id:
type: integer(11)
primary: true
notnull: true
autoincrement: true
Agent_id:
type: integer(11)
notnull: true
DateDebut:
type: timestamp
notnull: true
DateFin:
type: timestamp
notnull: true
HeureTravailjour:
type: integer(4)
notnull: true
relations:
Agent_id:
class: agent
local: Agent_id
foreign: id
onDelete: cascade
onUpdate: cascade
probleme:
columns:
id:
type: integer(11)
primary: true
notnull: true
autoincrement: true
ProblemeN1_id:
type: integer(11)
notnull: true
ProblemeN2_id:
type: integer(11)
default: null
ProblemeN3_id:
type: integer(11)
default: null
Details:
type: clob(65535)
default: null
TempsPerdu:
type: integer(4)
notnull: true
NouveauDevis:
type: integer(1)
default: null
Agent_id:
type: integer(11)
notnull: true
num_aff:
type: string(255)
default: null
Date:
type: date
notnull: true
NouvelleEtudeSIG:
type: integer(1)
default: null
relations:
Agent_id:
class: agent
local: Agent_id
foreign: id
ProblemeN1_id:
class: problemen1
local: ProblemeN1_id
foreign: id
ProblemeN2_id:
class: problemen2
local: ProblemeN2_id
foreign: id
ProblemeN3_id:
class: problemen3
local: ProblemeN3_id
foreign: id
problemen1:
columns:
id:
type: integer(11)
primary: true
notnull: true
name:
type: string(255)
notnull: true
problemen2:
columns:
id:
type: integer(11)
primary: true
notnull: true
name:
type: string(255)
notnull: true
ProblemeN1_id:
type: integer(11)
notnull: true
relations:
ProblemeN1_id:
class: problemen1
local: ProblemeN1_id
foreign: id
onDelete: cascade
onUpdate: cascade
problemen3:
columns:
id:
type: integer(11)
primary: true
notnull: true
name:
type: string(255)
notnull: true
ProblemeN2_id:
type: integer(11)
notnull: true
ProblemeN1_id:
type: integer(11)
notnull: true
relations:
ProblemeN1_id:
class: problemen1
local: ProblemeN1_id
foreign: id
onDelete: cascade
onUpdate: cascade
ProblemeN2_id:
class: problemen2
local: ProblemeN2_id
foreign: id
onDelete: cascade
onUpdate: cascade
tempsref:
columns:
jalon_id:
type: integer(4)
primary: true
notnull: true
groupe:
type: string(100)
primary: true
notnull: true
processus:
type: string(100)
primary: true
notnull: true
typedetravaux:
type: string(100)
primary: true
notnull: true
temps:
type: integer(4)
notnull: true
relations:
jalon_id:
class: jalon
local: jalon_id
foreign: id
onDelete: cascade
onUpdate: cascade
valeurparametre:
tableName: valeurparametres
columns:
parametre_id:
type: integer(11)
primary: true
notnull: true
default: '0'
GT_id:
type: integer(11)
primary: true
notnull: true
default: ''
valeur:
type: integer(4)
notnull: true
relations:
GT_id:
class: gt
local: GT_id
foreign: id
onDelete: cascade
onUpdate: cascade
parametre_id:
class: listeparametre
local: parametre_id
foreign: id
onDelete: cascade
onUpdate: cascade |
Merci de me sortir de là :)