0

我正在移植具有以下表单代码的旧 Propel 和 Symfony 应用程序:

generator:
  class:              sfPropelGenerator
  param:
    model_class:      UserForm
    theme:            default

    config:
      fields:           
        created_at:     { params: date_format='dd.MM.yyyy HH:mm' }
        updated_at:     { params: date_format='dd.MM.yyyy HH:mm' }

      list:
        title:          User Forms
        display:        [=form_name, product_line, created_at, updated_at]
        filters:        [form_name, product_line]
        object_actions: 
          edit:         { label: "Edit", action: "loadForm", icon: "/sf/sf_admin/images/edit.png" }
          _delete:      ~
        actions:
          _new:      ~

然而,现在我升级到 PropelORMPlugin,我不再看到“编辑”按钮,即“object_actions”似乎不起作用。

这是我设法找到的唯一文档https://github.com/propelorm/sfPropelORMPlugin/blob/master/doc/admin_generator.md

在较新版本中使用“object_actions”的正确方法是什么?

编辑:我正在从 Symfony 1.0 移植到 1.3,从 Propel(我从未真正看过)移植到 sfPropelORMPlugin。

4

1 回答 1

1

文档中:

object_actions:
  moveUp:     { label: "move up", action: "moveUp" }
  moveDown:   { label: "move down", action: "moveDown" }
  _edit:      ~
  _delete:    ~

你应该尝试这样的事情:

object_actions: 
  edit:         { label: "Edit", action: "loadForm", icon: "/sf/sf_admin/images/edit.png" }
  _delete:      -

顺便说一句,您应该从您要移植的版本(propel 和 symfony)中精确定位。

编辑:

它们是 sf 1.0 和 sf 1.3+ 之间 generator.yml 文件结构的一些差异。现在有一个级别config可以放置所有内容。试试这个generator.yml

generator:
  class: sfPropelGenerator
  param:
    model_class:           UserForm
    theme:                 admin

    config:
      fields:
        created_at:     { params: date_format='dd.MM.yyyy HH:mm' }
        updated_at:     { params: date_format='dd.MM.yyyy HH:mm' }
      list:
        title:          User Forms
        display:        [=form_name, product_line, created_at, updated_at]
        object_actions:
          edit: { label: "Edit", action: "loadForm", icon: "/sf/sf_admin/images/edit.png" }
          _delete: ~
        actions:
          _new: ~
      filters:
        fields: [form_name, product_line]

需要注意的一些变化:

  • config:我添加的级别
  • _create:成为__new:
  • filters走出去list
于 2012-08-13T07:42:40.360 回答