Yii Framework Forum: Auth Extension - Yii Framework Forum

Jump to content

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

Auth Extension Property "User.name" is not defined. Rate Topic: -----

#1 User is offline   codepress 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 11
  • Joined: 27-August 12

Posted 31 December 2012 - 09:14 AM

Hello
I've just installed the Bootstap extension and the Auth extension by Chris83

Getting this error when I try to access <my web root>/auth/Assignment/ :

Property "User.name" is not defined

public function __get($name)
134 {
135 if(isset($this->_attributes[$name]))
136 return $this->_attributes[$name];
137 else if(isset($this->getMetaData()->columns[$name]))
138 return null;
139 else if(isset($this->_related[$name]))
140 return $this->_related[$name];
141 else if(isset($this->getMetaData()->relations[$name]))
142 return $this->getRelated($name);
143 else
144 return parent::__get($name);
145 }
146
147 /**
148 * PHP setter magic method.
149 * This method is overridden so that AR attributes can be accessed like properties.
150 * @param string $name property name
151 * @param mixed $value property value
152 */
153 public function __set($name,$value)
154 {
155 if($this->setAttribute($name,$value)===false)
156 {

Stack Trace
#0
+
/srv/www/htdocs/framework/db/ar/CActiveRecord.php(144): CComponent->__get("name")
#1

/srv/www/htdocs/gweb/protected/modules/auth/widgets/AuthAssignmentNameColumn.php(43): CActiveRecord->__get("name")

38 * @param mixed $data the data associated with the row.
39 */
40 protected function renderDataCellContent($row, $data)
41 {
42 if (isset($this->nameColumn))
43 echo CHtml::link($data->{$this->nameColumn}, array('view', 'id'=>$data->{$this->idColumn}));
44 }
45 }

Appreciate any help getting this working. Thanks.
0

#2 User is offline   jacmoe 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 2,601
  • Joined: 10-October 10
  • Location:Denmark

Posted 31 December 2012 - 10:26 AM

Do you have a model named 'User' with a 'name' field?
"Less noise - more signal"
0

#3 User is offline   developer! 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 110
  • Joined: 28-November 12

Posted 31 December 2012 - 10:30 AM

do you have name field in your user table. if so, are you providing the name value???
0

#4 User is offline   codepress 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 11
  • Joined: 27-August 12

Posted 31 December 2012 - 11:35 AM

Thanks for the replies.
I don't have a user table. :-[ I previously installed the Login extension which created a table named
users. I guess these extensions are incompatible?

In an interesting side note, after installing Bootstrap and Auth, when I try to access gii I am redirected to the home page with no error message.
0

#5 User is offline   jacmoe 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 2,601
  • Joined: 10-October 10
  • Location:Denmark

Posted 31 December 2012 - 12:10 PM

It's because that extension with the users table doesn't follow conventions.

Just change the name from User to Users. :)

Never, ever name a db table plural.
"Less noise - more signal"
0

#6 User is offline   Nisanth thulasi 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 68
  • Joined: 10-July 12
  • Location:Kochi

Posted 09 February 2013 - 01:33 AM

config/main.php

in modules array add as below


'auth' => array(
  'strictMode' => true, // when enabled authorization items cannot be assigned children of the same type.
  'userClass' => 'User', // the name of the user model class.
  'userIdColumn' => 'id', // the name of the user id column.
  'userNameColumn' => 'name', // the name of the user name column.
  'appLayout' => 'application.views.layouts.main', // the layout used by the module.
  'viewDir' => null, // the path to view files to use with this module.
),

Thanks
Nisanth Thulasi
1

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