Problème de validateur : $value vide dans doClean()
Bonjour,
J'ai un problème avec ma méthode doClean($value) dans un validateur : la variable value est en effet vide lorsque la méthode est appelée.
Voici mon code :
sfValidatorCheckUsers.php :
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
| <?php
class sfValidatorCheckUsers extends sfValidatorString
{
protected function configure($options = array(), $messages = array())
{
parent::configure();
}
protected function doClean($value)
{
$usernames = parent::doClean($value);
$list = explode("\n", $usernames);
foreach ($usernames as $username) {
if (!UserTable::getInstance()->userExist($username)) {
throw new sfValidatorError($this, 'Le membre "'.$username.'" n\'existe pas. Value vaut : '.$usernames);
}
}
return $usernames;
}
public function isEmpty($value)
{
throw new sfValidatorError($this, 'Aucun membre spécifié');
}
} |
ConversationPriveeForm.php :
Code:
1 2 3 4 5 6 7 8
| public function configure()
{
$this->widgetSchema['participants_list'] = new sfWidgetFormTextarea();
$this->validatorSchema['participants_list'] = new sfValidatorCheckUsers();
$this->mergeForm(new MessagePriveForm());
$this->widgetSchema->setNameFormat('conversation[%s]');
} |
Savez-vous pourquoi ma variable $value est vide ?
Merci d'avance