rabin 2 meses atrás
pai
commit
d19f8803c9
1 arquivos alterados com 5 adições e 5 exclusões
  1. 5 5
      src/Dever/Model.php

+ 5 - 5
src/Dever/Model.php

@@ -114,7 +114,7 @@ class Model
                     $data[$k] = $num;
                     file_put_contents($file, '<?php return ' . var_export($data, true) . ';');
                 }
-            } elseif ($k == 'field' && $v != $this->partition['field']['value']) {
+            } elseif ($k == 'field' && $this->partition && isset($this->partition['field']) && $v != $this->partition['field']['value']) {
                 $this->store->partition($this->config, $this->partition['field']);
                 $data['field'] = $this->partition['field']['value'];
                 file_put_contents($file, '<?php return ' . var_export($data, true) . ';');
@@ -167,20 +167,20 @@ class Model
         }
         return $this->store->find($this->config['table'], $param, $set, $this->config['struct'], $lock);
     }
-    public function sum($param = array(), $field)
+    public function sum($param, $field)
     {
         return $this->column($param, 'sum(`'.$field.'`)', 0);
     }
-    public function column($param = array(), $field = 'name', $default = '')
+    public function column($param, $field = 'name', $default = '')
     {
         $info = $this->find($param, array('col' => $field . ' as value'));
         return $info ? $info['value'] : $default;
     }
-    public function columns($param = array(), $field = 'id')
+    public function columns($param, $field = 'id')
     {
         return $this->kv($param, array('col' => $field));
     }
-    public function count($param = array())
+    public function count($param)
     {
         if (isset($this->partition['where']) && $this->partition['where']) {
             $param = array_merge($this->partition['where'], $param);