1

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') ; 
}
2
  • 1
    Show some formtype code. Commented Oct 27, 2011 at 18:26
  • public function buildForm(FormBuilder $builder, array $options) { $builder ->add('nome') ->add('email') ->add('senha') ->add('is_super') ->add('is_active') ->add('created') ; } Commented Oct 27, 2011 at 21:53

2 Answers 2

4

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

Sign up to request clarification or add additional context in comments.

4 Comments

I thought it could be a dll extension missing. But it's installed like Symfony documentation is recommended.
have you verified that it's actually installed correctly by testing with sample code in your controller? Try one of the samples included in the documentation for IntlDateFormatter. Also, please confirm that your created field is defined as a date type.
and you tested IntlDateFormatter as I suggested?
Wampserver was the problem. Please, install php5.3+ and Appache2.2+ standalone. Don't use these packages(lamp) to run Symfony2 in local server.
3

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).

1 Comment

It's strange, but disabling Intl extension get rid off error. I’ve used it only on my developer’s machine…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.