8000 [Validator] Constraint validators now use the 2.5 API by webmozart · Pull Request #11485 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Validator] Constraint validators now use the 2.5 API #11485

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

Merged
merged 5 commits into from
Aug 4, 2014
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
[Validator] Fixed failing tests
  • Loading branch information
webmozart committed Jul 28, 2014
commit 295e5bb178a8853d9ff0c6c842d4f96f237a7bc5
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@

use Symfony\Component\Validator\Constraints\Collection;
use Symfony\Component\Validator\Constraints\All;
use Symfony\Component\Validator\ConstraintValidatorFactory;
use Symfony\Component\Validator\ConstraintViolation;
use Symfony\Component\Validator\ConstraintViolationList;
use Symfony\Component\Validator\ExecutionContext;
use Symfony\Component\Validator\LegacyConstraintValidatorFactory;
use Symfony\Component\Validator\Tests\Fixtures\ConstraintA;
use Symfony\Component\Validator\ValidationVisitor;

Expand Down Expand Up @@ -313,7 +313,7 @@ public function testGetPropertyPathWithNestedCollectionsAndAllMixed()
'[name]'
);

$visitor = new ValidationVisitor('Root', $this->metadataFactory, new ConstraintValidatorFactory(), $this->translator);
$visitor = new ValidationVisitor('Root', $this->metadataFactory, new LegacyConstraintValidatorFactory(), $this->translator);
$context = new ExecutionContext($visitor, $this->translator, self::TRANS_DOMAIN);
$context->validateValue($data, $constraints);

Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Validator/ValidatorBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ public function getValidator()
}

if (Validation::API_VERSION_2_5 === $apiVersion) {
$contextFactory = new ExecutionContextFactory($metadataFactory, $translator, $this->translationDomain);
$contextFactory = new ExecutionContextFactory($translator, $this->translationDomain);
$validatorFactory = $validatorFactory ?: new ConstraintValidatorFactory($this->propertyAccessor);

return new RecursiveValidator($contextFactory, $metadataFactory, $validatorFactory, $this->initializers);
Expand Down
0