0

我正在使用 symfony 1.0,管理员生成器用于保存新闻内容。在configuration.yml文件中,我看到以下内容:

generator:
  class:              sfPropelAdminGenerator
  param:
    model_class:      News
    theme:            default
    css:              admin

    list:
      title: News List
      display: [=vcheading, dtnewsdate, idfeednews]
      fields:
        vcheading: { name: News title }
        dtnewsdate: { name: News Date }
        idfeednews: { name: Feed reference }
      max_per_page: 20
      filters: [vcheading, idfeednews]

    edit:
      title: Add/Edit News
      display: [_category, _subcategory, vcheading, lvlongheading, vcsmallimageurl, itsmallimageheight, itsmallimagewidth, vclargeimageurl, itlargeimageheight, itlargeimagewidth, dtnewsdate, lvcontent, lvsummary]
      actions:
        _list: ~
        _save: -
      fields:
        #newscategorys: { name: News Category, type: admin_select_list, params: through_class=Newscategory }
        vcheading: { name: Heading }
        lvlongheading: { name: Long Heading }
        vcsmallimageurl: { name: URL (Small image) }
        itsmallimageheight: { name: Height ( S ) }
        itsmallimagewidth: { name: Width ( S )}
        vclargeimageurl: { name: URL (Large image)  }
        itlargeimageheight: { name: Height ( L ) }
        itlargeimagewidth: { name: Width ( L ) }
        dtnewsdate: { name: News live date, params: format='yyyy-MM-dd'}
        lvcontent: { name: Content, params: rich=true tinymce_options='plugins:"paste,spellchecker",theme_advanced_buttons1:"bold,italic,underline,strikethrough,separator,link,unlink,bullist,numlist,separator,undo,redo,separator,indent,outdent,spellchecker,pastetext,pasteword",theme_advanced_buttons2:"",theme_advanced_buttons3:"",theme_advanced_statusbar_location:"none",elements:"news_lvcontent"' size=50x15 }
        lvsummary: { name: Summary, params: rich=true tinymce_options='plugins:"paste,spellchecker",theme_advanced_buttons1:"bold,italic,underline,strikethrough,separator,link,unlink,bullist,numlist,separator,undo,redo,separator,indent,outdent,spellchecker,pastetext,pasteword",theme_advanced_buttons2:"",theme_advanced_buttons3:"",theme_advanced_statusbar_location:"none",elements:"news_lvsummary"' size=50x15 }

在“newsAction”动作文件中:

class newsActions extends autonewsActions {

    public function updateNewsFromRequest() {  
        parent :: updateNewsFromRequest();
    .
    .
    .
    .
    }

该类autonewsActions在缓存中看到!!!

按“保存”按钮

  • 它转到“newsActions”操作文件并执行在缓存中创建的函数“updateNewsFromRequest”(由 sfPropelAdmin 自动生成)。
  • 在这里,在“autoNewsActions”类下,调用函数“updateNewsFromRequest”并设置日期格式。

如果输入日期格式为“19-01-2013”​​,则值将设置为“2019-01-2013”​​。

这导致"Unable to parse date/time value for [dtnewsdate] from input"错误。

4

1 回答 1

1

您是在谈论这个日期字段dtnewsdate吗?

看来您在generator.yml. 试试这个:

dtnewsdate: { name: News live date, params: format='dd-MM-yyyy'}

2013-01-19否则,如果您不想更新格式,则必须设置一个有效的日期。

于 2013-01-16T13:04:45.263 回答