Silverstripe 在尝试保存日期时崩溃
我正在尝试创建一个非常简单的性能类,它扩展数据对象并具有其中一个字段的日期,但由于某种原因,如果我在按“添加”时填写它,它就会挂起。我已经检查了 Chrome 检查器,它触发了 Ajax 请求,但该请求从未返回任何内容,我什至尝试将其保留几分钟,但仍然没有任何返回,也没有任何内容放入错误日志中。 如果我将日期留空并仅填写文本字段,则效果很好,这是我正在使用的代码。
class Performance extends DataObject {
static $db = array(
'Title' => 'Varchar(255)',
'StartDate' => 'Date',
);
static $summary_fields = array(
'Title' => 'Title',
'Starts' => 'StartDate',
);
static $has_one = array(
'Production' => 'ProductionPage'
);
}
真正奇怪的是,如果我从扩展 Silverstripe 教程中获取 ArticlePage 类,它就可以正常工作,只是如果我尝试使用 DataObject 而不是我遇到的页面来执行此操作。
非常感谢对此的任何帮助,我已经为此苦苦挣扎了几个小时。
I'm trying to create a very simple performance class that extends dataobject and has a date for one of the fields but for some reason if I fill it out when I press 'Add' it just hangs. I've checked in the Chrome inspector and it fires off the Ajax request but the request never returns anything, I've even tried leaving it for a few minutes and still nothing returns and nothing gets puts in the error log either.
If I leave the date blank and just fill out the text field it works fine, here is the code I'm using.
class Performance extends DataObject {
static $db = array(
'Title' => 'Varchar(255)',
'StartDate' => 'Date',
);
static $summary_fields = array(
'Title' => 'Title',
'Starts' => 'StartDate',
);
static $has_one = array(
'Production' => 'ProductionPage'
);
}
What's really weird is if I grab the ArticlePage class from the extending Silverstripe tutorial it works fine, it's just if I try and do it with a DataObject rather than a page that I run into this.
Would really appreciate any help with this, I've been struggling with it for hours now.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试 Legacydatetimefields 模块:http://www.silverstripe.org/legacydatetimefields-module/
最新版本 (2.4) 中 Silverstripe 处理日期和时间的方式发生了变化,这意味着一些处理日期和时间的旧代码不起作用。
希望这有帮助。
Try the Legacydatetimefields module: http://www.silverstripe.org/legacydatetimefields-module/
There was a change of how Silverstripe handles date and time in the latest version (2.4) which means some older code dealing with date and time doesn't work.
Hope this helps.