Skip to content

Commit 089d8b2

Browse files
committed
Add exception if the current metadata of a version is null
1 parent b2a1be5 commit 089d8b2

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Doctrine/Entity/Version.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,13 @@ public function getPackage(): ?Package
113113
return $this->package;
114114
}
115115

116-
public function getCurrentMetadata(): ?Metadata
116+
public function getCurrentMetadata(): Metadata
117117
{
118+
if (null === $this->currentMetadata) {
119+
// Packages are only allowed to have no current metadata during import
120+
throw new \RuntimeException(sprintf('No current metadata found for package: %s %s', $this->package->getName(), $this->name));
121+
}
122+
118123
return $this->currentMetadata;
119124
}
120125

0 commit comments

Comments
 (0)