File tree Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -38,8 +38,8 @@ class Container extends Nette\ComponentModel\Container implements \ArrayAccess
3838 /** @var bool */
3939 private $ validated ;
4040
41- /** @var string */
42- private $ mappedType = ArrayHash::class ;
41+ /** @var ? string */
42+ private $ mappedType ;
4343
4444
4545 /********************* data exchange ****************d*g**/
@@ -109,7 +109,7 @@ public function getValues($returnType = null)
109109 {
110110 $ returnType = $ returnType
111111 ? ($ returnType === true ? self ::ARRAY : $ returnType ) // back compatibility
112- : $ this ->mappedType ;
112+ : ( $ this ->mappedType ?? ArrayHash::class) ;
113113
114114 $ isArray = $ returnType === self ::ARRAY ;
115115 $ obj = $ isArray ? new \stdClass : new $ returnType ;
@@ -118,7 +118,7 @@ public function getValues($returnType = null)
118118 if ($ control instanceof IControl && !$ control ->isOmitted ()) {
119119 $ obj ->$ name = $ control ->getValue ();
120120 } elseif ($ control instanceof self) {
121- $ obj ->$ name = $ control ->getValues ($ isArray ? self ::ARRAY : null );
121+ $ obj ->$ name = $ control ->getValues ($ isArray && ! $ control -> mappedType ? self ::ARRAY : null );
122122 }
123123 }
124124 return $ isArray ? (array ) $ obj : $ obj ;
Original file line number Diff line number Diff line change @@ -238,13 +238,13 @@ test(function () { // getValues(...arguments...)
238238
239239 Assert::equal ([
240240 'title ' => 'new1 ' ,
241- 'first ' => [
241+ 'first ' => hydrate (FormFirstLevel::class, [
242242 'name ' => 'new2 ' ,
243243 'age ' => null ,
244- 'second ' => [
244+ 'second ' => hydrate (FormSecondLevel::class, [
245245 'city ' => '' ,
246- ],
247- ],
246+ ]) ,
247+ ]) ,
248248 ], $ form ->getValues (true ));
249249});
250250
You can’t perform that action at this time.
0 commit comments