Skip to content

Commit 67bd04e

Browse files
committed
Merge pull request #55 from api-platform/fix_tests
Fix tests and #36
2 parents 1bbfc75 + 1567edd commit 67bd04e

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/TypesGenerator.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,12 @@ public function generate($config)
201201
$class['parent'] = $numberOfSupertypes ? $type->all('rdfs:subClassOf')[0]->localName() : false;
202202
}
203203

204-
if (null !== $class['parent']) {
205-
$class['uses'][] = sprintf('%s\\%s', $config['types']['Thing']['namespaces']['class'], $class['parent']);
204+
if (isset($class['parent']) && isset($config['types'][$class['parent']]['namespaces']['class'])) {
205+
$parentNamespace = $config['types'][$class['parent']]['namespaces']['class'];
206+
207+
if ($parentNamespace !== $class['namespace']) {
208+
$class['uses'][] = $parentNamespace.'\\'.$class['parent'];
209+
}
206210
}
207211

208212
// Embeddable

tests/TypesGeneratorTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ public function testGenerate()
4545

4646
$typesGenerator = new TypesGenerator($twig, $logger, $graphs, $cardinalitiesExtractor, $goodRelationsBridge);
4747

48-
$config = $this->getConfig();
49-
$typesGenerator->generate($config);
48+
$typesGenerator->generate($this->getConfig());
5049
}
5150

5251
private function getGraphs()

0 commit comments

Comments
 (0)