Symfony2 表单日期时间错误

发布于 2024-12-12 09:26:03 字数 553 浏览 0 评论 0原文

当我尝试在 symfony2 中创建 CRUD 时遇到问题。我无法显示日期时间选择。我总是遇到这个问题。

可捕获的致命错误:参数 1 传递给 Symfony\Component\Form\Extension\Core\ChoiceList\MonthChoiceList::__construct() 必须是 IntlDateFormatter 的实例,给定 null,在

中调用

任何想法中调用?

表格类型代码:

public function buildForm(FormBuilder $builder, array $options) 
{ 
    $builder 
        ->add('nome') 
        ->add('email') 
        ->add('senha') 
        ->add('is_super') 
        ->add('is_active') 
        ->add('created') ; 
}

I have a problem when I try to create a crud in symfony2. I can't show the datetime choice. I always get this problem.

Catchable Fatal Error: Argument 1 passed to
Symfony\Component\Form\Extension\Core\ChoiceList\MonthChoiceList::__construct()
must be an instance of IntlDateFormatter, null given, called in

Any idea?

FormType code:

public function buildForm(FormBuilder $builder, array $options) 
{ 
    $builder 
        ->add('nome') 
        ->add('email') 
        ->add('senha') 
        ->add('is_super') 
        ->add('is_active') 
        ->add('created') ; 
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

嘦怹 2024-12-19 09:26:03

我遇到了同样的问题,并通过安装 php_intl 扩展 解决了它。 Ubuntu 中的软件包是 php5-intl。

I had the same problem and solved it by installing the php_intl extension. the package is php5-intl in Ubuntu.

-小熊_ 2024-12-19 09:26:03

多谢 !您需要 intl :然后停用它(使用 wamp/php 5.3.9)!

如果您使用 Wamp 和 PHP 5.3.9,则此问题可能会消失
关闭国际扩展。

有时 intl 扩展名会丢失 dll。您从 apache/bin/ 中的 php 文件夹复制 icu*.ddl。 (可能是因为在 wamp 中 php.ini 位于 apache/bin 中)。

Thanks a lot ! You need intl : then deactivate it (with wamp/php 5.3.9) !

If you use Wamp and PHP 5.3.9, this problem may disappear if you
turn off the intl extension.

Sometimes intl extension is missing dlls. You copy your icu*.ddl from your php folder in your apache/bin/. (Probably because in wamp php.ini is in apache/bin).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文