Auth Extension

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.

Do you have a model named ‘User’ with a ‘name’ field?

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

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.

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.

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.

),