CDbCommand failed to execute the SQL statement: SQLSTATE[23502]: Not null violation: 7 ERROR: null value in column "login" violates not-null constraint. The SQL statement executed was: INSERT INTO "ai_user" ("email") VALUES (:yp0). Bound with :yp0='[email protected]'
Код: Выделить всё
$user['login'] = 'rasdft111';
$user['email'] = '[email protected]'; // @todo ya.ru === yandex.ru
$user['pswd'] = 'pasdfasdf11';
var_dump($user);
$saver_user = new User();
var_dump($saver_user->attributes);
$saver_user->attributes = $user;
var_dump($saver_user->attributes);
var_dump($user);
$saver_user->save();
// $saver_user->save(TRUE, $user);
$saver_user->saveUser($user);
var_dump($saver_user->errors);
т.еarray (size=3)
'login' => string 'rasdft111' (length=9)
'email' => string '[email protected]' (length=19)
'pswd' => string 'pasdfasdf11' (length=11)
array (size=4)
'id' => null
'login' => null
'email' => null
'pswd' => null
array (size=4)
'email' => string '[email protected]' (length=19)
'id' => null
'login' => null
'pswd' => null
array (size=3)
'login' => string 'rasdft111' (length=9)
'email' => string '[email protected]' (length=19)
'pswd' => string 'pasdfasdf11' (length=11)
array (size=4)
'email' => string '[email protected]' (length=19)
'id' => null
'login' => null
'pswd' => null
array (size=0)
empty
Код: Выделить всё
$saver_user->user = $user
Код: Выделить всё
array (size=4)
'email' => string '[email protected]' (length=19)
'id' => null
'login' => null
'pswd' => null
Код: Выделить всё
public function saveUser($user)
{
if($user)
{
$this->attributes = $user;
$this->save();
} else
{
throw new CDbException('data is empty');
}
}
ну ладно спокойной ночи)