Crud problem chapter 6

Hi, ran into a crud problem with the crud generator.

I am trying to create the Issues crud.

This is not working for me.

Table ‘tbl_issue’ has a composite primary key which is not supported by crud generator.

Is the response I get.

I received no errors in mysql when creating the databases from the code in the book.

Any idea?


you shouldn’t have more than one primary key in your table. Please compare your table structure with the following. The ONLY primary key is ‘id’.

Change this and your CRUD generator should work. You can check this btw. using phpMyAdmin.

Here is the correct SQL up to chapter 6

– Tabellenstruktur für Tabelle tbl_issue

CREATE TABLE tbl_issue (


name varchar(256) NOT NULL,

description varchar(2000) DEFAULT NULL,

project_id int(11) DEFAULT NULL,

type_id int(11) DEFAULT NULL,

status_id int(11) DEFAULT NULL,

owner_id int(11) DEFAULT NULL,

requester_id int(11) DEFAULT NULL,

create_time datetime DEFAULT NULL,

create_user_id int(11) DEFAULT NULL,

update_time datetime DEFAULT NULL,

update_user_id int(11) DEFAULT NULL,


KEY FK_issue_project (project_id),

KEY FK_issue_owner (owner_id),

KEY FK_issue_requester (requester_id)


Let me know if this helps.


That worked thx so much.

As a beginner I am having difficulties mostly cost by the errors in this book which is kinda frustrating so I might be back after some more chapters :slight_smile:

The funny thing is, I made a lot of progress understanding yii BECAUSE of those errors in the book. It just made me think more. But you are right, there is a long list of errata, too long for my taste. This book sells for 40$, one would imagine a proof reader would be mandatory.


I have the same error, i dropped and remake the table with information that was posted,

i erase protected/models/Issue.php and create again the model in the section model generator,

!!!but i still get the same error¡¡¡

Table ‘tbl_issue’ has a composite primary key which is not supported by crud generator.

Any clue about that?

Please help me i will appreciate

After experiencing this issue using yii 1.1.10, I created a free online CRUD generator that works for tables with composite primary keys. Anybody having this problem can use the generator at

Currently the generated views look and function just like views that are created using gii. I will add in error handling though later on to prevent the ugly errors that appear when trying to delete a row from a table that is referenced by a child in another table.

I hope this is a time saver for everyone.

Hello All;

I am quite new to yii and I find it a beautiful framework to use for my projects.

However I have run into an challenge. For some reason, All the code I used in the book up to chapter 6 works fine but my issue CRUD does not save data to the issue table. The Project CRUD still works fine so i decided to create another issue and Project CRUD to test and both failed to save to the database tables.

No error is given when this happens so I tried logging to see if I would have some idea of what might be wrong. I still couldn’t find anything that gives me a solution.

Has any one come across this before and what may be a way out?

I would be most grateful for a reply.