to add an datepicker of filter in sonata admin with error: "The option "field_options" does not exist"

you need to do this:
        $datagridMapper
            ->add(
                'time',
                'doctrine_orm_datetime_range',
                // this is a bug from sonata , you must set it or you will get an error:
                //"The option "field_options" does not exist"
                // see the class DatagridMapper
                array('field_type' => 'sonata_type_datetime_range'),
                null,
                array(
                    'widget' => 'single_text',
                    'format' => 'dd-MM-yyyy H:m',
                    'required' => false,
                    'attr' =>
                        array('class' => 'date_time_selector'))
            )

评论

热门博文