【问题标题】:why the symfony admin generator is giving error while trying to save the content为什么 symfony 管理生成器在尝试保存内容时出错
【发布时间】:2013-01-16 11:15:20
【问题描述】:

我使用的是 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" 错误。

【问题讨论】:

    标签: php symfony1 yaml propel admin-generator


    【解决方案1】:

    你说的是dtnewsdate这个日期字段吗?

    您似乎在generator.yml 中定义了错误的格式。试试这个:

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

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

    【讨论】:

      猜你喜欢
      • 2010-11-21
      • 1970-01-01
      • 1970-01-01
      • 2021-12-13
      • 2011-09-01
      • 1970-01-01
      • 1970-01-01
      • 2012-01-15
      • 1970-01-01
      相关资源
      最近更新 更多