diff --git a/lib/DBICx/Generator/ExtJS/Model.pm b/lib/DBICx/Generator/ExtJS/Model.pm index 611b733..d6d7a09 100644 --- a/lib/DBICx/Generator/ExtJS/Model.pm +++ b/lib/DBICx/Generator/ExtJS/Model.pm @@ -205,7 +205,7 @@ sub extjs_model { # views might not have column infos if ( not %$column_info ) { - $field_params->{data_type} = 'auto'; + $field_params->{type} = 'auto'; } else { my $data_type = lc( $column_info->{data_type} ); @@ -218,10 +218,10 @@ sub extjs_model { if exists $column_info->{size} && $column_info->{size} !~ /,/; } - $field_params->{data_type} = $extjs_data_type; + $field_params->{type} = $extjs_data_type; } - $field_params->{default_value} = $column_info->{default_value} + $field_params->{defaultValue} = $column_info->{default_value} if exists $column_info->{default_value}; } push @fields, $field_params; diff --git a/t/test.t b/t/test.t index 14b83b6..c997aeb 100644 --- a/t/test.t +++ b/t/test.t @@ -37,10 +37,10 @@ eq_or_diff( } ], 'fields' => [ - { 'data_type' => 'int', + { 'type' => 'int', 'name' => 'id', }, - { 'data_type' => 'int', + { 'type' => 'int', 'name' => 'num', }, ], @@ -68,10 +68,10 @@ eq_or_diff( } ], 'fields' => [ - { 'data_type' => 'int', + { 'type' => 'int', 'name' => 'id', }, - { 'data_type' => 'int', + { 'type' => 'int', 'name' => 'num', }, ], @@ -90,41 +90,41 @@ eq_or_diff( } ], 'fields' => [ - { 'data_type' => 'int', + { 'type' => 'int', 'name' => 'id', }, - { 'data_type' => 'string', - 'default_value' => 'hello', + { 'type' => 'string', + 'defaultValue' => 'hello', 'name' => 'title', }, - { 'data_type' => 'string', + { 'type' => 'string', 'name' => 'description', }, - { 'data_type' => 'string', + { 'type' => 'string', 'name' => 'email', }, - { 'data_type' => 'string', - 'default_value' => undef, + { 'type' => 'string', + 'defaultValue' => undef, 'name' => 'explicitnulldef', }, - { 'data_type' => 'string', - 'default_value' => '', + { 'type' => 'string', + 'defaultValue' => '', 'name' => 'explicitemptystring', }, - { 'data_type' => 'string', + { 'type' => 'string', 'name' => 'emptytagdef', }, - { 'data_type' => 'int', - 'default_value' => 2, + { 'type' => 'int', + 'defaultValue' => 2, 'name' => 'another_id', }, - { 'data_type' => 'date', + { 'type' => 'date', 'name' => 'timest', }, { - 'data_type' => 'boolean', + 'type' => 'boolean', 'name' => 'boolfield', - 'default_value' => \'true', + 'defaultValue' => \'true', } ], 'idProperty' => 'id',