entityManager = $em; } /** * @throws NoMappingFound */ public function createSchema(): Schema { $metadata = $this->entityManager->getMetadataFactory()->getAllMetadata(); if (count($metadata) === 0) { throw NoMappingFound::new(); } usort($metadata, static function (ClassMetadata $a, ClassMetadata $b): int { return $a->getTableName() <=> $b->getTableName(); }); $tool = new SchemaTool($this->entityManager); return $tool->getSchemaFromMetadata($metadata); } }