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

时间:2012-02-21 11:04:10

标签: symfony1 doctrine symfony-1.4

我在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。

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

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

1 个答案:

答案 0 :(得分:2)

我有完全相同的问题 model_class中的generator.yml参数设置为stmtcHelp,但您的型号名称为StmtcHelp(第一个字母为大写)。修复此问题并检查routing.yml是否存在同样的问题 在我的情况下,我的模型仅在routing.yml拼写错误,导致同样的Column not found错误。