0

I just want to save data in stat table but it show me error:

Missing argument 1 for CUserIdentity::__construct(), called in C:\xamp\htdocs\balteen\protected\controllers\RegisterController.php on line 60 and defined

My code:

$stats = new Stat();                   
$stats->browser = Yii::app()->browser->getBrowser();
$stats->os = Yii::app()->browser->getPlatform();
$stats->tableName = 'Organization';
$stats->user_id = 0;
$stats->field_id = 0;
$stats->activity = "sign up";
$stats->ip = $_SERVER['REMOTE_ADDR'];
$stats->time = localtime();

if($stats->save())
{            
    $this->render('success',array('model' => $title));                            
} 
DontVoteMeDown
  • 21,122
  • 10
  • 69
  • 105
  • It might help if you posted the relevant piece of code ... Basically you are doing `new CUserIdentity()` somehwere, where you should be doing `new CUserIdentity($someValueOrVariable)`. No clue how or where though, since there is nothing in your example code that seems appropriate.. – Damien Overeem Nov 12 '13 at 11:36
  • 1
    It is clear from the error message that Constructor of CUserIdentity class needs one arguement which you have not passed. Although, CUserIdentity is not visible in your snippet – Bhavik Shah Nov 12 '13 at 11:37
  • The CUserIdentity class expects username and password in its constructor arguments. If you have used the generator to create your project you will have the file models/LoginForm.php in which you will find the login() function in which you will find a call to the UserIdentity constructor. I am guessing that your problem is related to something in this area. I hope I have given you a good clue. – dataskills Nov 13 '13 at 06:54

0 Answers0