Skip to content

Deprecated calls for form_javascript #3

@CPASimUSante

Description

@CPASimUSante

I'm using your bundle in a symfony (2.8) project, where it works fine, but i'm having deprecated calls in the logs (which are not blocking yet, but who knows if i upgrade my package versions) which i wish to get rid of :

Using an instance of "Twig_Function_Method" for function "form_javascript" is deprecated since version 1.21. Use Twig_SimpleFunction instead

In my form i use, as you indicate :

...
    {{ form_start(form, {'method': 'post', 'action': path('mypath'), 'attr': {'class': ''}}) }}
        {{ form_widget(form) }}
        {{ form_javascript(form.sessionDateStart) }}
        {{ form_javascript(form.sessionDateEnd) }}
    {{ form_end(form) }}

I looked around a little, and i saw that in mablae/datetimepicker-bundle/src/Twig/Extension/FormExtension.php

    public function getFunctions()
    {
        return array(
            'form_javascript' => new \Twig_Function_Method($this, 'renderJavascript', array('is_safe' => array('html'))),  // twig <= 1.11
        );
    }

maybe it should be replaced by something like :

new \Twig_SimpleFunction('form_javascript', array($this, 'renderJavascript'), array('is_safe' => array('html'))),

But ovbiously, i don't know if there would be full backward compatibility

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions