Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Validator] Using Standalone Form + Validator 2.5+ #11606

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

Closed
idybil opened this issue Aug 7, 2014 · 6 comments
Closed

[Validator] Using Standalone Form + Validator 2.5+ #11606

idybil opened this issue Aug 7, 2014 · 6 comments

Comments

@idybil
Copy link

idybil commented Aug 7, 2014

Hi guys, I'm using the standalone Form + Validator components. In my ValidatorBuilder, my setup is set to use the latest validator API (setApiVersion(Validation::API_VERSION_2_5)). And my Form integrates the Validator using the Form\Extension\Validator\ValidatorExtension classe.

Now, Imagine that you have a form builder that adds an entry with no type ($builder->add('test'))

When creating the form, and error is raised saying :

Symfony\Component\Validator\Validator\RecursiveValidator::getMetadataFactory() in Symfony\Component\Form\Extension\Validator\ValidatorExtension.php on line 62

in the ValidatorExtension classe, the loadTypeGuesser method calls the $this->validator->getMetadataFactory() which is not define in the RecursiveValidator class.

Is this really a Bug, or should I always put a type when adding an entry to the form builder ?

Thanks!

@webmozart
Copy link
Contributor

Thank you for taking the time to report this bug @idybil! I can confirm it. We will fix it as soon as possible.

@idybil
Copy link
Author

idybil commented Aug 7, 2014

Thanks webmozart

@webmozart
Copy link
Contributor

Can you confirm whether #11645 fixes the bug for you?

webmozart added a commit that referenced this issue Aug 15, 2014
…ation API (webmozart)

This PR was merged into the 2.5 branch.

Discussion
----------

[Form] Fixed ValidatorExtension to work with the 2.5 Validation API

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #11606
| License       | MIT
| Doc PR        | -

The ValidatorExtension::loadTypeGuesser() method used to fail because the method `getMetadataFactory()` does not exist anymore on the new `ValidatorInterface`. This was fixed easily, because `ValidatorInterface` now extends `ClassMetadataFactory`.

Commits
-------

ff74f4e [Form] Fixed ValidatorExtension to work with the 2.5 Validation API
@idybil
Copy link
Author

idybil commented Aug 16, 2014

Thanks webmozart for your fast correction, and I confirm that it is working now.

@webmozart
Copy link
Contributor

Awesome, thanks for checking back! :)

@sstok
Copy link
Contributor

sstok commented Aug 17, 2014

This can be closed now right?

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

3 participants