...
- Code: Select all
Olga:
actAs:
Timestampable:
created: { name: olg_creation, type: datetime }
updated: { name: olg_modification, type: datetime }
columns:
id_olga: { type: integer(4), primary: true, autoincrement: true }
olg_intitule: { type: string(100), notnull: true }
olg_resume: { type: string(255) }
olg_description: { type: string }
olg_id_categorie: { type: integer(4), notnull: true }
olg_adresse1: { type: string(255) }
olg_adresse2: { type: string(255) }
olg_code_postal: { type: string(10), notnull: true }
olg_ville: { type: string(100), notnull: true }
olg_id_pays: { type: string(2), notnull: true }
olg_localisation: { type: string(100) }
olg_statut: { type: enum, values: [actif, inactif, a_supprimer, a_verifier], notnull: true, default: actif }
Et j'ai personnalisé comme suit le champ "olg_statut" (pour obtenir un champ checkbox au lieu d'un champ dropdown) pour le filtre de l'objet 'Olga':
- Code: Select all
class OlgaFormFilter extends BaseOlgaFormFilter
{
public function configure()
{
$this->widgetSchema['olg_statut'] = new sfWidgetFormChoice(array(
'choices' => array('actif' => 'actif', 'inactif' => 'inactif', 'a_supprimer' => 'A supprimer', 'a_verifier' => 'A vérifier'),
'expanded' => true,
'multiple' => true
));
$this->validatorSchema['olg_statut'] = new sfValidatorChoice(array(
'choices' => array(0 => 'actif', 1 => 'inactif', 2 => 'a_supprimer', 3 => 'a_verifier'),
'required' => false,
'multiple' => true,
));
}
}
Et tout va bien sauf si je coche 2 ou plusieurs checkbox sur le champ olg_statut, alors l'erreur suivante apparait:
500 | Internal Server Error | Doctrine_Connection_Mysql_Exception
SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens
stack trace
* at ()
in SF_ROOT_DIR\lib\vendor\symfony\lib\plugins\sfDoctrinePlugin\lib\vendor\doctrine\Doctrine\Connection.php line 1082 ...
1079. $message .= sprintf('. Failing Query: "%s"', $query);
1080. }
1081.
1082. $exc = new $name($message, (int) $e->getCode());
1083. if ( ! isset($e->errorInfo) || ! is_array($e->errorInfo)) {
1084. $e->errorInfo = array(null, null, null, null);
1085. }
A ce que je comprends, c'est une erreur d'excecution de requête qui ressemble à ceci: "(select * from olga where olg_statut = ?, array(actif, inactif))", je crois que c'est au niveau de la condition where qui cause le problème mais je sais pas comment le résoudre, est ce que quelqu'un peut m'aider sur ce problème? s'il vous plait!
