@@ -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 | } |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | // Save Has many relations new records |
304 | 304 | /** @var BaseActiveRecord $relationModel */ |
305 | 305 | foreach ($model->{$relationName} as $i => $relationModel) { |
306 | - $pettyRelationName = Inflector::camel2words($relationName, true) . " #{$i}"; |
|
306 | + $pettyRelationName = Inflector::camel2words($relationName, true)." #{$i}"; |
|
307 | 307 | $this->validateRelationModel($pettyRelationName, $relationName, $relationModel, $event); |
308 | 308 | } |
309 | 309 | } |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | throw new Exception("One of the related model could not be validated"); |
315 | 315 | } |
316 | 316 | } catch (Exception $e) { |
317 | - Yii::warning(get_class($e) . " was thrown while saving related records during beforeValidate event: " . $e->getMessage(), __METHOD__); |
|
317 | + Yii::warning(get_class($e)." was thrown while saving related records during beforeValidate event: ".$e->getMessage(), __METHOD__); |
|
318 | 318 | $this->_rollback(); |
319 | 319 | $model->addError($model->formName(), $e->getMessage()); |
320 | 320 | $event->isValid = false; // Stop saving, something went wrong |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | if (key_exists($relationName, $this->_relationsScenario)) { |
355 | 355 | $relationModel->setScenario($this->_relationsScenario[$relationName]); |
356 | 356 | } |
357 | - Yii::debug("Validating {$pettyRelationName} relation model using " . $relationModel->scenario . " scenario", __METHOD__); |
|
357 | + Yii::debug("Validating {$pettyRelationName} relation model using ".$relationModel->scenario." scenario", __METHOD__); |
|
358 | 358 | if (!$relationModel->validate()) { |
359 | 359 | $this->_addError($relationModel, $model, $relationName, $pettyRelationName); |
360 | 360 | } |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | if ($relationModel->validate()) { |
421 | 421 | $relationModel->save(); |
422 | 422 | } else { |
423 | - $pettyRelationName = Inflector::camel2words($relationName, true) . " #{$i}"; |
|
423 | + $pettyRelationName = Inflector::camel2words($relationName, true)." #{$i}"; |
|
424 | 424 | $this->_addError($relationModel, $model, $relationName, $pettyRelationName); |
425 | 425 | throw new DbException("Related record {$pettyRelationName} could not be saved."); |
426 | 426 | } |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | $junctionTablePropertiesUsed |
449 | 449 | ); |
450 | 450 | // Deleted relations |
451 | - $initialModels = ArrayHelper::index($this->_oldRelationValue[$relationName], function (BaseActiveRecord $model) { |
|
451 | + $initialModels = ArrayHelper::index($this->_oldRelationValue[$relationName], function(BaseActiveRecord $model) { |
|
452 | 452 | return implode("-", $model->getPrimaryKey(true)); |
453 | 453 | }); |
454 | 454 | $initialRelations = $model->{$relationName}; |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | // Added relations |
459 | 459 | $actualModels = ArrayHelper::index( |
460 | 460 | $junctionTablePropertiesUsed ? $initialRelations : $model->{$relationName}, |
461 | - function (BaseActiveRecord $model) { |
|
461 | + function(BaseActiveRecord $model) { |
|
462 | 462 | return implode("-", $model->getPrimaryKey(true)); |
463 | 463 | } |
464 | 464 | ); |
@@ -486,7 +486,7 @@ discard block |
||
486 | 486 | } |
487 | 487 | } |
488 | 488 | } catch (Exception $e) { |
489 | - Yii::warning(get_class($e) . " was thrown while saving related records during afterSave event: " . $e->getMessage(), __METHOD__); |
|
489 | + Yii::warning(get_class($e)." was thrown while saving related records during afterSave event: ".$e->getMessage(), __METHOD__); |
|
490 | 490 | $this->_rollback(); |
491 | 491 | /*** |
492 | 492 | * Sadly mandatory because the error occurred during afterSave event |
@@ -519,7 +519,7 @@ discard block |
||
519 | 519 | } |
520 | 520 | if (!is_array($junctionTableColumns)) { |
521 | 521 | throw new RuntimeException( |
522 | - 'Junction table columns definition must return an array, got ' . gettype($junctionTableColumns) |
|
522 | + 'Junction table columns definition must return an array, got '.gettype($junctionTableColumns) |
|
523 | 523 | ); |
524 | 524 | } |
525 | 525 | } |
@@ -538,10 +538,10 @@ discard block |
||
538 | 538 | private function _computePkDiff($initialRelations, $updatedRelations, $forceSave = false) |
539 | 539 | { |
540 | 540 | // Compute differences between initial relations and the current ones |
541 | - $oldPks = ArrayHelper::getColumn($initialRelations, function (BaseActiveRecord $model) { |
|
541 | + $oldPks = ArrayHelper::getColumn($initialRelations, function(BaseActiveRecord $model) { |
|
542 | 542 | return implode("-", $model->getPrimaryKey(true)); |
543 | 543 | }); |
544 | - $newPks = ArrayHelper::getColumn($updatedRelations, function (BaseActiveRecord $model) { |
|
544 | + $newPks = ArrayHelper::getColumn($updatedRelations, function(BaseActiveRecord $model) { |
|
545 | 545 | return implode("-", $model->getPrimaryKey(true)); |
546 | 546 | }); |
547 | 547 | if ($forceSave) { |