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

Incompatibility with Symfony 2.6 #66

Open
rokerkony opened this issue Dec 9, 2014 · 12 comments
Open

Incompatibility with Symfony 2.6 #66

rokerkony opened this issue Dec 9, 2014 · 12 comments
Milestone

Comments

@rokerkony
Copy link

Hi, we updated our project to Symfony 2.6 and this budnle is not working correctly.

fp_js_validator.js:533
Uncaught TypeError: Cannot read property 'indexOf' of undefined

@latysh
Copy link

latysh commented Jan 18, 2015

I have the same issue rokerkony. Did you fix the issue?

@rokerkony
Copy link
Author

not yet... our issue is stil in the backlog, so we didn't updated to 2.6 :-( 👎

@igorpan
Copy link

igorpan commented Feb 1, 2015

+1 Same here

@vgross
Copy link

vgross commented Feb 17, 2015

+1

@manuelj555
Copy link
Contributor

+1

@ZesInternational
Copy link

+1, Any progress on this issue?

@66Ton99
Copy link
Collaborator

66Ton99 commented Mar 12, 2015

No progress for now. PR is welcome :)

@66Ton99 66Ton99 modified the milestone: 1.3.0 Mar 12, 2015
@pk16011990
Copy link

Constraints property $groups is lazy since Symfony 2.6. Solution of this problem:

Fp\JsFormValidatorBundle\Factory\JsFormValidatorFactory:

protected function parseConstraints(array $constraints)
{
    $result = array();
    foreach ($constraints as $item) {
        $item->groups; // protect against lazy loading since Symfony 2.6
        // Translate messages if need and add to result
        foreach ($item as $propName => $propValue) {
            if (false !== strpos(strtolower($propName), 'message')) {
                $item->{$propName} = $this->translateMessage($propValue);
            }
        }

        if ($item instanceof \Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity) {
            $item = new UniqueEntity($item, $this->currentElement->getConfig()->getDataClass());
        }

        $result[get_class($item)][] = $item;
    }

    return $result;
}

@pk16011990
Copy link

Or hotfix in JS:

 FpJsFormValidator._checkValidationGroups = FpJsFormValidator.checkValidationGroups;
 FpJsFormValidator.checkValidationGroups = function (needle, haystack) {
     if (typeof haystack === 'undefined') {
         haystack = ['Default'];
     }
     return FpJsFormValidator._checkValidationGroups(needle, haystack);
 };

@sustmi
Copy link
Contributor

sustmi commented May 24, 2015

I think this was fixed in a8041fe.

@66Ton99
Copy link
Collaborator

66Ton99 commented May 25, 2015

@rokerkony Can you approve it?

@66Ton99
Copy link
Collaborator

66Ton99 commented Mar 29, 2016

It should be fixed in #104
Can you confirm it?

@66Ton99 66Ton99 modified the milestones: 1.3.0, 1.4.1 Mar 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants