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

[Form] FormTypeValidatorExtension is not working with Validator 2.5 #11345

Closed
sebastianblum opened this issue Jul 7, 2014 · 2 comments
Closed

Comments

@sebastianblum
Copy link

I'm working with Validator component in Version 2.5 and I already migrated all validators to the api 2.5

I'm trying to use the form component with validator component, then I got this error message:

Catchable Fatal Error: Argument 1 passed to Symfony\Component\Form\Extension\Validator\Type\FormTypeValidatorExtension::__construct() must be an instance of Symfony\Component\Validator\ValidatorInterface, instance of Symfony\Component\Validator\Validator\RecursiveValidator given, called in /.../app/cache/dev/appDevDebugProjectContainer.php on line 1598 and defined in /.../vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Validator/Type/FormTypeValidatorExtension.php line 36

I forked the symfony standard-editor and created this test case:

https://github.com/sebastianblum/symfony-standard/commit/e30d84ee490eea917700422df520686c3d7aef7b

The problem seems to be, that the

https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Form/Extension/Validator/Type/FormTypeValidatorExtension.php#L36

uses the old validator interface (Symfony\Component\Validator\ValidatorInterface) and is not compatible to the new validator interface (Symfony\Component\Validator\Validator\ValidatorInterface)

Thank you very much, greetings from munich, Sebastian

@jakzal
Copy link
Contributor

jakzal commented Jul 7, 2014

re #11036

@sebastianblum
Copy link
Author

Sorry, I didn't see #11036

fabpot added a commit that referenced this issue Jul 15, 2014
…11036 (Sebastian Blum)

This PR was submitted for the master branch but it was merged into the 2.5 branch instead (closes #11350).

Discussion
----------

[2.5][Form] solved dependency to ValidatorInterface, fix #11036

| Q             | A
| ------------- | ---
| Bug fix?      | [yes]
| New feature?  | [no]
| BC breaks?    | [no]
| Deprecations? | [no]
| Tests pass?   | [yes]
| Fixed tickets | #11036, #11345
| License       | MIT
| Doc PR        |

Since Symfony 2.5

The problem was that the form component has a hardcoded depencency to the deprecated validator component (api Version 2.4)
The pull request fixes the dependency to the validator component and supports now both implementations, apiVersion 2.5 and apiVersion 2.4 of the validator component.

@symfony Core Members
please review the changes https://github.com/sebastianblum/symfony/blob/0a1e9c208f8730219bebf89f6696b246a0c88da7/src/Symfony/Component/Form/Extension/Validator/ValidatorExtension.php
I'm not sure if it was the right solution

Commits
-------

705d67b [2.5][Form] solved dependency to ValidatorInterface, fix #11036
fabpot added a commit that referenced this issue Jul 16, 2014
…11036 (Sebastian Blum)

This PR was squashed before being merged into the 2.6-dev branch (closes #11350).

Discussion
----------

[2.5][Form] solved dependency to ValidatorInterface, fix #11036

| Q             | A
| ------------- | ---
| Bug fix?      | [yes]
| New feature?  | [no]
| BC breaks?    | [no]
| Deprecations? | [no]
| Tests pass?   | [yes]
| Fixed tickets | #11036, #11345
| License       | MIT
| Doc PR        |

Since Symfony 2.5

The problem was that the form component has a hardcoded depencency to the deprecated validator component (api Version 2.4)
The pull request fixes the dependency to the validator component and supports now both implementations, apiVersion 2.5 and apiVersion 2.4 of the validator component.

@symfony Core Members
please review the changes https://github.com/sebastianblum/symfony/blob/0a1e9c208f8730219bebf89f6696b246a0c88da7/src/Symfony/Component/Form/Extension/Validator/ValidatorExtension.php
I'm not sure if it was the right solution

Commits
-------

ab765c9 [2.5][Form] solved dependency to ValidatorInterface, fix #11036
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

2 participants