@@ -35,7 +35,8 @@ |
||
35 | 35 | if (property_exists($this, $prop_name) === true) { |
36 | 36 | { |
37 | 37 | $this->$prop_name = $value; |
38 | + } else { |
|
39 | + parent::set($prop_name, $value); |
|
38 | 40 | } |
39 | - else parent::set($prop_name, $value); |
|
40 | 41 | } |
41 | 42 | } |
@@ -146,15 +146,13 @@ |
||
146 | 146 | { |
147 | 147 | $datass = []; |
148 | 148 | |
149 | - if(!is_null($arg2)) |
|
150 | - $datass = [$arg1 => $arg2]; |
|
151 | - elseif(!is_array($arg1) && count(get_called_class()::table()->primaryKeys()) === 1){ |
|
149 | + if(!is_null($arg2)) { |
|
150 | + $datass = [$arg1 => $arg2]; |
|
151 | + } elseif(!is_array($arg1) && count(get_called_class()::table()->primaryKeys()) === 1){ |
|
152 | 152 | $datass = [current(get_called_class()::table()->primaryKeys())->name() => $arg1]; |
153 | - } |
|
154 | - elseif(is_array($arg1)){ |
|
153 | + } elseif(is_array($arg1)){ |
|
155 | 154 | $datass = $arg1; |
156 | - } |
|
157 | - else{ |
|
155 | + } else{ |
|
158 | 156 | throw new CruditesException('ARGUMENTS_ARE_NOT_ACTIONNABLE'); |
159 | 157 | } |
160 | 158 |
@@ -73,8 +73,9 @@ |
||
73 | 73 | $errors = $this->validate(); |
74 | 74 | } |
75 | 75 | } |
76 | - if (!empty($errors)) |
|
77 | - return $errors; |
|
76 | + if (!empty($errors)) { |
|
77 | + return $errors; |
|
78 | + } |
|
78 | 79 | |
79 | 80 | |
80 | 81 | // a tight model *always* match a single table row |