Bonjour,

Quand j'essaye de récupérer une valeur dans ma table avec :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
$utilisateur = Doctrine_Core::getTable('Utilisateur')->findOneByEmail($request->getParameter('mailEnter'));
Je ne sais pas pourquoi la requête générée par symfony est comme ça :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
 SELECT u.id AS u__id, u.login AS u__login, u.nom AS u__nom, u.prenom AS u__prenom, u.password AS u__password, u.email AS u__email, u.level AS u__level, u.created_at AS u__created_at, u.updated_at AS u__updated_at FROM utilisateur u WHERE (u.email = ?) LIMIT 1 - (ahmed.guemmi@gmail.com, 66102e571b3fed662a002d0a88c141a5)
La deuxième valeur est du Csfr token je pense mais j'ai bien définis dans ma classe formulaire passForm.class.php :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
 $this->widgetSchema->setNameFormat('mailEnter[%s]');

Ma classe passForm.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
 <?php
 
 
 class PassForm extends sfForm
{
  public function configure()
  {
 
 
	// $this->setWidgets(array('mailEnter'=> new sfWidgetFormInput()));
	 $this->widgetSchema['mailEnter'] = new sfWidgetFormInputText();
	 $this->widgetSchema->setNameFormat('mailEnter[%s]');
 
	$this->validatorSchema['mailEnter'] = new sfValidatorPass();  
	$this->widgetSchema->setLabels(array(
      'mailEnter'   => "Enter your mail",
 
	));
	/*$this->validatorSchema['email'] = new sfValidatorAnd(array(
      new sfValidatorString(array('max_length' => 50)),
      new sfValidatorEmail(array(), array('invalid' => 'The email address is invalid.')),
      
    ));*/
 
	$this->validatorSchema->setPostValidator(
    new sfValidatorCallback(array('callback'=> array($this, 'checkEmail')))
    );
  }
 
  public function checkEmail($validator, $values) {
       $this->widgetSchema->setNameFormat('mailEnter[%s]');
 
		if (!empty($values['mailEnter']) ) {
 
			$utilisateur = Doctrine::getTable('utilisateur')->findOneByEmail($values['mailEnter']);
			if ($utilisateur) {
 
			    if ($utilisateur->getEmail() == $values['mailEnter']) {
			    	// Login correct !
 
					//if ($utilisateur->getEtat() == 1) {
						//$password="westsida";
						$password = substr(md5(rand(100000, 999999)), 0, 6);
                        $utilisateur->setPassword("$password");	
						$utilisateur->save();						
						return $values;	
				//	}
					/*else {
						if ($utilisateur->getEtat() == 0) {
							throw new sfValidatorError($validator, 'Your account is still disabled. Please click on the confirmation email to activate your account.');
						}
						else {
							throw new sfValidatorError($validator, 'You are bannished from the website.');
						}
					}*/
 
 
	            } else {
	            	// Connexion incorrecte
	                throw new sfValidatorError($validator, 'Email incorrect');
	            }
			}
			else {
				 throw new sfValidatorError($validator, 'This Email doesnt exists');
			}
        }
    }
 
}

Mon template :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
<form action="<?php echo url_for('mailChecker') ?>" method="POST">
  <table>
    <?php echo $form5 ?>
    <tr>
      <td colspan="2">
        <input type="submit" />
      </td>
    </tr>
  </table>
</form>
Mon action :

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
  public function executeCheckMail(sfWebRequest $request)
{
   $this->form5 = new PassForm();
   $utilisateur = Doctrine_Core::getTable('Utilisateur')->findOneByEmail($request->getParameter('mailEnter'));
  // $var=$request->getParameterHolder()->getAll();
   $var1=$var;
 
    $utilisateur = Doctrine_Core::getTable('Utilisateur')->findOneByEmail($var["mailEnter"]);
    $this->form5->bind($var);
 
    if ($this->form5->isValid())
    {
 
		/*$q = Doctrine_Query::create() 
                       ->from('utilisateur u') 
                       ->where('u.Email=?', $request->getParameter('mailEnter')); 
    $user1 = $q->execute();
	$test=$user1->Utilisateur_id;	
 
		$password = substr(md5(rand(100000, 999999)), 0, 6);
		//$password="westsida";
     //$utilisateur->setPassword($password);*/
 
	  $message = Swift_Message::newInstance('My subject')
					->setFrom('ahmed.guemmi@gmail.com')
					->setTo('ahmed.guemmi@gmail.com')
					->setBody(
'Your new Password is: '.$password
);
$this->getMailer()->send($message);
 
 
}
else{
 
$this->setTemplate("pass");
  }
 
}

Merci d'avance.