File tree 1 file changed +7
-0
lines changed
src/Symfony/Component/Form/Extension/Core/DataMapper
1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change 14
14
use Symfony \Component \Form \DataMapperInterface ;
15
15
use Symfony \Component \Form \Exception \UnexpectedTypeException ;
16
16
use Symfony \Component \PropertyAccess \Exception \AccessException ;
17
+ use Symfony \Component \PropertyAccess \Exception \UninitializedPropertyException ;
17
18
use Symfony \Component \PropertyAccess \PropertyAccess ;
18
19
use Symfony \Component \PropertyAccess \PropertyAccessorInterface ;
19
20
@@ -51,6 +52,12 @@ public function mapDataToForms($data, $forms)
51
52
$ form ->setData ($ this ->propertyAccessor ->getValue ($ data , $ propertyPath ));
52
53
} catch (AccessException $ e ) {
53
54
// 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
+ }
54
61
}
55
62
} else {
56
63
$ form ->setData ($ config ->getData ());
You can’t perform that action at this time.
0 commit comments