@@ -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 |
@@ -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 |
@@ -110,8 +110,7 @@ discard block |
||
110 | 110 | |
111 | 111 | if(method_exists($this, 'onUnBuild'.$propery )){ |
112 | 112 | $value = $this->{'onUnBuild'.$propery}( $Entity->{$method_get}() ); |
113 | - } |
|
114 | - else{ |
|
113 | + } else{ |
|
115 | 114 | $value = $Entity->{$method_get}(); |
116 | 115 | } |
117 | 116 | $row[$field] = $value; |
@@ -146,13 +145,13 @@ discard block |
||
146 | 145 | //событие onBuildField |
147 | 146 | if(method_exists($this, 'onBuild'.$propery )){ |
148 | 147 | $value = $this->{'onBuild'.$propery}($field,$row); |
149 | - } |
|
150 | - elseif(is_string($field) && isset($row[strtolower($field)])){ |
|
148 | + } elseif(is_string($field) && isset($row[strtolower($field)])){ |
|
151 | 149 | $value = $row[strtolower($field)]; |
152 | 150 | } |
153 | 151 | |
154 | - if($value!==false) |
|
155 | - $Entity->{$method_set}($value); |
|
152 | + if($value!==false) { |
|
153 | + $Entity->{$method_set}($value); |
|
154 | + } |
|
156 | 155 | |
157 | 156 | } |
158 | 157 | |
@@ -206,8 +205,7 @@ discard block |
||
206 | 205 | $delete_key > '' && |
207 | 206 | $Entity->getId() > 0){ |
208 | 207 | $result = $this->db->update($this->getEntityTable(), [ $delete_key => 1 ], "{$this->getPrimaryKey()} = '{$Entity->getId()}'"); |
209 | - } |
|
210 | - elseif($Entity->getId() > 0){ |
|
208 | + } elseif($Entity->getId() > 0){ |
|
211 | 209 | |
212 | 210 | if($result = $this->db->delete($this->getEntityTable(), $this->getPrimaryKey()." = ".$Entity->getId())){ |
213 | 211 | if(method_exists($this, 'onDeleteSuccess' )){ $result = $this->onDeleteSuccess( $Entity );} |
@@ -253,8 +251,9 @@ discard block |
||
253 | 251 | if( |
254 | 252 | $this->setSoftDeleteKey()>'' |
255 | 253 | && !isset($specification->getWhere()[$this->setSoftDeleteKey()]) |
256 | - ) |
|
257 | - $specification->setWhere($this->setSoftDeleteKey(),0); |
|
254 | + ) { |
|
255 | + $specification->setWhere($this->setSoftDeleteKey(),0); |
|
256 | + } |
|
258 | 257 | } |
259 | 258 | |
260 | 259 | /** |