@@ -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 | } |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | // Save Has many relations new records |
| 309 | 309 | /** @var BaseActiveRecord $relationModel */ |
| 310 | 310 | foreach ($model->{$relationName} as $i => $relationModel) { |
| 311 | - $pettyRelationName = Inflector::camel2words($relationName, true) . " #{$i}"; |
|
| 311 | + $pettyRelationName = Inflector::camel2words($relationName, true)." #{$i}"; |
|
| 312 | 312 | $this->validateRelationModel($pettyRelationName, $relationName, $relationModel); |
| 313 | 313 | } |
| 314 | 314 | } |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | throw new Exception('One of the related model could not be validated'); |
| 320 | 320 | } |
| 321 | 321 | } catch (Exception $e) { |
| 322 | - Yii::warning(get_class($e) . ' was thrown while saving related records during beforeValidate event: ' . $e->getMessage(), __METHOD__); |
|
| 322 | + Yii::warning(get_class($e).' was thrown while saving related records during beforeValidate event: '.$e->getMessage(), __METHOD__); |
|
| 323 | 323 | $this->_rollback(); |
| 324 | 324 | $model->addError($model->formName(), $e->getMessage()); |
| 325 | 325 | $event->isValid = false; // Stop saving, something went wrong |
@@ -358,7 +358,7 @@ discard block |
||
| 358 | 358 | if (array_key_exists($relationName, $this->_relationsScenario)) { |
| 359 | 359 | $relationModel->setScenario($this->_relationsScenario[$relationName]); |
| 360 | 360 | } |
| 361 | - Yii::debug("Validating {$pettyRelationName} relation model using " . $relationModel->scenario . ' scenario', __METHOD__); |
|
| 361 | + Yii::debug("Validating {$pettyRelationName} relation model using ".$relationModel->scenario.' scenario', __METHOD__); |
|
| 362 | 362 | if (!$relationModel->validate()) { |
| 363 | 363 | $this->_addError($relationModel, $model, $relationName, $pettyRelationName); |
| 364 | 364 | } |
@@ -424,7 +424,7 @@ discard block |
||
| 424 | 424 | } |
| 425 | 425 | } |
| 426 | 426 | } catch (Exception $e) { |
| 427 | - Yii::warning(get_class($e) . ' was thrown while saving related records during afterSave event: ' . $e->getMessage(), __METHOD__); |
|
| 427 | + Yii::warning(get_class($e).' was thrown while saving related records during afterSave event: '.$e->getMessage(), __METHOD__); |
|
| 428 | 428 | $this->_rollback(); |
| 429 | 429 | /*** |
| 430 | 430 | * Sadly mandatory because the error occurred during afterSave event |
@@ -458,7 +458,7 @@ discard block |
||
| 458 | 458 | } |
| 459 | 459 | if (!is_array($junctionTableColumns)) { |
| 460 | 460 | throw new RuntimeException( |
| 461 | - 'Junction table columns definition must return an array, got ' . gettype($junctionTableColumns) |
|
| 461 | + 'Junction table columns definition must return an array, got '.gettype($junctionTableColumns) |
|
| 462 | 462 | ); |
| 463 | 463 | } |
| 464 | 464 | } |
@@ -477,10 +477,10 @@ discard block |
||
| 477 | 477 | private function _computePkDiff($initialRelations, $updatedRelations, $forceSave = false) |
| 478 | 478 | { |
| 479 | 479 | // Compute differences between initial relations and the current ones |
| 480 | - $oldPks = ArrayHelper::getColumn($initialRelations, function (BaseActiveRecord $model) { |
|
| 480 | + $oldPks = ArrayHelper::getColumn($initialRelations, function(BaseActiveRecord $model) { |
|
| 481 | 481 | return implode('-', $model->getPrimaryKey(true)); |
| 482 | 482 | }); |
| 483 | - $newPks = ArrayHelper::getColumn($updatedRelations, function (BaseActiveRecord $model) { |
|
| 483 | + $newPks = ArrayHelper::getColumn($updatedRelations, function(BaseActiveRecord $model) { |
|
| 484 | 484 | return implode('-', $model->getPrimaryKey(true)); |
| 485 | 485 | }); |
| 486 | 486 | if ($forceSave) { |
@@ -533,7 +533,7 @@ discard block |
||
| 533 | 533 | if ($relationModel->validate()) { |
| 534 | 534 | $relationModel->save(); |
| 535 | 535 | } else { |
| 536 | - $pettyRelationName = Inflector::camel2words($relationName, true) . " #{$i}"; |
|
| 536 | + $pettyRelationName = Inflector::camel2words($relationName, true)." #{$i}"; |
|
| 537 | 537 | $this->_addError($relationModel, $owner, $relationName, $pettyRelationName); |
| 538 | 538 | throw new DbException("Related record {$pettyRelationName} could not be saved."); |
| 539 | 539 | } |
@@ -563,7 +563,7 @@ discard block |
||
| 563 | 563 | ); |
| 564 | 564 | |
| 565 | 565 | // Deleted relations |
| 566 | - $initialModels = ArrayHelper::index($this->_oldRelationValue[$relationName], function (BaseActiveRecord $model) { |
|
| 566 | + $initialModels = ArrayHelper::index($this->_oldRelationValue[$relationName], function(BaseActiveRecord $model) { |
|
| 567 | 567 | return implode('-', $model->getPrimaryKey(true)); |
| 568 | 568 | }); |
| 569 | 569 | $initialRelations = $owner->{$relationName}; |
@@ -574,7 +574,7 @@ discard block |
||
| 574 | 574 | // Added relations |
| 575 | 575 | $actualModels = ArrayHelper::index( |
| 576 | 576 | $junctionTablePropertiesUsed ? $initialRelations : $owner->{$relationName}, |
| 577 | - function (BaseActiveRecord $model) { |
|
| 577 | + function(BaseActiveRecord $model) { |
|
| 578 | 578 | return implode('-', $model->getPrimaryKey(true)); |
| 579 | 579 | } |
| 580 | 580 | ); |