@@ -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 | } |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | // Save Has many relations new records |
| 306 | 306 | /** @var BaseActiveRecord $relationModel */ |
| 307 | 307 | foreach ($model->{$relationName} as $i => $relationModel) { |
| 308 | - $pettyRelationName = Inflector::camel2words($relationName, true) . " #{$i}"; |
|
| 308 | + $pettyRelationName = Inflector::camel2words($relationName, true)." #{$i}"; |
|
| 309 | 309 | $this->validateRelationModel($pettyRelationName, $relationName, $relationModel, $event); |
| 310 | 310 | } |
| 311 | 311 | } |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | throw new Exception("One of the related model could not be validated"); |
| 317 | 317 | } |
| 318 | 318 | } catch (Exception $e) { |
| 319 | - Yii::warning(get_class($e) . " was thrown while saving related records during beforeValidate event: " . $e->getMessage(), __METHOD__); |
|
| 319 | + Yii::warning(get_class($e)." was thrown while saving related records during beforeValidate event: ".$e->getMessage(), __METHOD__); |
|
| 320 | 320 | $this->_rollback(); |
| 321 | 321 | $model->addError($model->formName(), $e->getMessage()); |
| 322 | 322 | $event->isValid = false; // Stop saving, something went wrong |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | if (array_key_exists($relationName, $this->_relationsScenario)) { |
| 357 | 357 | $relationModel->setScenario($this->_relationsScenario[$relationName]); |
| 358 | 358 | } |
| 359 | - Yii::debug("Validating {$pettyRelationName} relation model using " . $relationModel->scenario . ' scenario', __METHOD__); |
|
| 359 | + Yii::debug("Validating {$pettyRelationName} relation model using ".$relationModel->scenario.' scenario', __METHOD__); |
|
| 360 | 360 | if (!$relationModel->validate()) { |
| 361 | 361 | $this->_addError($relationModel, $model, $relationName, $pettyRelationName); |
| 362 | 362 | } |
@@ -420,7 +420,7 @@ discard block |
||
| 420 | 420 | } |
| 421 | 421 | } |
| 422 | 422 | } catch (Exception $e) { |
| 423 | - Yii::warning(get_class($e) . " was thrown while saving related records during afterSave event: " . $e->getMessage(), __METHOD__); |
|
| 423 | + Yii::warning(get_class($e)." was thrown while saving related records during afterSave event: ".$e->getMessage(), __METHOD__); |
|
| 424 | 424 | $this->_rollback(); |
| 425 | 425 | /*** |
| 426 | 426 | * Sadly mandatory because the error occurred during afterSave event |
@@ -453,7 +453,7 @@ discard block |
||
| 453 | 453 | } |
| 454 | 454 | if (!is_array($junctionTableColumns)) { |
| 455 | 455 | throw new RuntimeException( |
| 456 | - 'Junction table columns definition must return an array, got ' . gettype($junctionTableColumns) |
|
| 456 | + 'Junction table columns definition must return an array, got '.gettype($junctionTableColumns) |
|
| 457 | 457 | ); |
| 458 | 458 | } |
| 459 | 459 | } |
@@ -472,10 +472,10 @@ discard block |
||
| 472 | 472 | private function _computePkDiff($initialRelations, $updatedRelations, $forceSave = false) |
| 473 | 473 | { |
| 474 | 474 | // Compute differences between initial relations and the current ones |
| 475 | - $oldPks = ArrayHelper::getColumn($initialRelations, function (BaseActiveRecord $model) { |
|
| 475 | + $oldPks = ArrayHelper::getColumn($initialRelations, function(BaseActiveRecord $model) { |
|
| 476 | 476 | return implode("-", $model->getPrimaryKey(true)); |
| 477 | 477 | }); |
| 478 | - $newPks = ArrayHelper::getColumn($updatedRelations, function (BaseActiveRecord $model) { |
|
| 478 | + $newPks = ArrayHelper::getColumn($updatedRelations, function(BaseActiveRecord $model) { |
|
| 479 | 479 | return implode("-", $model->getPrimaryKey(true)); |
| 480 | 480 | }); |
| 481 | 481 | if ($forceSave) { |
@@ -528,7 +528,7 @@ discard block |
||
| 528 | 528 | if ($relationModel->validate()) { |
| 529 | 529 | $relationModel->save(); |
| 530 | 530 | } else { |
| 531 | - $pettyRelationName = Inflector::camel2words($relationName, true) . " #{$i}"; |
|
| 531 | + $pettyRelationName = Inflector::camel2words($relationName, true)." #{$i}"; |
|
| 532 | 532 | $this->_addError($relationModel, $owner, $relationName, $pettyRelationName); |
| 533 | 533 | throw new DbException("Related record {$pettyRelationName} could not be saved."); |
| 534 | 534 | } |
@@ -558,7 +558,7 @@ discard block |
||
| 558 | 558 | ); |
| 559 | 559 | |
| 560 | 560 | // Deleted relations |
| 561 | - $initialModels = ArrayHelper::index($this->_oldRelationValue[$relationName], function (BaseActiveRecord $model) { |
|
| 561 | + $initialModels = ArrayHelper::index($this->_oldRelationValue[$relationName], function(BaseActiveRecord $model) { |
|
| 562 | 562 | return implode('-', $model->getPrimaryKey(true)); |
| 563 | 563 | }); |
| 564 | 564 | $initialRelations = $owner->{$relationName}; |
@@ -569,7 +569,7 @@ discard block |
||
| 569 | 569 | // Added relations |
| 570 | 570 | $actualModels = ArrayHelper::index( |
| 571 | 571 | $junctionTablePropertiesUsed ? $initialRelations : $owner->{$relationName}, |
| 572 | - function (BaseActiveRecord $model) { |
|
| 572 | + function(BaseActiveRecord $model) { |
|
| 573 | 573 | return implode('-', $model->getPrimaryKey(true)); |
| 574 | 574 | } |
| 575 | 575 | ); |