Skip to content

Commit 632ca7c

Browse files
committed
Add limited allOf support
1 parent 9c30903 commit 632ca7c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/Generator/Schema.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,12 @@ public static function generate(string $name, string $namespace, string $classNa
123123
$method->setReturnType( $fqcnn);
124124
$propertyDocBlock[] = '@\WyriHaximus\Hydrator\Attribute\Hydrate(' . $fqcnn . '::class)';
125125
$setDefaylt = false;
126+
} else if (is_array($property->allOf) && $property->allOf[0] instanceof OpenAPiSchema && array_key_exists(spl_object_hash($property->allOf[0]), $schemaClassNameMap)) {
127+
$fqcnn = '\\' . $rootNamespace . '\\' . $schemaClassNameMap[spl_object_hash($property->allOf[0])];
128+
$propertyStmt->setType( $fqcnn);
129+
$method->setReturnType( $fqcnn);
130+
$propertyDocBlock[] = '@\WyriHaximus\Hydrator\Attribute\Hydrate(' . $fqcnn . '::class)';
131+
$setDefaylt = false;
126132
}
127133

128134
if ($property->type === 'object' && $property instanceof OpenAPiSchema && array_key_exists(spl_object_hash($property), $schemaClassNameMap)) {

0 commit comments

Comments
 (0)