Skip to content
Merged
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
9 changes: 8 additions & 1 deletion src/Doctrine/DoctrineHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,14 @@ public function doesClassUseDriver(string $className, string $driverClass): bool
// if the class should be generated with attributes or annotations. If this exception is thrown, we will check based on the
// namespaces for the given $className and compare it with the doctrine configuration to get the correct MappingDriver.

return $this->isInstanceOf($this->getMappingDriverForNamespace($className), $driverClass);
// extract the new class's namespace from the full $className to check the namespace of the new class against the doctrine configuration.
$classNameComponents = explode('\\', $className);
if (1 < \count($classNameComponents)) {
array_pop($classNameComponents);
}
$classNamespace = implode('\\', $classNameComponents);
Copy link
Member

Choose a reason for hiding this comment

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

Could you add a comment about which situation this is addressing? A test would be ideal, though I don't know how easy that would be to add.

Thanks!


return $this->isInstanceOf($this->getMappingDriverForNamespace($classNamespace), $driverClass);
}

if (null === $em) {
Expand Down