-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Fix ClassMetadata::fullyQualifiedClassName #11925
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 4.0.x
Are you sure you want to change the base?
Conversation
Fix for cases like as: entity class in namespace X, listener class in global namespace and defined as ::class constant (`#[\Doctrine\ORM\Mapping\EntityListeners([\ProductImageFile::class])]`) In this case PHP convert class name to `ProductImageFile` in argument.
This should come with a test, and shouldn't break existing tests |
it's not possible, I can only update existed tests |
@greg0ire tests extended and fixed |
On top of this, you should create an entirely new test function showcasing the use case you described in your PR description. It might help me understand what this is all about (I must admit it's not entirely clear right now). |
I post full case here: <?php
namespace Entities;
#[\Doctrine\ORM\Mapping\Entity]
#[\Doctrine\ORM\Mapping\Table(name: 'product_images')]
#[\Doctrine\ORM\Mapping\EntityListeners([\ProductImageFile::class])]
class ProductImage
{
...
} <?php
class ProductImageFile
{
...
#[\Doctrine\ORM\Mapping\PostRemove]
public function onRemoveEntity(\Entities\ProductImage $productImage): void
{
$this->deleteFile($productImage);
}
} When PHP create instance of |
…paceToClassInGlobalNamespace()
@greg0ire PR updated. I don't think it's BC, because not existed class couldn't be created later. |
If you don't think it's a breaking change, then why are you targeting 4.0.x? |
You should probably create a functional test case of that. |
It's not critical problem, but I want to fix it in future versions
It's hard to reproduce in test - I still learn Doctrine. |
Fix for cases like as:
entity class in namespace X, listener class in global namespace and passed as ::class constant (
#[\Doctrine\ORM\Mapping\EntityListeners([\ProductImageFile::class])]
). In this case PHP convert class name toProductImageFile
when pass toEntityListeners::__construct()
.