Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecated calls for form_javascript #3

Open
CPASimUSante opened this issue Feb 17, 2017 · 0 comments
Open

Deprecated calls for form_javascript #3

CPASimUSante opened this issue Feb 17, 2017 · 0 comments

Comments

@CPASimUSante
Copy link

CPASimUSante commented Feb 17, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant