@@ -68,8 +68,7 @@ discard block |
||
| 68 | 68 | { |
| 69 | 69 | $this->_connection->getPdoInstance()->commit(); |
| 70 | 70 | $this->_active = false; |
| 71 | - } |
|
| 72 | - else |
|
| 71 | + } else |
|
| 73 | 72 | throw new TDbException('dbtransaction_transaction_inactive'); |
| 74 | 73 | } |
| 75 | 74 | |
@@ -83,8 +82,7 @@ discard block |
||
| 83 | 82 | { |
| 84 | 83 | $this->_connection->getPdoInstance()->rollBack(); |
| 85 | 84 | $this->_active = false; |
| 86 | - } |
|
| 87 | - else |
|
| 85 | + } else |
|
| 88 | 86 | throw new TDbException('dbtransaction_transaction_inactive'); |
| 89 | 87 | } |
| 90 | 88 | |
@@ -117,8 +117,7 @@ discard block |
||
| 117 | 117 | try |
| 118 | 118 | { |
| 119 | 119 | $this->_statement = $this->getConnection()->getPdoInstance()->prepare($this->getText()); |
| 120 | - } |
|
| 121 | - catch(Exception $e) |
|
| 120 | + } catch(Exception $e) |
|
| 122 | 121 | { |
| 123 | 122 | throw new TDbException('dbcommand_prepare_failed', $e->getMessage(), $this->getText()); |
| 124 | 123 | } |
@@ -193,11 +192,9 @@ discard block |
||
| 193 | 192 | { |
| 194 | 193 | $this->_statement->execute(); |
| 195 | 194 | return $this->_statement->rowCount(); |
| 196 | - } |
|
| 197 | - else |
|
| 195 | + } else |
|
| 198 | 196 | return $this->getConnection()->getPdoInstance()->exec($this->getText()); |
| 199 | - } |
|
| 200 | - catch(Exception $e) |
|
| 197 | + } catch(Exception $e) |
|
| 201 | 198 | { |
| 202 | 199 | throw new TDbException('dbcommand_execute_failed', $e->getMessage(), $this->getDebugStatementText()); |
| 203 | 200 | } |
@@ -230,8 +227,7 @@ discard block |
||
| 230 | 227 | else |
| 231 | 228 | $this->_statement = $this->getConnection()->getPdoInstance()->query($this->getText()); |
| 232 | 229 | return new TDbDataReader($this); |
| 233 | - } |
|
| 234 | - catch(Exception $e) |
|
| 230 | + } catch(Exception $e) |
|
| 235 | 231 | { |
| 236 | 232 | throw new TDbException('dbcommand_query_failed', $e->getMessage(), $this->getDebugStatementText()); |
| 237 | 233 | } |
@@ -257,8 +253,7 @@ discard block |
||
| 257 | 253 | $result = $this->_statement->fetch($fetchAssociative ? PDO::FETCH_ASSOC : PDO::FETCH_NUM); |
| 258 | 254 | $this->_statement->closeCursor(); |
| 259 | 255 | return $result; |
| 260 | - } |
|
| 261 | - catch(Exception $e) |
|
| 256 | + } catch(Exception $e) |
|
| 262 | 257 | { |
| 263 | 258 | throw new TDbException('dbcommand_query_failed', $e->getMessage(), $this->getDebugStatementText()); |
| 264 | 259 | } |
@@ -286,8 +281,7 @@ discard block |
||
| 286 | 281 | return stream_get_contents($result); |
| 287 | 282 | else |
| 288 | 283 | return $result; |
| 289 | - } |
|
| 290 | - catch(Exception $e) |
|
| 284 | + } catch(Exception $e) |
|
| 291 | 285 | { |
| 292 | 286 | throw new TDbException('dbcommand_query_failed', $e->getMessage(), $this->getDebugStatementText()); |
| 293 | 287 | } |
@@ -83,10 +83,10 @@ discard block |
||
| 83 | 83 | if($validArray || $results instanceof \ArrayAccess || $results instanceof TActiveRecord) |
| 84 | 84 | { |
| 85 | 85 | $this->collectForeignObjects($results); |
| 86 | - while($obj = array_pop($stack)) |
|
| 87 | - $obj->collectForeignObjects($results); |
|
| 88 | - } |
|
| 89 | - elseif($results instanceof TActiveRecordRelation) |
|
| 86 | + while($obj = array_pop($stack)) { |
|
| 87 | + $obj->collectForeignObjects($results); |
|
| 88 | + } |
|
| 89 | + } elseif($results instanceof TActiveRecordRelation) |
|
| 90 | 90 | $stack[] = $this; //call it later |
| 91 | 91 | elseif($results === null || !$validArray) |
| 92 | 92 | $stack = []; |
@@ -236,8 +236,7 @@ discard block |
||
| 236 | 236 | { |
| 237 | 237 | for($i = 0,$k = count($results);$i < $k;$i++) |
| 238 | 238 | $this->setObjectProperty($results[$i], $properties, $collections); |
| 239 | - } |
|
| 240 | - else |
|
| 239 | + } else |
|
| 241 | 240 | $this->setObjectProperty($results, $properties, $collections); |
| 242 | 241 | } |
| 243 | 242 | |
@@ -112,8 +112,7 @@ |
||
| 112 | 112 | if(count($collections[$hash]) > 1) |
| 113 | 113 | throw new TActiveRecordException('ar_belongs_to_multiple_result'); |
| 114 | 114 | $source->$prop = $collections[$hash][0]; |
| 115 | - } |
|
| 116 | - else |
|
| 115 | + } else |
|
| 117 | 116 | $source->$prop = null; |
| 118 | 117 | } |
| 119 | 118 | |
@@ -122,8 +122,7 @@ discard block |
||
| 122 | 122 | $columns = $this->getTableInfo()->getColumns(); |
| 123 | 123 | $this->getInputRepeater()->setDataSource($columns); |
| 124 | 124 | $this->getInputRepeater()->dataBind(); |
| 125 | - } |
|
| 126 | - else |
|
| 125 | + } else |
|
| 127 | 126 | { |
| 128 | 127 | if($this->_editRenderer === null) |
| 129 | 128 | $this->createEditRenderer($record, $classPath); |
@@ -147,8 +146,7 @@ discard block |
||
| 147 | 146 | $index = $this->getControls()->remove($this->getInputRepeater()); |
| 148 | 147 | $this->getControls()->insertAt($index, $this->_editRenderer); |
| 149 | 148 | $this->_editRenderer->setData($record); |
| 150 | - } |
|
| 151 | - else |
|
| 149 | + } else |
|
| 152 | 150 | { |
| 153 | 151 | throw new TConfigurationException( |
| 154 | 152 | 'scaffold_invalid_edit_renderer', $this->getID(), get_class($record)); |
@@ -211,15 +209,13 @@ discard block |
||
| 211 | 209 | $column = $table->getColumn($item->getCustomData()); |
| 212 | 210 | $builder->loadScaffoldInput($this, $item, $column, $record); |
| 213 | 211 | } |
| 214 | - } |
|
| 215 | - else |
|
| 212 | + } else |
|
| 216 | 213 | { |
| 217 | 214 | $this->_editRenderer->updateRecord($record); |
| 218 | 215 | } |
| 219 | 216 | $record->save(); |
| 220 | 217 | return true; |
| 221 | - } |
|
| 222 | - elseif($this->_editRenderer !== null) |
|
| 218 | + } elseif($this->_editRenderer !== null) |
|
| 223 | 219 | { |
| 224 | 220 | //preserve the form data. |
| 225 | 221 | $this->_editRenderer->updateRecord($this->getCurrentRecord()); |
@@ -132,8 +132,7 @@ |
||
| 132 | 132 | if($this->_record === null) |
| 133 | 133 | throw new TConfigurationException('scaffold_invalid_record_pk', |
| 134 | 134 | $this->getRecordClass(), $pk); |
| 135 | - } |
|
| 136 | - else |
|
| 135 | + } else |
|
| 137 | 136 | { |
| 138 | 137 | $class = $this->getRecordClass(); |
| 139 | 138 | if($class !== null) |
@@ -431,14 +431,12 @@ discard block |
||
| 431 | 431 | $this->_recordState = self::STATE_LOADED; |
| 432 | 432 | return true; |
| 433 | 433 | } |
| 434 | - } |
|
| 435 | - elseif($this->_recordState === self::STATE_LOADED) |
|
| 434 | + } elseif($this->_recordState === self::STATE_LOADED) |
|
| 436 | 435 | { |
| 437 | 436 | $this->onUpdate($param); |
| 438 | 437 | if($param->getIsValid() && $gateway->update($this)) |
| 439 | 438 | return true; |
| 440 | - } |
|
| 441 | - else |
|
| 439 | + } else |
|
| 442 | 440 | throw new TActiveRecordException('ar_save_invalid', get_class($this)); |
| 443 | 441 | |
| 444 | 442 | return false; |
@@ -461,8 +459,7 @@ discard block |
||
| 461 | 459 | $this->_recordState = self::STATE_DELETED; |
| 462 | 460 | return true; |
| 463 | 461 | } |
| 464 | - } |
|
| 465 | - else |
|
| 462 | + } else |
|
| 466 | 463 | throw new TActiveRecordException('ar_delete_invalid', get_class($this)); |
| 467 | 464 | |
| 468 | 465 | return false; |
@@ -729,8 +726,7 @@ discard block |
||
| 729 | 726 | { |
| 730 | 727 | $criteria = $this->getRecordCriteria(count($args) > 0 ? $args[0] : null, array_slice($args, 1)); |
| 731 | 728 | return $context->getRelationHandler($criteria); |
| 732 | - } |
|
| 733 | - else |
|
| 729 | + } else |
|
| 734 | 730 | return null; |
| 735 | 731 | } |
| 736 | 732 | |
@@ -749,8 +745,7 @@ discard block |
||
| 749 | 745 | { |
| 750 | 746 | list($property, $relation) = $definition; |
| 751 | 747 | return new TActiveRecordRelationContext($this, $property, $relation); |
| 752 | - } |
|
| 753 | - else |
|
| 748 | + } else |
|
| 754 | 749 | return null; |
| 755 | 750 | } |
| 756 | 751 | |
@@ -833,8 +828,7 @@ discard block |
||
| 833 | 828 | { |
| 834 | 829 | $property = $method[4] === '_' ? substr($method, 5) : substr($method, 4); |
| 835 | 830 | return $this->getRelationHandler($property, $args); |
| 836 | - } |
|
| 837 | - elseif($findOne = strncasecmp($method, 'findby', 6) === 0) |
|
| 831 | + } elseif($findOne = strncasecmp($method, 'findby', 6) === 0) |
|
| 838 | 832 | $condition = $method[6] === '_' ? substr($method, 7) : substr($method, 6); |
| 839 | 833 | elseif(strncasecmp($method, 'findallby', 9) === 0) |
| 840 | 834 | $condition = $method[9] === '_' ? substr($method, 10) : substr($method, 9); |
@@ -900,8 +894,7 @@ discard block |
||
| 900 | 894 | { |
| 901 | 895 | $useArgs = !is_array($parameters) && is_array($args); |
| 902 | 896 | return new TActiveRecordCriteria($criteria, $useArgs ? $args : $parameters); |
| 903 | - } |
|
| 904 | - elseif($criteria instanceof TSqlCriteria) |
|
| 897 | + } elseif($criteria instanceof TSqlCriteria) |
|
| 905 | 898 | return $criteria; |
| 906 | 899 | else |
| 907 | 900 | return new TActiveRecordCriteria(); |
@@ -68,8 +68,7 @@ |
||
| 68 | 68 | foreach($xml['database'] as $name => $value) |
| 69 | 69 | $db->setSubProperty($name, $value); |
| 70 | 70 | } |
| 71 | - } |
|
| 72 | - else |
|
| 71 | + } else |
|
| 73 | 72 | { |
| 74 | 73 | if($prop = $xml->getElementByTagName('database')) |
| 75 | 74 | { |
@@ -180,8 +180,7 @@ |
||
| 180 | 180 | { |
| 181 | 181 | $this->_row = $this->_statement->fetch(); |
| 182 | 182 | $this->_index = 0; |
| 183 | - } |
|
| 184 | - else |
|
| 183 | + } else |
|
| 185 | 184 | throw new TDbException('dbdatareader_rewind_invalid'); |
| 186 | 185 | } |
| 187 | 186 | |