j'ai suivie le début du tuto http://www.grafikart.fr/tutoriels/cakephp/membres-user-auth-260
quand je valide le formulaire d'inscription ce m'affiche ça
Warning (2): preg_match(): Delimiter must not be alphanumeric or backslash [CORE/Cake/Model/Validator/CakeValidationRule.php, line 281]
preg_match - [internal], line ??
CakeValidationRule::process() - CORE/Cake/Model/Validator/CakeValidationRule.php, line 281
CakeValidationSet::validate() - CORE/Cake/Model/Validator/CakeValidationSet.php, line 137
ModelValidator::errors() - CORE/Cake/Model/ModelValidator.php, line 261
ModelValidator::validates() - CORE/Cake/Model/ModelValidator.php, line 101
Model::validates() - CORE/Cake/Model/Model.php, line 3141
Model::save() - CORE/Cake/Model/Model.php, line 1675
UsersController::singup() - APP/Controller/UsersController.php, line 7
ReflectionMethod::invokeArgs() - [internal], line ??
Controller::invokeAction() - CORE/Cake/Controller/Controller.php, line 490
Dispatcher::_invoke() - CORE/Cake/Routing/Dispatcher.php, line 187
Dispatcher::dispatch() - CORE/Cake/Routing/Dispatcher.php, line 162
[main] - APP/webroot/index.php, line 110
j'ai pas trouver l'erreur a la ligne 7 de UsersController
<?php
class UsersController extends AppController {
function singup() {
if($this->request->is('post')){
$d = $this->request->data;
$d'User']'id'] = null;
if($this->User->save($d,true,array('username','password','mail'))){
}else{
}
}
}
}
?>
Quand tu fais un save, cela appelle les règles de validation du Model ainsi que ton beforeSave() si tu en as un. Peux tu nous montrer le Model stp ?
<?php
class User extends AppModel {
public $validate = array(
'username' => array(
array(
'rule' => 'alphanumeric',
'required' => true,
'allowEmpty' => false,
'message' => "Votre pseudo n'est pas valide"
),
array(
'rule' => 'isUnique',
'message' => "Ce pseudo est deja pris"
)
),
'mail' => array(
array(
'rule' => 'email',
'required' => true,
'allowEmpty' => false,
'message' => "Votre mail n'est pas valide"
),
array(
'rule' => 'isUnique',
'message' => "Cet email est deja pris"
)
),
'password' => array(
'rule' => 'notEmpty',
'message' => "Vous devez entrer un mot de pass",
'allowEmpty' => false
),
);
}
?>