diff --git a/src/Metadata/ClassHierarchy.php b/src/Metadata/ClassHierarchy.php
new file mode 100644
index 0000000000000000000000000000000000000000..743cb650147634d1b50943e7e61baa0dad868555
--- /dev/null
+++ b/src/Metadata/ClassHierarchy.php
@@ -0,0 +1,42 @@
+<?php declare(strict_types=1);
+/*
+ * irstea/ng-model-generator-bundle generates Typescript interfaces for Angular using api-platform metadata.
+ * Copyright (C) 2018 IRSTEA
+ *
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation, either version 3 of the License, or (at your option) any
+ * later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License and the GNU
+ * Lesser General Public License along with this program. If not, see
+ * <https://www.gnu.org/licenses/>.
+ */
+
+namespace Irstea\NgModelGeneratorBundle\Metadata;
+
+use Irstea\NgModelGeneratorBundle\Models\PHPClass;
+
+/**
+ * Interface ClassHierarchy.
+ */
+interface ClassHierarchy
+{
+    /**
+     * @param PHPClass $class
+     *
+     * @return PHPClass|null
+     */
+    public function getParent(PHPClass $class): ?PHPClass;
+
+    /**
+     * @param PHPClass $class
+     *
+     * @return PHPClass[]
+     */
+    public function getChildren(PHPClass $class): array;
+}
diff --git a/src/Metadata/DefaultClassHierarchy.php b/src/Metadata/DefaultClassHierarchy.php
new file mode 100644
index 0000000000000000000000000000000000000000..c15e883f1a2f2945b97d30991cf6524625ac0486
--- /dev/null
+++ b/src/Metadata/DefaultClassHierarchy.php
@@ -0,0 +1,80 @@
+<?php declare(strict_types=1);
+/*
+ * irstea/ng-model-generator-bundle generates Typescript interfaces for Angular using api-platform metadata.
+ * Copyright (C) 2018 IRSTEA
+ *
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation, either version 3 of the License, or (at your option) any
+ * later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License and the GNU
+ * Lesser General Public License along with this program. If not, see
+ * <https://www.gnu.org/licenses/>.
+ */
+
+namespace Irstea\NgModelGeneratorBundle\Metadata;
+
+use Irstea\NgModelGeneratorBundle\Models\PHPClass;
+
+/**
+ * Class DefaultClassHierarchy.
+ */
+final class DefaultClassHierarchy implements ClassHierarchy
+{
+    /** @var PHPClass[] */
+    private $parents = [];
+
+    /** @var PHPClass[][] */
+    private $children = [];
+
+    /**
+     * @param PHPClass[] $classes
+     */
+    public function preload(PHPClass $class): void
+    {
+        $className = $class->getFullName();
+        if (\array_key_exists($className, $this->parents)) {
+            return;
+        }
+
+        $parent = $class->getReflection()->getParentClass();
+        if (!$parent) {
+            $this->parents[$className] = null;
+
+            return;
+        }
+        $parentClassName = $parent->getName();
+
+        $this->parents[$className] = PHPClass::get($parentClassName);
+
+        if (!isset($this->children[$parentClassName])) {
+            $this->children[$parentClassName] = [];
+        }
+        $this->children[$parentClassName][$className] = $class;
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function getParent(PHPClass $class): ?PHPClass
+    {
+        $this->preload($class);
+
+        return $this->parents[$class->getFullName()] ?? null;
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function getChildren(PHPClass $class): array
+    {
+        $this->preload($class);
+
+        return $this->children[$class->getFullName()] ?? [];
+    }
+}