I am following the book to chapter6, page 123
I got this error when I try to create an issue (http://localhost/trackstar/index.php?r=issue/create&pid=1)
CDbException
The relation "users" in active record class "Project" is not specified correctly: the join table "tbl_project_ user_assignment" given in the foreign key cannot be found in the database.
/var/www/html/trackstar/protected/models/Project.php(36), which is pointing this line
$usersArray = CHtml::listData($this->users, ‘id’, ‘username’);
Any ideas why I got error on this?
I am using mysql 5.5, here is mysql info,
mysql> select version();
±----------+
| version() |
±----------+
| 5.5.10 |
±----------+
mysql> show create table tbl_project_user_assignment\G
*************************** 1. row ***************************
Table: tbl_project_user_assignment
Create Table: CREATE TABLE tbl_project_user_assignment
(
project_id
int(11) NOT NULL,
user_id
int(11) NOT 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,
PRIMARY KEY (project_id
,user_id
),
KEY FK_user_project
(user_id
),
CONSTRAINT FK_project_user
FOREIGN KEY (project_id
) REFERENCES tbl_project
(id
) ON DELETE CASCADE,
CONSTRAINT FK_user_project
FOREIGN KEY (user_id
) REFERENCES tbl_user
(id
) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1 row in set (0.00 sec)
Thanks!