diff --git a/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationMapper.php b/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationMapper.php index 182f78dac4..ddf061d454 100644 --- a/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationMapper.php +++ b/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationMapper.php @@ -109,12 +109,12 @@ class ViolationMapper implements ViolationMapperInterface } // Follow dot rules until we have the final target - $mapping = $this->scope->getConfig()->getAttribute('error_mapping'); + $mapping = $this->scope->getConfig()->getOption('error_mapping'); while ($this->isValidScope() && isset($mapping['.'])) { $dotRule = new MappingRule($this->scope, '.', $mapping['.']); $this->scope = $dotRule->getTarget(); - $mapping = $this->scope->getConfig()->getAttribute('error_mapping'); + $mapping = $this->scope->getConfig()->getOption('error_mapping'); } // Only add the error if the form is synchronized @@ -281,7 +281,7 @@ class ViolationMapper implements ViolationMapperInterface $this->children = new \RecursiveIteratorIterator( new VirtualFormAwareIterator($form->all()) ); - foreach ($form->getConfig()->getAttribute('error_mapping') as $propertyPath => $targetPath) { + foreach ($form->getConfig()->getOption('error_mapping') as $propertyPath => $targetPath) { // Dot rules are considered at the very end if ('.' !== $propertyPath) { $this->rules[] = new MappingRule($form, $propertyPath, $targetPath); diff --git a/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php b/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php index 252b23c9c5..30cab31f09 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php @@ -68,11 +68,12 @@ class ViolationMapperTest extends \PHPUnit_Framework_TestCase protected function getForm($name = 'name', $propertyPath = null, $dataClass = null, $errorMapping = array(), $virtual = false, $synchronized = true) { - $config = new FormConfig($name, $dataClass, $this->dispatcher); + $config = new FormConfig($name, $dataClass, $this->dispatcher, array( + 'error_mapping' => $errorMapping, + )); $config->setMapped(true); $config->setVirtual($virtual); $config->setPropertyPath($propertyPath); - $config->setAttribute('error_mapping', $errorMapping); if (!$synchronized) { $config->addViewTransformer(new CallbackTransformer(