Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 39b4abe

Browse filesBrowse files
committed
Be specific about ignored AccessExceptions when mapping to form
1 parent 6c3aaf2 commit 39b4abe
Copy full SHA for 39b4abe

File tree

1 file changed

+7
-0
lines changed
Filter options

1 file changed

+7
-0
lines changed

‎src/Symfony/Component/Form/Extension/Core/DataMapper/PropertyPathMapper.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Extension/Core/DataMapper/PropertyPathMapper.php
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Symfony\Component\Form\DataMapperInterface;
1515
use Symfony\Component\Form\Exception\UnexpectedTypeException;
1616
use Symfony\Component\PropertyAccess\Exception\AccessException;
17+
use Symfony\Component\PropertyAccess\Exception\UninitializedPropertyException;
1718
use Symfony\Component\PropertyAccess\PropertyAccess;
1819
use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
1920

@@ -51,6 +52,12 @@ public function mapDataToForms($data, $forms)
5152
$form->setData($this->propertyAccessor->getValue($data, $propertyPath));
5253
} catch (AccessException $e) {
5354
// Skip unitialized properties on $data
55+
if (!$e instanceof UninitializedPropertyException
56+
// For versions without UninitializedPropertyException check the exception message
57+
&& (class_exists(UninitializedPropertyException::class) || false === strpos($e->getMessage(), 'You should initialize it'))
58+
) {
59+
throw $e;
60+
}
5461
}
5562
} else {
5663
$form->setData($config->getData());

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.