Yii Framework Forum: Property "User.salt" is not defined. - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Property "User.salt" is not defined. newbee Rate Topic: ***** 1 Votes

#1 User is offline   ibbrxx 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 20-March 10
  • Location:Maldives

Posted 20 March 2010 - 03:43 AM

here the error message i get:
CException
Description

Property "User.salt" is not defined.
Source File

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

00095: */
00096: public function __get($name)
00097: {
00098: if(isset($this->_attributes[$name]))
00099: return $this->_attributes[$name];
00100: else if(isset($this->getMetaData()->columns[$name]))
00101: return null;
00102: else if(isset($this->_related[$name]))
00103: return $this->_related[$name];
00104: else if(isset($this->getMetaData()->relations[$name]))
00105: return $this->getRelated($name);
00106: else
00107: return parent::__get($name);
00108: }
00109:
00110: /**
00111: * PHP setter magic method.
00112: * This method is overridden so that AR attributes can be accessed like properties.
00113: * @param string property name
00114: * @param mixed property value
00115: */
00116: public function __set($name,$value)
00117: {
00118: if($this->setAttribute($name,$value)===false)
00119: {

Stack Trace

#0 C:\wamp\www\yii\framework\db\ar\CActiveRecord.php(107): CComponent->__get('salt')
#1 C:\wamp\www\blog\protected\models\User.php(101): CActiveRecord->__get('salt')
#2 C:\wamp\www\blog\protected\components\UserIdentity.php(18): User->validatePassword('demo')
#3 C:\wamp\www\blog\protected\models\LoginForm.php(52): UserIdentity->authenticate()
#4 C:\wamp\www\yii\framework\validators\CInlineValidator.php(39): LoginForm->authenticate('password', Array)
#5 C:\wamp\www\yii\framework\validators\CValidator.php(176): CInlineValidator->validateAttribute(Object(LoginForm), 'password')
#6 C:\wamp\www\yii\framework\base\CModel.php(150): CValidator->validate(Object(LoginForm), NULL)
#7 C:\wamp\www\blog\protected\controllers\SiteController.php(88): CModel->validate()
#8 C:\wamp\www\yii\framework\web\actions\CInlineAction.php(32): SiteController->actionLogin()
#9 C:\wamp\www\yii\framework\web\CController.php(300): CInlineAction->run()
#10 C:\wamp\www\yii\framework\web\CController.php(278): CController->runAction(Object(CInlineAction))
#11 C:\wamp\www\yii\framework\web\CController.php(257): CController->runActionWithFilters(Object(CInlineAction), Array)
#12 C:\wamp\www\yii\framework\web\CWebApplication.php(320): CController->run('login')
#13 C:\wamp\www\yii\framework\web\CWebApplication.php(120): CWebApplication->runController('site/login')
#14 C:\wamp\www\yii\framework\base\CApplication.php(135): CWebApplication->processRequest()
#15 C:\wamp\www\blog\index.php(12): CApplication->run()
#16 {main}

2010-03-20 13:35:57 Apache/2.2.11 (Win32) PHP/5.2.9-1 Yii Framework/1.1.1
0

#2 User is offline   ekerazha 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 505
  • Joined: 10-October 08
  • Location:European Union

Posted 20 March 2010 - 07:06 AM

You are trying to use the "salt" field but there isn't any "salt" field for your model class
Yii user #37
0

#3 User is offline   backwardselvis 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 19
  • Joined: 24-February 10
  • Location:Bend, OR

Posted 20 March 2010 - 01:48 PM

ibbrxx,

Ekerazha is correct, you need to add the attribute into your model.

...
public $salt;
..


Abovie is an insanely basic example, but give it a whirl. Post your model/User.php file if you still are having issues.
0

#4 User is offline   ibbrxx 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 20-March 10
  • Location:Maldives

Posted 21 March 2010 - 12:22 AM

cheers to you quick support guys....got hold of the problem now. I AM LOVING THIS NEW YII BABY
0

#5 User is offline   monk 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 8
  • Joined: 22-March 11

Posted 04 May 2011 - 08:08 AM

Yap, the above field definition works. I just used it in my app and was able to resolve this problem. Thanks guys.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users