Completed
Push — dev ( cf5568...6a90d3 )
by James Ekow Abaka
01:49
created
src/relationships/HasManyRelationship.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -39,13 +39,13 @@  discard block
 block discarded – undo
39 39
     {
40 40
         // @todo throw an exception when the data doesn't have the local key
41 41
         $query = $this->createQuery();
42
-        if(!$this->queryPrepared) {
42
+        if (!$this->queryPrepared) {
43 43
             $query->setTable($this->getModelInstance()->getDBStoreInformation()['quoted_table'])
44 44
                 ->addFilter($this->options['foreign_key'], $data[$this->options['local_key']] ?? null);
45 45
             $this->queryPrepared = true;
46 46
             return $query;
47 47
         }
48
-        if(isset($data[$this->options['local_key']])) {
48
+        if (isset($data[$this->options['local_key']])) {
49 49
             $query->setBoundData($this->options['foreign_key'], $data[$this->options['local_key']]);
50 50
         }
51 51
         return $query;
@@ -70,11 +70,11 @@  discard block
 block discarded – undo
70 70
     public function postSave(&$wrapper)
71 71
     {
72 72
         $records = $this->tempData->getData();
73
-        foreach($records as $i => $relatedRecord) {
73
+        foreach ($records as $i => $relatedRecord) {
74 74
             $records[$i][$this->options['foreign_key']] = $wrapper[$this->options['local_key']];
75 75
         }
76 76
         $this->tempData->setData($records);
77
-        if(!$this->tempData->save()) {
77
+        if (!$this->tempData->save()) {
78 78
             $this->invalidFields = $this->tempData->getInvalidFields();
79 79
         }
80 80
         $wrapper[$this->options['model']] = $this->tempData;
Please login to merge, or discard this patch.
src/RecordWrapper.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
         $this->initialize();
212 212
 
213 213
         return $this->context->getCache()->read(
214
-            "{$this->className}::desc", function () {
214
+            "{$this->className}::desc", function() {
215 215
                 return $this->context->getModelDescription($this);
216 216
             }
217 217
         );
@@ -449,13 +449,13 @@  discard block
 block discarded – undo
449 449
             return null;
450 450
         }        
451 451
         $name = $relationship->getOptions()['name'];
452
-        if(isset($data[$name]))
452
+        if (isset($data[$name]))
453 453
         {
454 454
             return $data[$name];
455 455
         }
456 456
         $query = $relationship->prepareQuery($data);
457 457
 
458
-        if($query) {
458
+        if ($query) {
459 459
             $model = $relationship->getModelInstance();
460 460
             return $model->fetch($query);
461 461
         } else {
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
         $expandableModels = empty($expandableModels) ? array_keys($relationships) : $expandableModels;
553 553
         foreach ($expandableModels as $name) {
554 554
             $value = $this->fetchRelatedFields($relationships[$name], $index);
555
-            if($value) {
555
+            if ($value) {
556 556
                 $array[$name] = $value->toArray($depth, $expandableModels);
557 557
             }
558 558
         }
Please login to merge, or discard this patch.