So I've been trying to do a simple insert using active record with the following code.
public function actionIndex()
{
// renders the view file 'protected/views/site/index.php'
// using the default layout 'protected/views/layouts/main.php'
$hasher = Yii::app()->passwordCreator;
$user = new Customer();
$user->email = 'test@test.com';
$user->passwordSalt = $hasher->createSalt();
$user->password = $hasher->createPassword('test', $user->passwordSalt);
$user->isLocked = 0;
$user->role = 'someRole';
$user->creationDate = Date::utcnow()->getTimeStamp();
$user->isVerified = 1;
if($user->save()) {
Yii::trace('save success', 'info');
} else {
Yii::trace('save failure: ' . print_r($user->getErrors(), true), 'info');
}
$this->render('index');
}
The problem is that the record is inserted twice but the trace would seemingly indicate otherwise.
The action above is on the default SiteController that is generated when you run yiic webapp. The model was also generated by yiic which i didn't modify.
Screenshot.png (97.97K)
Number of downloads: 21
Any ideas?

Help














