Symfony Doctrine and I18n admins generator: error when cache is empty

I have a strange error in the admin module created by the admin generator: My model has the following shema:

StmtcHelp: columns: module: { type: string(255) } action: { type: string(255) } content: { type: string(10000) } translated: { type: boolean, notnull: true, default: false } actAs: Timestampable: ~ I18n: fields: [content, translated] 

My generator.yml:

 generator: class: sfDoctrineGenerator param: model_class: stmtcHelp theme: admin non_verbose_templates: true with_show: false singular: ~ plural: ~ route_prefix: stmtc_help with_doctrine_route: true actions_base_class: sfActions config: actions: _delete: credentials: [is_super_admin] _new: credentials: [is_super_admin] _create: credentials: [is_super_admin] fields: ~ list: title: Inline Help display: [ module, action, updated_at ] filter: display: [ module, action ] form: ~ edit: ~ new: ~ 

Now I clear the cache and load the stmtc_help / index action, I get this error:

 SQLSTATE[42S22]: Column not found: 1054 Unknown column 's.content' in 'field list'. Failing Query: "SELECT s.id AS s__id, s.module AS s__module, s.action AS s__action, s.content AS s__content, s.translated AS s__translated, s.created_at AS s__created_at, s.updated_at AS s__updated_at FROM stmtc_help s LIMIT 20" 

Doctrine does not seem to recognize my model as I18n.

But if I reload the page, the error will disappear, everything works fine.

Does anyone have such a problem? What am I missing? Thanks for any help!

+4
source share
1 answer

I had exactly the same problem.
Your model_class parameter in generator.yml set to stmtcHelp , but your model name is stmtcHelp (the first letter is uppercase). Fix it and check routing.yml the same problem.
In my case, I only mistakenly wrote the model in routing.yml , and it caused the same Column not found error.

+2
source

Source: https://habr.com/ru/post/1397590/


All Articles