Error saving information

Hello guys i have created a user account page using CRUD to modify all the user details, however when i click on save i get this error




CException

Description


Property "User.admin" is not defined.

Source File


C:\wamp\www\yii\framework\db\ar\CActiveRecord.php(110)


00098:      */

00099:     public function __get($name)

00100:     {

00101:         if(isset($this->_attributes[$name]))

00102:             return $this->_attributes[$name];

00103:         else if(isset($this->getMetaData()->columns[$name]))

00104:             return null;

00105:         else if(isset($this->_related[$name]))

00106:             return $this->_related[$name];

00107:         else if(isset($this->getMetaData()->relations[$name]))

00108:             return $this->getRelated($name);

00109:         else

00110: return parent::__get($name);

00111:     }

00112: 

00113:     /**

00114:      * PHP setter magic method.

00115:      * This method is overridden so that AR attributes can be accessed like properties.

00116:      * @param string $name property name

00117:      * @param mixed $value property value

00118:      */

00119:     public function __set($name,$value)

00120:     {

00121:         if($this->setAttribute($name,$value)===false)

00122:         {


Stack Trace


#0 C:\wamp\www\yii\framework\db\ar\CActiveRecord.php(110): CComponent->__get('admin')

#1 C:\wamp\www\yii\framework\validators\CRequiredValidator.php(46): CActiveRecord->__get('admin')

#2 C:\wamp\www\yii\framework\validators\CValidator.php(184): CRequiredValidator->validateAttribute(Object(User), 'admin')

#3 C:\wamp\www\yii\framework\base\CModel.php(150): CValidator->validate(Object(User), NULL)

#4 C:\wamp\www\yii\framework\db\ar\CActiveRecord.php(763): CModel->validate(NULL)

#5 C:\wamp\www\mashup\protected\controllers\UserController.php(96): CActiveRecord->save()

#6 [internal function]: UserController->actionUpdate('23')

#7 C:\wamp\www\yii\framework\web\actions\CInlineAction.php(54): ReflectionMethod->invokeArgs(Object(UserController), Array)

#8 C:\wamp\www\yii\framework\web\CController.php(300): CInlineAction->run()

#9 C:\wamp\www\yii\framework\web\filters\CFilterChain.php(133): CController->runAction(Object(CInlineAction))

#10 C:\wamp\www\yii\framework\web\filters\CFilter.php(41): CFilterChain->run()

#11 C:\wamp\www\yii\framework\web\CController.php(1084): CFilter->filter(Object(CFilterChain))

#12 C:\wamp\www\yii\framework\web\filters\CInlineFilter.php(59): CController->filterAccessControl(Object(CFilterChain))

#13 C:\wamp\www\yii\framework\web\filters\CFilterChain.php(130): CInlineFilter->filter(Object(CFilterChain))

#14 C:\wamp\www\yii\framework\web\CController.php(283): CFilterChain->run()

#15 C:\wamp\www\yii\framework\web\CController.php(257): CController->runActionWithFilters(Object(CInlineAction), Array)

#16 C:\wamp\www\yii\framework\web\CWebApplication.php(324): CController->run('update')

#17 C:\wamp\www\yii\framework\web\CWebApplication.php(121): CWebApplication->runController('user/update')

#18 C:\wamp\www\yii\framework\base\CApplication.php(135): CWebApplication->processRequest()

#19 C:\wamp\www\mashup\index.php(13): CApplication->run()

#20 {main}


2011-02-21 06:37:16 Apache/2.2.11 (Win32) mod_ssl/2.2.11 OpenSSL/0.9.8k PHP/5.3.0 Yii Framework/1.1.5




Any help?

In your table there is no a field admin, and also admin is not a property of the model User.

For what you need the field admin?

you’re right, i had removed the admin field long ago from the database but forgot to update my model in the application. Thanks for the help

NOTE: merged duplicate post