Bonjour, voila j'ai rencontré un problème lorsque je test mon formulaire d'inscription. Au début j'avais oublier de mettre 'Id' en tant que clé primaire, et je me suis retrouvé avec cette erreur :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
Warning: array_key_exists() [function.array-key-exists]: The first argument should be either a string or an integer in \symfony\lib\util\sfParameterHolder.class.php on line 53
J'ai cru comprendre qu'il manquait le champ Id. J'ai donc mis à jour ma base de données. J'ai lancé les commande symfony nécessaires pour régénérer schema, model....

Mais voila j'ai toujours ce problème. Comment y remédier ?

Voici l'implémentation de la methode configure dans la class MembresForms.Class.php :

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
 
 protected static $Civilites = array('Mademoiselle', 'Madame', 'Monsieur');
 
  public function configure()
  {
     unset(
        $this["Role"], $this["IpInscription"], $this["Id"],
        $this["DateInscription"], $this["Etat"]);
 
 
      $this->setWidgets(array(
          'Login' => new sfWidgetFormInput(),
          'Email' => new sfWidgetFormInput(),
          'Pass' => new sfWidgetFormInput(),
          'Repass' => new sfWidgetFormInput(),
          'Nom' => new sfWidgetFormInput(),
          'Prenom' => new sfWidgetFormInput(),
          'Civilite' => new sfWidgetFormSelect(array('choices' => self::$Civilites)),
          'Telephone' => new sfWidgetFormInput(),
          'Adresse' => new sfWidgetFormInput(),
          'Complement' => new sfWidgetFormInput(),
          'CodePostal' => new sfWidgetFormInput(),
          'Ville' => new sfWidgetFormInput(),
          'Photo' => new sfWidgetFormInputFile(),
          'Newsletter'=> new sfWidgetFormInputCheckbox(),
          'Captcha' => new sfWidgetFormInput(),
           'Parrain' => new sfWidgetFormInput()));
 
          $this->widgetSchema->setLabels(array(
              'Login' => "Nom d'utilisateur*",
              'Email' => "Adresse email*",
              'Pass' => "Mot de passe*",
              'Repass' => "Confirmer*",
              'Nom' => "Nom*",
              'Prenom' => "Prénom*",
              'Civilite' => "Civilité*",
              'Telephone' => "Téléphone*",
              'Adresse' => "Adresse*",
              'Complement' => "Adresse complémentaire",
              'CodePostal' => "Code postal*",
              'Ville' => "Ville*",
              'Photo' => "Avatar",
              'Newsletter'=> "Newsletter*",
              'Captcha' => "Captcha",
              'Parrain' => "Parrain"));
 
        $this->widgetSchema->setHelp('Login', "Nombre de caractères : Entre 6 et 32.");
        $this->widgetSchema->setHelp('Pass', "Veuillez saisir un mot de passe complexe. Nombre de caractères : Entre 6 et 16");
        $this->widgetSchema->setHelp('Repass', "Veuillez confirmer votre mot de passe en le réécrivant, opur prévenir d'une éventuelle erreurs.");
        $this->widgetSchema->setHelp("Email","Veuillez saisir une addrese email valide.");
        $this->widgetSchema->setHelp('Nom', "Nombre de caractères : Entre 2 et 50.");
        $this->widgetSchema->setHelp('Prenom',"Nombre de caractères : Entre 2 et 50.");
        $this->widgetSchema->setHelp('Civilite', "Veuillez séléctionner votre civilité dans la liste.");
        $this->widgetSchema->setHelp('Telephone', "Nombre de chiffres : 10.");
        $this->widgetSchema->setHelp('Adresse', "Nombre de caractères : Entre 2 et 50.");
        $this->widgetSchema->setHelp('Complément', "Nombre de caractères : Entre 2 et 50.");
        $this->widgetSchema->setHelp('CodePostal', "Nombre de caractères : 5.");
        $this->widgetSchema->setHelp('Ville', "Nombre de caractères : Entre 2 et 50.");
        $this->widgetSchema->setHelp('Photo', "Veuillez séléctionner une image sur votre ordinateur.");
        $this->widgetSchema->setHelp('Newsletter', "Veuillez cocher la case si vous souhaitez vous inscrire à la newsletter.");
        $this->widgetSchema->setHelp('Parrain', "Veuillez saisir le nom d'utilisateur de votre parrrain.");
 
        $this->validatorSchema->setPostValidator(
            new sfValidatorSchemaCompare('Pass',  sfValidatorSchemaCompare::EQUAL, 'Repass')
        );
 
        $this->setValidators(array(
          'Login' => new sfValidatorAnd(array(
            new sfValidatorString(array('required' => true, 'min_length' => 3, 'max_length' => 32)),
            new sfValidatorRegex(array('pattern' => '/^[a-zA-Z0-9-]+$/')))),
          'Email'=> new sfValidatorAnd(array(
            new sfValidatorString(array('required' => true, 'min_length' => 3, 'max_length' => 100)),
            new sfValidatorRegex(array('pattern' => '^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.(([0-9]{1,3})|([a-zA-Z]{2,3})|(aero|coop|info|museum|name))$')))),
          'Pass'  => new sfValidatorString(array('required' => true, 'min_length' => 6, 'max_length' => 16)),
          'Repass' => new sfValidatorString(array('required' => true, 'min_length' => 6, 'max_length' => 16)) ,
          'Nom' => new sfValidatorString(array('required' => true, 'min_length' => 2, 'max_length' => 50)),
          'Prenom' => new sfValidatorString(array('required' => true, 'min_length' => 2, 'max_length' => 50)),
          'Telephone' => new sfValidatorAnd(array(
            new sfValidatorString(array('required' => true, 'min_length' => 10, 'max_length' => 10)),
            new sfValidatorRegex(array('pattern' => '/^(01|02|03|04|05|06|08)[0-9]{8}/')))),
          'Adresse' => new sfValidatorString(array('required' => true, 'min_length' => 2, 'max_length' => 50)),
          'Complement' => new sfValidatorString(array('required' => true, 'min_length' => 2, 'max_length' => 50)),
          'CodePostal' => new sfValidatorString(array('required' => true,'min_length' => 5, 'max_length' => 5)),
          'Ville' => new sfValidatorString(array('required' => true, 'min_length' => 2, 'max_length' => 50))));
 
    }
Personnalisent je pense que l'erreur vient du model, voici un extrait du schéma :

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
Membres:
  connection: doctrine
  tableName: membres
  columns:
    parrain:
      type: integer(4)
      fixed: false
      unsigned: false
      primary: false
      notnull: false
      autoincrement: false
    id:
      type: integer(4)
      fixed: false
      unsigned: false
      primary: true
      autoincrement: true
    login:
      type: string(32)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
    pass:
      type: string(32)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
    email:
      type: string(100)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
    nom:
      type: string(50)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
    prenom:
      type: string(50)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
    civilite:
      type: string(20)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
    telephone:
      type: string(10)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
    adresse:
      type: string(50)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
    complement:
      type: string(50)
      fixed: false
      unsigned: false
      primary: false
      notnull: false
      autoincrement: false
    code_postal:
      type: string(5)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
    ville:
      type: string(50)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
    photo:
      type: string(200)
      fixed: false
      unsigned: false
      primary: false
      default: ''
      notnull: false
      autoincrement: false
    role:
      type: integer(4)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
    newsletter:
      type: integer(1)
      fixed: false
      unsigned: false
      primary: false
      notnull: false
      autoincrement: false
    ipinscription:
      type: string(30)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
    dateinscription:
      type: date(25)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
    etat:
      type: integer(4)
      fixed: false
      unsigned: false
      primary: false
      notnull: true
      autoincrement: false
Donc voila si vous trouvez quelque chose qui vous semble faux n'hésitez pas à me le signaler. Merci

Cordialement