override _construct

Hello every one thank you for this wonderful framework…

I am building my final year B.Tech Project in Yii framework. I have got a error when i am overriding UserIdentity Constructor


  public void __construct($username, $password, $category)

    {

		$this->_category = $category;

        parent::_construct($username, $password); 

			 

    }

The error I am getting is


 Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE in C:\xampp\xampp\htdocs\wolkus\protected\components\UserIdentity.php on line 15

please help me… thank you

after modifying the above code as


  public function __construct($username, $password, $category)

    {

		$this->_category = $category;

        parent::_construct($username, $password); 

			 

    }

The previous error is solved but now I am getting a new error as


UserIdentity does not have a method named "_construct".


C:\xampp\xampp\htdocs\yii\framework\base\CComponent.php(266)


254     public function __call($name,$parameters)

255     {

256         if($this->_m!==null)

257         {

258             foreach($this->_m as $object)

259             {

260                 if($object->getEnabled() && method_exists($object,$name))

261                     return call_user_func_array(array($object,$name),$parameters);

262             }

263         }

264         if(class_exists('Closure', false) && $this->canGetProperty($name) && $this->$name instanceof Closure)

265             return call_user_func_array($this->$name, $parameters);

266         throw new CException(Yii::t('yii','{class} does not have a method named "{name}".',

267             array('{class}'=>get_class($this), '{name}'=>$name)));

268     }

269 

270     /**

271      * Returns the named behavior object.

272      * The name 'asa' stands for 'as a'.

273      * @param string $behavior the behavior name

274      * @return IBehavior the behavior object, or null if the behavior does not exist

275      * @since 1.0.2

276      */

277     public function asa($behavior)

278     {

please solve this error I am stuck here.???

UserIdentity really does not have a method named "_construct".


parent::__construct($username, $password);

instead of


parent::_construct($username, $password);

Oh so it was a syntax error!!!!

Thank you for your reply

Constructor should have two underscores(__construct) not one (_construct)