@@ -51,9 +51,9 @@ discard block |
||
| 51 | 51 | if (is_array($value)) { |
| 52 | 52 | foreach ($value as $propertyKey => $propertyValue) { |
| 53 | 53 | if (in_array($propertyKey, $allowedProperties)) { |
| 54 | - $this->{'_relations' . ucfirst($propertyKey)}[$key] = $propertyValue; |
|
| 54 | + $this->{'_relations'.ucfirst($propertyKey)}[$key] = $propertyValue; |
|
| 55 | 55 | } else { |
| 56 | - throw new UnknownPropertyException('The relation property named ' . $propertyKey . ' is not supported'); |
|
| 56 | + throw new UnknownPropertyException('The relation property named '.$propertyKey.' is not supported'); |
|
| 57 | 57 | } |
| 58 | 58 | } |
| 59 | 59 | } |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | // Save Has many relations new records |
| 311 | 311 | /** @var BaseActiveRecord $relationModel */ |
| 312 | 312 | foreach ($model->{$relationName} as $i => $relationModel) { |
| 313 | - $pettyRelationName = Inflector::camel2words($relationName, true) . " #{$i}"; |
|
| 313 | + $pettyRelationName = Inflector::camel2words($relationName, true)." #{$i}"; |
|
| 314 | 314 | $this->validateRelationModel($pettyRelationName, $relationName, $relationModel, $event); |
| 315 | 315 | } |
| 316 | 316 | } |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | throw new Exception('One of the related model could not be validated'); |
| 322 | 322 | } |
| 323 | 323 | } catch (Exception $e) { |
| 324 | - Yii::warning(get_class($e) . ' was thrown while saving related records during beforeValidate event: ' . $e->getMessage(), __METHOD__); |
|
| 324 | + Yii::warning(get_class($e).' was thrown while saving related records during beforeValidate event: '.$e->getMessage(), __METHOD__); |
|
| 325 | 325 | $this->_rollback(); |
| 326 | 326 | $model->addError($model->formName(), $e->getMessage()); |
| 327 | 327 | $event->isValid = false; // Stop saving, something went wrong |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | if (array_key_exists($relationName, $this->_relationsScenario)) { |
| 361 | 361 | $relationModel->setScenario($this->_relationsScenario[$relationName]); |
| 362 | 362 | } |
| 363 | - Yii::debug("Validating {$pettyRelationName} relation model using " . $relationModel->scenario . ' scenario', __METHOD__); |
|
| 363 | + Yii::debug("Validating {$pettyRelationName} relation model using ".$relationModel->scenario.' scenario', __METHOD__); |
|
| 364 | 364 | if (!$relationModel->validate()) { |
| 365 | 365 | $this->_addError($relationModel, $model, $relationName, $pettyRelationName); |
| 366 | 366 | } |
@@ -426,7 +426,7 @@ discard block |
||
| 426 | 426 | } |
| 427 | 427 | } |
| 428 | 428 | } catch (Exception $e) { |
| 429 | - Yii::warning(get_class($e) . ' was thrown while saving related records during afterSave event: ' . $e->getMessage(), __METHOD__); |
|
| 429 | + Yii::warning(get_class($e).' was thrown while saving related records during afterSave event: '.$e->getMessage(), __METHOD__); |
|
| 430 | 430 | $this->_rollback(); |
| 431 | 431 | /*** |
| 432 | 432 | * Sadly mandatory because the error occurred during afterSave event |
@@ -460,7 +460,7 @@ discard block |
||
| 460 | 460 | } |
| 461 | 461 | if (!is_array($junctionTableColumns)) { |
| 462 | 462 | throw new RuntimeException( |
| 463 | - 'Junction table columns definition must return an array, got ' . gettype($junctionTableColumns) |
|
| 463 | + 'Junction table columns definition must return an array, got '.gettype($junctionTableColumns) |
|
| 464 | 464 | ); |
| 465 | 465 | } |
| 466 | 466 | } |
@@ -479,10 +479,10 @@ discard block |
||
| 479 | 479 | private function _computePkDiff($initialRelations, $updatedRelations, $forceSave = false) |
| 480 | 480 | { |
| 481 | 481 | // Compute differences between initial relations and the current ones |
| 482 | - $oldPks = ArrayHelper::getColumn($initialRelations, function (BaseActiveRecord $model) { |
|
| 482 | + $oldPks = ArrayHelper::getColumn($initialRelations, function(BaseActiveRecord $model) { |
|
| 483 | 483 | return implode('-', $model->getPrimaryKey(true)); |
| 484 | 484 | }); |
| 485 | - $newPks = ArrayHelper::getColumn($updatedRelations, function (BaseActiveRecord $model) { |
|
| 485 | + $newPks = ArrayHelper::getColumn($updatedRelations, function(BaseActiveRecord $model) { |
|
| 486 | 486 | return implode('-', $model->getPrimaryKey(true)); |
| 487 | 487 | }); |
| 488 | 488 | if ($forceSave) { |
@@ -535,7 +535,7 @@ discard block |
||
| 535 | 535 | if ($relationModel->validate()) { |
| 536 | 536 | $relationModel->save(); |
| 537 | 537 | } else { |
| 538 | - $pettyRelationName = Inflector::camel2words($relationName, true) . " #{$i}"; |
|
| 538 | + $pettyRelationName = Inflector::camel2words($relationName, true)." #{$i}"; |
|
| 539 | 539 | $this->_addError($relationModel, $owner, $relationName, $pettyRelationName); |
| 540 | 540 | throw new DbException("Related record {$pettyRelationName} could not be saved."); |
| 541 | 541 | } |
@@ -565,7 +565,7 @@ discard block |
||
| 565 | 565 | ); |
| 566 | 566 | |
| 567 | 567 | // Deleted relations |
| 568 | - $initialModels = ArrayHelper::index($this->_oldRelationValue[$relationName], function (BaseActiveRecord $model) { |
|
| 568 | + $initialModels = ArrayHelper::index($this->_oldRelationValue[$relationName], function(BaseActiveRecord $model) { |
|
| 569 | 569 | return implode('-', $model->getPrimaryKey(true)); |
| 570 | 570 | }); |
| 571 | 571 | $initialRelations = $owner->{$relationName}; |
@@ -576,7 +576,7 @@ discard block |
||
| 576 | 576 | // Added relations |
| 577 | 577 | $actualModels = ArrayHelper::index( |
| 578 | 578 | $junctionTablePropertiesUsed ? $initialRelations : $owner->{$relationName}, |
| 579 | - function (BaseActiveRecord $model) { |
|
| 579 | + function(BaseActiveRecord $model) { |
|
| 580 | 580 | return implode('-', $model->getPrimaryKey(true)); |
| 581 | 581 | } |
| 582 | 582 | ); |