@@ -50,9 +50,9 @@ discard block |
||
| 50 | 50 | if (is_array($value)) { |
| 51 | 51 | foreach ($value as $propertyKey => $propertyValue) { |
| 52 | 52 | if (in_array($propertyKey, $allowedProperties)) { |
| 53 | - $this->{'_relations' . ucfirst($propertyKey)}[$key] = $propertyValue; |
|
| 53 | + $this->{'_relations'.ucfirst($propertyKey)}[$key] = $propertyValue; |
|
| 54 | 54 | } else { |
| 55 | - throw new UnknownPropertyException('The relation property named ' . $propertyKey . ' is not supported'); |
|
| 55 | + throw new UnknownPropertyException('The relation property named '.$propertyKey.' is not supported'); |
|
| 56 | 56 | } |
| 57 | 57 | } |
| 58 | 58 | } |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | // Save Has many relations new records |
| 303 | 303 | /** @var BaseActiveRecord $relationModel */ |
| 304 | 304 | foreach ($model->{$relationName} as $i => $relationModel) { |
| 305 | - $pettyRelationName = Inflector::camel2words($relationName, true) . " #{$i}"; |
|
| 305 | + $pettyRelationName = Inflector::camel2words($relationName, true)." #{$i}"; |
|
| 306 | 306 | $this->validateRelationModel($pettyRelationName, $relationName, $relationModel, $event); |
| 307 | 307 | } |
| 308 | 308 | } |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | throw new Exception("One of the related model could not be validated"); |
| 314 | 314 | } |
| 315 | 315 | } catch (Exception $e) { |
| 316 | - Yii::warning(get_class($e) . " was thrown while saving related records during beforeValidate event: " . $e->getMessage(), __METHOD__); |
|
| 316 | + Yii::warning(get_class($e)." was thrown while saving related records during beforeValidate event: ".$e->getMessage(), __METHOD__); |
|
| 317 | 317 | $this->_rollback(); |
| 318 | 318 | $model->addError($model->formName(), $e->getMessage()); |
| 319 | 319 | $event->isValid = false; // Stop saving, something went wrong |
@@ -353,7 +353,7 @@ discard block |
||
| 353 | 353 | if (key_exists($relationName, $this->_relationsScenario)) { |
| 354 | 354 | $relationModel->setScenario($this->_relationsScenario[$relationName]); |
| 355 | 355 | } |
| 356 | - Yii::trace("Validating {$pettyRelationName} relation model using " . $relationModel->scenario . " scenario", __METHOD__); |
|
| 356 | + Yii::trace("Validating {$pettyRelationName} relation model using ".$relationModel->scenario." scenario", __METHOD__); |
|
| 357 | 357 | if (!$relationModel->validate()) { |
| 358 | 358 | $this->_addError($relationModel, $model, $relationName, $pettyRelationName); |
| 359 | 359 | } |
@@ -418,7 +418,7 @@ discard block |
||
| 418 | 418 | if ($relationModel->validate()) { |
| 419 | 419 | $relationModel->save(); |
| 420 | 420 | } else { |
| 421 | - $pettyRelationName = Inflector::camel2words($relationName, true) . " #{$i}"; |
|
| 421 | + $pettyRelationName = Inflector::camel2words($relationName, true)." #{$i}"; |
|
| 422 | 422 | $this->_addError($relationModel, $model, $relationName, $pettyRelationName); |
| 423 | 423 | throw new DbException("Related record {$pettyRelationName} could not be saved."); |
| 424 | 424 | } |
@@ -446,7 +446,7 @@ discard block |
||
| 446 | 446 | $junctionTablePropertiesUsed |
| 447 | 447 | ); |
| 448 | 448 | // Deleted relations |
| 449 | - $initialModels = ArrayHelper::index($this->_oldRelationValue[$relationName], function (BaseActiveRecord $model) { |
|
| 449 | + $initialModels = ArrayHelper::index($this->_oldRelationValue[$relationName], function(BaseActiveRecord $model) { |
|
| 450 | 450 | return implode("-", $model->getPrimaryKey(true)); |
| 451 | 451 | }); |
| 452 | 452 | $initialRelations = $model->{$relationName}; |
@@ -456,7 +456,7 @@ discard block |
||
| 456 | 456 | // Added relations |
| 457 | 457 | $actualModels = ArrayHelper::index( |
| 458 | 458 | $junctionTablePropertiesUsed ? $initialRelations : $model->{$relationName}, |
| 459 | - function (BaseActiveRecord $model) { |
|
| 459 | + function(BaseActiveRecord $model) { |
|
| 460 | 460 | return implode("-", $model->getPrimaryKey(true)); |
| 461 | 461 | } |
| 462 | 462 | ); |
@@ -483,7 +483,7 @@ discard block |
||
| 483 | 483 | } |
| 484 | 484 | } |
| 485 | 485 | } catch (Exception $e) { |
| 486 | - Yii::warning(get_class($e) . " was thrown while saving related records during afterSave event: " . $e->getMessage(), __METHOD__); |
|
| 486 | + Yii::warning(get_class($e)." was thrown while saving related records during afterSave event: ".$e->getMessage(), __METHOD__); |
|
| 487 | 487 | $this->_rollback(); |
| 488 | 488 | /*** |
| 489 | 489 | * Sadly mandatory because the error occurred during afterSave event |
@@ -516,7 +516,7 @@ discard block |
||
| 516 | 516 | } |
| 517 | 517 | if (!is_array($junctionTableColumns)) { |
| 518 | 518 | throw new RuntimeException( |
| 519 | - 'Junction table columns definition must return an array, got ' . gettype($junctionTableColumns) |
|
| 519 | + 'Junction table columns definition must return an array, got '.gettype($junctionTableColumns) |
|
| 520 | 520 | ); |
| 521 | 521 | } |
| 522 | 522 | } |
@@ -535,10 +535,10 @@ discard block |
||
| 535 | 535 | private function _computePkDiff($initialRelations, $updatedRelations, $forceSave = false) |
| 536 | 536 | { |
| 537 | 537 | // Compute differences between initial relations and the current ones |
| 538 | - $oldPks = ArrayHelper::getColumn($initialRelations, function (BaseActiveRecord $model) { |
|
| 538 | + $oldPks = ArrayHelper::getColumn($initialRelations, function(BaseActiveRecord $model) { |
|
| 539 | 539 | return implode("-", $model->getPrimaryKey(true)); |
| 540 | 540 | }); |
| 541 | - $newPks = ArrayHelper::getColumn($updatedRelations, function (BaseActiveRecord $model) { |
|
| 541 | + $newPks = ArrayHelper::getColumn($updatedRelations, function(BaseActiveRecord $model) { |
|
| 542 | 542 | return implode("-", $model->getPrimaryKey(true)); |
| 543 | 543 | }); |
| 544 | 544 | if ($forceSave) { |