With problem
>> cmodel User
Warning: the table ‘User’ does not exist in the database.
generate User.php
without problem
>> cmodel user
generate user.php
The following model classes are successfully generated:
user
next step
>> crud user
Error: Table "User" does not have a primary key.
>> crud User
Error: Table "User" does not have a primary key.
command
If you have a ‘db’ database connection, you can test these models now with:
$model=user::model()->find();
print_r($model);
>> $model=user::model()->find();
exception ‘CDbException’ with message ‘CDbCommand failed to execute the SQL statement: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘LIMIT 1’ at line 1’ in /opt/yii/framework/db/CDbCommand.php:372
Stack trace:
#0 /opt/yii/framework/db/CDbCommand.php(281): CDbCommand->queryInternal(‘fetch’, 2, Array)
#1 /opt/yii/framework/db/ar/CActiveRecord.php(1451): CDbCommand->queryRow()
#2 /opt/yii/framework/db/ar/CActiveRecord.php(1480): CActiveRecord->query(Object(CDbCriteria))
#3 /opt/yii/framework/cli/commands/ShellCommand.php(145) : eval()'d code(1): CActiveRecord->find()
#4 /opt/yii/framework/cli/commands/ShellCommand.php(145): eval()
#5 /opt/yii/framework/cli/commands/ShellCommand.php(99): ShellCommand->runShell()
#6 /opt/yii/framework/console/CConsoleCommandRunner.php(62): ShellCommand->run(Array)
#7 /opt/yii/framework/console/CConsoleApplication.php(88): CConsoleCommandRunner->run(Array)
#8 /opt/yii/framework/base/CApplication.php(135): CConsoleApplication->processRequest()
#9 /opt/yii/framework/yiic.php(31): CApplication->run()
#10 /opt/yii/framework/yiic(15): require_once(’/opt/yii/framew…’)
#11 {main}
>>
Could anyone help me?
Thank you all.