Skip to content

Commit

Permalink
use type and defaultValue instead of data_type and default_value for …
Browse files Browse the repository at this point in the history
…extjs generated models
  • Loading branch information
poum committed May 7, 2012
1 parent 19501c4 commit 331f889
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
6 changes: 3 additions & 3 deletions lib/DBICx/Generator/ExtJS/Model.pm
Expand Up @@ -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} );
Expand All @@ -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;
Expand Down
38 changes: 19 additions & 19 deletions t/test.t
Expand Up @@ -37,10 +37,10 @@ eq_or_diff(
}
],
'fields' => [
{ 'data_type' => 'int',
{ 'type' => 'int',
'name' => 'id',
},
{ 'data_type' => 'int',
{ 'type' => 'int',
'name' => 'num',
},
],
Expand Down Expand Up @@ -68,10 +68,10 @@ eq_or_diff(
}
],
'fields' => [
{ 'data_type' => 'int',
{ 'type' => 'int',
'name' => 'id',
},
{ 'data_type' => 'int',
{ 'type' => 'int',
'name' => 'num',
},
],
Expand All @@ -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',
Expand Down

0 comments on commit 331f889

Please sign in to comment.