Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/lib/Gateway/DoctrineSchemaMetadataRegistry.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,16 @@ private function ensureInitialized(): void
$metadata = $gateway->getMetadata();

$tableName = $metadata->getTableName();
if (isset($this->tableToMetadata[$tableName])) {
if (isset($this->tableToMetadata[$tableName]) && $this->tableToMetadata[$tableName] != $metadata) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To put it simply, if two metadata services exist for the same table (even if they have the exact same properties), that is an error and shall not be ignored :)

The error should be found and removed, not silently ignored.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Steveb-p so we need to fix it in https://github.com/ibexa/product-catalog/ somehow ? Should i close this PR ?

throw new LogicException(sprintf(
'Unable to register table schema metadata for "%s" table. Schema metadata is already registered.',
$tableName,
));
}
$this->tableToMetadata[$tableName] = $metadata;

if (!isset($this->tableToMetadata[$tableName])) {
$this->tableToMetadata[$tableName] = $metadata;
}

$className = $metadata->getClassName();
if ($className === null) {
Expand Down
Loading