Bonjour,

Dans le cadre de l'affichage d'un formulaire assez simple au final, les références entre tables me permettent d'avoir facilement le rendu voulu (grâce aux __toString() notamment et aux sfDoctrineWidgetChoice()). Par contre, je me retrouve avec une page à 425 requêtes SQL et 15 358 ms de temps d'affichage. Ce qui est intolérable pour d'évidentes raisons de performances. D'autant qu'on pourrait facilement réduire à une dizaine de requêtes maximum en utilisant les jointures appropriées.

Du coup, me rappelant la configuration des modules d'administration de symfony, je me demandais s'il n'y avait pas moyen de modifier le comportement de la requête lié à __toString() pour lui inclure des jointures.

Pour référence, voici mon 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
CopisimEtudiant:
  actAs:
    Timestampable: ~
  columns:
    nom: { type: string(50), notnull: true }
    prenom: { type: string(50), notnull: true }
    fac: { type: integer, notnull: true }
    naissance: { type: date }
    email: { type: string(100), notnull: true }
    email_tmp: { type: string(100), notnull: true }
    anonyme: { type: boolean, notnull: true, default: 0 }
    annee: { type: enum, values: ['DCEM4', 'DCEM4 doublant', 'TCEM1'], default: 'DCEM4' }
    classement: { type: integer, notnull: true }
  relations:
    CopisimFac: { local: fac, foreign: id }
 
CopisimFac:
#  actAs:
  columns:
    periode: { type: integer, notnull: true }
    titre: { type: string(255), notnull: true }
  relations:
    CopisimPeriode: { local: periode, foreign: id }
 
CopisimRegion:
  columns:
    periode: { type: integer, notnull: true }
    titre: { type: string(255), notnull: true }
  relations:
    CopisimPeriode: { local: periode, foreign: id }
 
CopisimFiliere:
  columns:
    periode: { type: integer, notnull: true }
    ref: { type: integer, notnull: false }
    titre: { type: string(255), notnull: true }
  relations:
    CopisimPeriode: { local: periode, foreign: id }
 
CopisimPeriode:
#  actAs:
  columns:
    annee: { type: year, notnull: true }
    debut_choix: { type: date, notnull: true }
    fin_choix: { type: date, notnull: true }
 
CopisimPoste:
#  actAs:
  columns:
    periode: { type: integer, notnull: true }
    ville: { type: integer, notnull: true }
    filiere: { type: integer, notnull: true }
    total: { type: integer, notnull: true }
  relations:
    CopisimPeriode: { local: periode, foreign: id }
    CopisimRegion: { local: ville, foreign: id }
    CopisimFiliere: { local: filiere, foreign: id }
 
CopisimChoix:
  actAs:
    Timestampable: ~
  columns:
    etudiant: { type: integer, notnull: true }
    poste: { type: integer, notnull: true }
    complement: { type: integer, notnull: true }
    ordre: { type: integer, notnull: true }
  relations:
    CopisimEtudiant: { local: etudiant, foreign: classement }
    CopisimPoste: { local: poste, foreign: id }
    CopisimFiliere: { local: complement, foreign: id }
 
CopisimFlux:
#  actAs:
    columns:
      periode: { type: integer, notnull: true }
      ville: { type: integer, notnull: true }
      complement: { type: integer, notnull: true }
      total: { type: integer, notnull: true }
    relations:
      CopisimPeriode: { local: periode, foreign: id }
      CopisimRegion: { local: ville, foreign: id }
      CopisimFiliere: { local: complement, foreign: id }
 
CopisimReferent:
  columns:
    periode: { type: integer, notnull: true }
    nom: { type: string(50), notnull: true }
    email: { type: string(100), notnull: true }
    tel: { type: string(10), notnull: false }
    divers: { type: string(256), notnull: false }
    fac: { type: integer, notnull: true }
  relations:
    CopisimPeriode: { local: periode, foreign: id }
    CopisimFac: { local: fac, foreign: id }
et CopisimPoste.class.php :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
class CopisimPoste extends BaseCopisimPoste
{
  public function __toString()
  {
    return sprintf('%s a %s', $this->getCopisimFiliere()->getTitre(), $this->getCopisimRegion()->getTitre());
  }
}
La classe du formulaire et celle action n'apportent pas grand chose, donc je ne les ajoute pas.