@@ -109,19 +109,18 @@ discard block |
||
109 | 109 | |
110 | 110 | if($this->use_joins===true){ |
111 | 111 | $value = $mapper->createEntity($row); |
112 | - } |
|
113 | - else{ |
|
112 | + } else{ |
|
114 | 113 | $fkey = $mapper->key; |
115 | 114 | $value = $mapper->findBySpecification((new Specification)->setWhere($fkey, $row[$field])); |
116 | 115 | } |
117 | 116 | |
118 | - } |
|
119 | - elseif(is_string($field) && isset($row[strtolower($field)])){ |
|
117 | + } elseif(is_string($field) && isset($row[strtolower($field)])){ |
|
120 | 118 | $value = $row[strtolower($field)]; |
121 | 119 | } |
122 | 120 | |
123 | - if($value!==false) |
|
124 | - $Entity->{$method_set}($value); |
|
121 | + if($value!==false) { |
|
122 | + $Entity->{$method_set}($value); |
|
123 | + } |
|
125 | 124 | |
126 | 125 | } |
127 | 126 | |
@@ -152,13 +151,11 @@ discard block |
||
152 | 151 | //-------------------------------------------------------------------- |
153 | 152 | if( isset($cfg['unbuild']) && is_object($cfg['unbuild']) ){ |
154 | 153 | $value = call_user_func($cfg['unbuild'], $Entity->{$method_get}() ); |
155 | - } |
|
156 | - elseif(isset($cfg['relation'])){ |
|
154 | + } elseif(isset($cfg['relation'])){ |
|
157 | 155 | |
158 | 156 | $value = $Entity->{$method_get}()->getId(); |
159 | 157 | |
160 | - } |
|
161 | - else{ |
|
158 | + } else{ |
|
162 | 159 | $value = $Entity->{$method_get}(); |
163 | 160 | } |
164 | 161 |
@@ -112,8 +112,7 @@ discard block |
||
112 | 112 | |
113 | 113 | if(method_exists($this, 'onUnBuild'.$propery )){ |
114 | 114 | $value = $this->{'onUnBuild'.$propery}( $Entity->{$method_get}() ); |
115 | - } |
|
116 | - else{ |
|
115 | + } else{ |
|
117 | 116 | $value = $Entity->{$method_get}(); |
118 | 117 | } |
119 | 118 | $row[$field] = $value; |
@@ -148,13 +147,13 @@ discard block |
||
148 | 147 | //событие onBuildField |
149 | 148 | if(method_exists($this, 'onBuild'.$propery )){ |
150 | 149 | $value = $this->{'onBuild'.$propery}($field,$row); |
151 | - } |
|
152 | - elseif(is_string($field) && isset($row[strtolower($field)])){ |
|
150 | + } elseif(is_string($field) && isset($row[strtolower($field)])){ |
|
153 | 151 | $value = $row[strtolower($field)]; |
154 | 152 | } |
155 | 153 | |
156 | - if($value!==false) |
|
157 | - $Entity->{$method_set}($value); |
|
154 | + if($value!==false) { |
|
155 | + $Entity->{$method_set}($value); |
|
156 | + } |
|
158 | 157 | |
159 | 158 | } |
160 | 159 | |
@@ -208,13 +207,13 @@ discard block |
||
208 | 207 | $delete_key > '' && |
209 | 208 | $Entity->getId() > 0){ |
210 | 209 | $result = $this->db->update($this->getEntityTable(), [ $delete_key => 1 ], "{$this->setKey()} = '{$Entity->getId()}'"); |
211 | - } |
|
212 | - elseif($Entity->getId() > 0){ |
|
210 | + } elseif($Entity->getId() > 0){ |
|
213 | 211 | $result = $this->db->delete($this->getEntityTable(), [$this->setKey() => $Entity->getId()]); |
214 | 212 | } |
215 | 213 | |
216 | - if($result===true) |
|
217 | - unset($Entity); |
|
214 | + if($result===true) { |
|
215 | + unset($Entity); |
|
216 | + } |
|
218 | 217 | |
219 | 218 | return $result; |
220 | 219 | } |
@@ -255,8 +254,9 @@ discard block |
||
255 | 254 | if( |
256 | 255 | $this->setSoftDeleteKey()>'' |
257 | 256 | && !isset($specification->getWhere()[$this->setSoftDeleteKey()]) |
258 | - ) |
|
259 | - $specification->setWhere($this->setSoftDeleteKey(),0); |
|
257 | + ) { |
|
258 | + $specification->setWhere($this->setSoftDeleteKey(),0); |
|
259 | + } |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | /** |
@@ -77,8 +77,7 @@ |
||
77 | 77 | { |
78 | 78 | if($value!==false){ |
79 | 79 | $this->where[$field] = $value; |
80 | - } |
|
81 | - else{ |
|
80 | + } else{ |
|
82 | 81 | $this->where = $where; |
83 | 82 | } |
84 | 83 |