Yii Framework Forum: Crud & Primary Key Problem - Yii Framework Forum

Jump to content

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

Crud & Primary Key Problem Rate Topic: -----

#1 User is offline   klemmy 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 17-July 13

Posted 17 July 2013 - 07:22 AM

Hi,

I'm a newbie, and 'ive starting learning yii with the documentation.
I'm trying to implement the CRUD with yiic shell.
The first step worked perfectly (model User tbl_user)
But the second step (crud User)returns an error : "tbl_user" does not have a primary key.
I've created the table with auto_increment, and phpmyadmin confirms the fact that there IS a primary key.

Does anyone know how to solve this problem?

Thanks!
0

#2 User is offline   Rajith R 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 865
  • Joined: 20-April 11
  • Location:India

Posted 17 July 2013 - 07:26 AM

View Postklemmy, on 17 July 2013 - 07:22 AM, said:

Hi,

I'm a newbie, and 'ive starting learning yii with the documentation.
I'm trying to implement the CRUD with yiic shell.
The first step worked perfectly (model User tbl_user)
But the second step (crud User)returns an error : "tbl_user" does not have a primary key.
I've created the table with auto_increment, and phpmyadmin confirms the fact that there IS a primary key.

Does anyone know how to solve this problem?

Thanks!



assign a primary key and then create the model again.

then create the CRUD.
Rajith Ramachandran,
Wiwo inc.
| Mobile: 919995504508
0

#3 User is offline   klemmy 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 17-July 13

Posted 17 July 2013 - 07:51 AM

I've already assigned a primary key, and it still won't work...

This screenshot is in french, i'm sorry

Attached File(s)


0

#4 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 3,346
  • Joined: 17-January 09
  • Location:Russia

Posted 17 July 2013 - 09:11 AM

Try using Gii instead of console. If it's the same, please provide table creation SQL (can be exported via phpmyadmin).
Yii 1.1 Application Development Cookbook

Enjoying Yii? Star us at github: 1.1 and 2.0.
0

#5 User is offline   Rajith R 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 865
  • Joined: 20-April 11
  • Location:India

Posted 18 July 2013 - 12:42 AM

View Postklemmy, on 17 July 2013 - 07:51 AM, said:

I've already assigned a primary key, and it still won't work...

This screenshot is in french, i'm sorry


try with gii

enable gii in main config .
Rajith Ramachandran,
Wiwo inc.
| Mobile: 919995504508
0

#6 User is offline   dickypadang 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 15
  • Joined: 31-March 12

Posted 28 August 2013 - 05:12 AM

I think you must delete old file model, because gii read from model you have created in folder model,
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