symfony1 – Symfony Doctrine管理生成器和I18n:缓存为空时出错

我在admin生成器创建的管理模块中有一个奇怪的错误:

我的模型有以下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]

我的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:     ~

现在我清除缓存并加载stmtc_help / index操作,我收到此错误:

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不承认我的模型是I18n.

但是,如果我重新加载页面,错误消失,一切正常.

有没有人遇到过这种问题?我错过了什么?
谢谢你的帮助!

最佳答案 我有完全相同的问题.

您在generator.yml中的model_class参数设置为stmtcHelp,但您的模型名称是StmtcHelp(第一个字母是大写).修复此问题并检查routing.yml是否存在同样的问题.

在我的情况下,我的模型只在routing.yml拼写错误,它导致相同的列找不到错误.

点赞