File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ public function getValues(array $params): array
6969 $ type = array_key_exists (1 , $ part ) ? $ part [1 ] : $ part ['type ' ];
7070 $ value = Converter::formatValue ($ type , $ params [$ part ['property ' ]->name ]);
7171 if ($ value === null && !$ part ['property ' ]->isNullable ) {
72- $ value = Converter::getDefaultValue ($ format [ $ field ][ ' type ' ] );
72+ $ value = Converter::getDefaultValue ($ part [ ' property ' ]-> type );
7373 }
7474 $ values [] = $ value ;
7575 }
Original file line number Diff line number Diff line change @@ -810,6 +810,24 @@ public function testMapping()
810810 $ this ->assertEquals ($ user , $ guest );
811811 }
812812
813+ public function testIndexValueCasting ()
814+ {
815+ $ mapper = $ this ->createMapper ();
816+ $ tester = $ mapper ->getSchema ()
817+ ->createSpace ('tester ' , [
818+ 'id ' => 'integer ' ,
819+ 'name ' => 'string ' ,
820+ ])
821+ ->createIndex ('id ' );
822+
823+ $ default = $ tester ->getIndex (0 )->getValues ([]);
824+ $ this ->assertSame ($ default , []);
825+
826+ $ default = $ tester ->getIndex (0 )->getValues (['id ' => null ]);
827+ // type-based default value casting
828+ $ this ->assertSame ($ default , [0 ]);
829+ }
830+
813831 public function testTupleMap ()
814832 {
815833 $ mapper = $ this ->createMapper ();
You can’t perform that action at this time.
0 commit comments