We use a few days ago YII.
We used a notation for tables such as "TableName".
But arrived at the point of making a call to the DB using the system supplied by Yu, we noticed a possible problem that perhaps could be penalized.
This is the call we wrote:
$ sql = "SELECT * FROM". Levels:: tableName (). "WHERE ({$ idLivelloUtente idLivelloUtente =})";
$ livelloUtente = Yii:: app () -> db-> CreateCommand ($ sql) -> queryRow ();
We get the following error:
CDbCommand failed to execute the SQL statement: SQLSTATE [42703]: Undefined column: 7 ERROR: column "livelloutente" does not exist at character 8. The Executed SQL statement was: SELECT FROM livelloUtente "LivelliUtente" "t" WHERE (idLivelloUtente = 1)
In short, the tablename Yu strength so that they are in lower case.
The function is in the file ModelCommand.php
protected function generateRelationName ($ tableName, $ fkName, $ multiple)
{
if (strcasecmp (substr ($ fkName, -2), 'id')=== 0 & & strcasecmp ($ fkName,' id '))
$ RelationName = rtrim (substr ($ fkName, 0, -2 ),'_');
else
$ = $ RelationName fkName;
$ RelationName [0] = strtolower ($ RelationName);
$ = $ RAWNAME RelationName;
if ($ multiple)
RelationName $ = $ this-> pluralize ($ RelationName);
$ table = $ this-> _schema-> getTable ($ tableName);
$ i = 0;
while (isset ($ table-> columns [$ RelationName]))
$ = $ RelationName RAWNAME. ($ i + +);
return $ RelationName;
}
For us this is a problem in how the names of the tables field names are written in camel-back notation.
Have you by chance got to meet this problem and then find a solution?
Thank you.
Peter