Bonsoir à tous,
Je suis en train de réaliser un formulaire composé de plusieurs sous formulaires et j'ai une erreur de type "Invalid" lors de la sauvegarde (voir capture ci-joint). Je ne trouve pas de solutions, voici quelques explications de mon problème :
une partie de mon schema.yml
la génération du formulaire et des sous-formulaires :
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 Critere: connection: doctrine tableName: critere actAs: [Timestampable] columns: id: type: integer(4) primary: true autoincrement: true nom: type: string(50) notnull: true groupe_critere_id: type: integer(4) relations: CritereFrequentation: local: id foreign: critere_id type: many CritereFrequentation: connection: doctrine tableName: critere_frequentation actAs: [Timestampable] columns: frequentation_id: type: integer(4) primary: true critere_id: type: integer(4) primary: true valeur: type: integer(4) default: '0' GroupeCritere: connection: doctrine tableName: groupe_critere actAs: [Timestampable] columns: id: type: integer(4) primary: true autoincrement: true nom: type: string(50) notnull: true relations: Critere: local: id foreign: groupe_critere_id type: many Frequentation: connection: doctrine tableName: frequentation actAs: [Timestampable] columns: id: type: integer(4) primary: true autoincrement: true total: type: integer(4) periode: type: timestamp(25) notnull: true commentaire_emp: type: string() commentaire_coh: type: string() user_id: type: integer(4) relations: CritereFrequentation: local: id foreign: frequentation_id type: many
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 class FrequentationForm extends BaseFrequentationForm { public function configure() { //enlever l'affichage des champs date de création et date de mise à jour et user_id unset($this['created_at'], $this['updated_at'], $this['user_id']); $q = Doctrine_Query::create() ->select('nom, id') ->from('GroupeCritere'); $groupes = $q->fetchArray(); foreach ($groupes as $group) { $subForm = new sfForm(); if ($this->getObject()->isNew()) { $critere = new Critere(); $critere->setGroupeCritereId($group['id']); //$this->embedForm($group['nom'], new CritereForm($critere)); $q = Doctrine_Query::create() ->select('nom, id') ->from('Critere c') ->where('c.groupe_critere_id=?',$group['id']); $criteres = $q->fetchArray(); foreach ($criteres as $critere) { //insertion d'un formulaire imbriqué $criterefrequentation = new CritereFrequentation(); $criterefrequentation->setCritereId($critere['id']); $subForm->embedForm($critere['nom'], new CritereFrequentationForm($criterefrequentation)); } $this->embedForm($group['nom'],$subForm); } } } } }
C'est comme s'il n'arrivait pas à récupérer le critereId mais pourtant je l'affecte bien et je parviens à l'afficher sur mon formulaire.
Je désespère un peu.... quelqu'un aurait-il une idée svp ?
Merci beaucoup.
Partager