Skip to content

Commit 28088e7

Browse files
committed
Revert stupid code on form population
1 parent a0dd709 commit 28088e7

File tree

2 files changed

+2
-13
lines changed

2 files changed

+2
-13
lines changed

src/Form/SharpForm.php

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -223,18 +223,7 @@ public function __construct($attributes)
223223
$this->attributes = $attributes;
224224

225225
foreach($attributes as $name => $value) {
226-
if(strpos($name, ':')) {
227-
list($subModel, $attr) = explode(':', $name);
228-
229-
if(!isset($this->$subModel)) {
230-
$this->$subModel = new \stdClass();
231-
}
232-
233-
$this->$subModel->$attr = $value;
234-
235-
} else {
236-
$this->$name = $value;
237-
}
226+
$this->$name = $value;
238227
}
239228
}
240229
public function toArray()

src/Utils/Transformers/WithCustomTransformers.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ protected function handleAutoRelatedAttributes($attributes, $model)
177177
})->each(function ($key) use (&$attributes, $model) {
178178
// For each one, we create a "relation:attribute" key
179179
// in the returned array
180-
$attributes[$key[0]] = $model->{$key[1]} ? ($model->{$key[1]}->{$key[2]} ?? null) : null;
180+
$attributes[$key[0]] = $model->{$key[1]}->{$key[2]} ?? null;
181181
});
182182

183183
return $attributes;

0 commit comments

Comments
 (0)