Yii Framework Forum: Yii User Extension (Can't Create New Relations) - Yii Framework Forum

Jump to content

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

Yii User Extension (Can't Create New Relations) Rate Topic: -----

#1 User is offline   gunnit 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 50
  • Joined: 08-June 12

Posted 09 May 2013 - 10:55 AM

Hello all and thanks for reading my post.
I set up the yii user extension and it works fine. I created a new table and i created a new relationship to the User table.
The User model is in the modules folder and not with all the other models.
When i try to use the relationship (eg '$data->user->username') in my code i get the following error
include(Users.php): failed to open stream: No such file or directory

Anybody has an idea how i can solve this problem ?
0

#2 User is offline   jacmoe 

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

Posted 09 May 2013 - 11:00 AM

Even though the table is called 'users', the model is called User.

        	'user' => array(self::BELONGS_TO, 'User', 'user_id'),


/* moved from General Discussion */
"Less noise - more signal"
0

#3 User is offline   gunnit 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 50
  • Joined: 08-June 12

Posted 09 May 2013 - 11:04 AM

View Postjacmoe, on 09 May 2013 - 11:00 AM, said:

Even though the table is called 'users', the model is called User.

        	'user' => array(self::BELONGS_TO, 'User', 'user_id'),


/* moved from General Discussion */

so i should change the name of the relationship or of the file ? sry if i sound ignorant on the subject
0

#4 User is offline   jacmoe 

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

Posted 09 May 2013 - 11:05 AM

The relationsship - how does it look now?
"Less noise - more signal"
0

#5 User is offline   gunnit 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 50
  • Joined: 08-June 12

Posted 09 May 2013 - 06:06 PM

View Postjacmoe, on 09 May 2013 - 11:05 AM, said:

The relationsship - how does it look now?

'user' => array(self::BELONGS_TO, 'Users', 'user_id'),
0

#6 User is offline   jacmoe 

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

Posted 09 May 2013 - 06:10 PM

It should be 'User'.
The model is called 'User'. :)
"Less noise - more signal"
0

#7 User is offline   jacmoe 

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

Posted 09 May 2013 - 06:12 PM

IMO, they made a big mistake in choosing to name the User table 'users' ...
That never ceases to produce problems.. :)
"Less noise - more signal"
0

#8 User is offline   gunnit 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 50
  • Joined: 08-June 12

Posted 09 May 2013 - 06:17 PM

View Postjacmoe, on 09 May 2013 - 06:10 PM, said:

It should be 'User'.
The model is called 'User'. :)

Sweet , no wonder u an elite member :-), thanks solved it , sorry for a stupid question should have paid more attention , next time i will also post in the right place , have a good one
0

#9 User is offline   jacmoe 

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

Posted 09 May 2013 - 06:22 PM

You are welcome - and thanks :)

I do not move posts to punish people - I move them to try and create some order. :lol:
"Less noise - more signal"
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