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