Answer the question
In order to leave comments, you need to log in
In Yii 1, active record does not find the table in the database, but it is there! Will I mark?
I get this error:
CDbException
The table "products_to_categories" mentioned in the active record of class "ProductsToCategories" was not found in the database.
1. There is a table "products_to_categories" in the database!
2. In the "ProductsToCategories" class, the table name is spelled CORRECTLY!
public function tableName() {
return 'products_to_categories';
}
WHY!?
Answer the question
In order to leave comments, you need to log in
The problem was this:
Before the line that threw the error, there was a lot of code, and when it came to it, mysql went into trance with the error SQLSTATE[HY000]: General error: 2006 Mysql server has gone away, and PDO did not issue anything, and swore that there were no signs, but in fact there was no connection to the database !!!
The solution was to increase wait_timeout from 10 to 60, in /etc/mysql/my.cnf
1. See if the model has rewritten the method that receives the connection instance to the database (something like getDb, I don’t remember already)
2. Yii can cache the schema (depends on your configs) - if the tables are new and the cache is enabled, you need to clear the cache.
Perhaps everything is trite, a Cyrillic letter in the title? Go to the database, copy the name and paste it into the model.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question