Skip to content

Commit 1c8b231

Browse files
committed
Ensure all morphable properties are provided
1 parent 07e042d commit 1c8b231

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Resolvers/DataFromSomethingResolver.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,15 @@ protected function dataFromArray(
128128
$dataClass = $this->dataConfig->getDataClass($class);
129129

130130
if ($dataClass->isAbstract && $dataClass->propertyMorphable) {
131+
$morphableProperties = Arr::only($properties, $dataClass->propertyMorphablePropertyNames);
132+
131133
/**
132134
* @var class-string<PropertyMorphableData> $class
133135
*/
134-
if ($morph = $class::morph(Arr::only($properties, $dataClass->propertyMorphablePropertyNames))) {
136+
if (
137+
count($morphableProperties) === count($dataClass->propertyMorphablePropertyNames)
138+
&& $morph = $class::morph($morphableProperties)
139+
) {
135140
return $this->execute($morph, $creationContext, ...$payloads);
136141
}
137142
}

0 commit comments

Comments
 (0)