Showing 2 changed files with 12 additions and 9 deletions
+11 -8
lib/DBIx/Custom.pm
... ...
@@ -238,14 +238,17 @@ sub create_model {
238 238
     $model->name($model_name) unless $model->name;
239 239
     $model->table($model_table) unless $model->table;
240 240
     
241
-    # Apply filter
242
-    my $filter = ref $model->filter eq 'HASH'
243
-               ? [%{$model->filter}]
244
-               : $model->filter;
245
-    warn "DBIx::Custom::Model filter method is DEPRECATED!"
246
-      if @$filter;
247
-    $self->_apply_filter($model->table, @$filter);
248
-
241
+    # Apply filter(DEPRECATED logic)
242
+    if ($model->{filter}) {
243
+        my $filter = ref $model->filter eq 'HASH'
244
+                   ? [%{$model->filter}]
245
+                   : $model->filter;
246
+        $filter ||= [];
247
+        warn "DBIx::Custom::Model filter method is DEPRECATED!"
248
+          if @$filter;
249
+        $self->_apply_filter($model->table, @$filter);
250
+    }
251
+    
249 252
     # Set model
250 253
     $self->model($model->name, $model);
251 254
     
+1 -1
lib/DBIx/Custom/Model.pm
... ...
@@ -99,7 +99,7 @@ sub new {
99 99
 }
100 100
 
101 101
 # DEPRECATED!
102
-has filter => sub { [] };
102
+has 'filter';
103 103
 has 'name';
104 104
 has type => sub { [] };
105 105