Skip to content
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

Cant use an entity with ReferenceRepository if its name ends with Proxy #417

Closed
mdevlamynck opened this issue Jan 5, 2023 · 6 comments · Fixed by #421
Closed

Cant use an entity with ReferenceRepository if its name ends with Proxy #417

mdevlamynck opened this issue Jan 5, 2023 · 6 comments · Fixed by #421

Comments

@mdevlamynck
Copy link

Since v1.6.0 our tests fail when loading fixtures for entities with a Proxy suffix in their name.

For example with the entity Path\To\Entities\EntityProxy we get a Doctrine\Persistence\Mapping\MappingException: Class 'Path\To\Entities\Entity' does not exist error.

I think the bug was introduced in #409. The getRealClass removes the Proxy suffix. Maybe the check to remove the suffix Proxy could be made more specific to actual proxies?

@greg0ire
Copy link
Member

greg0ire commented Jan 5, 2023

Cc @VincentLanglet

@VincentLanglet
Copy link
Contributor

Maybe the custom getRealClass implementation should be replaced by Doctrine\Common\Util\ClassUtils::getRealClass()

@mdevlamynck
Copy link
Author

I just tried it indeed fixes the issue. I'll make a PR, thx :)

@greg0ire
Copy link
Member

greg0ire commented Jan 5, 2023

This library does not have a dependency on doctrine/common, and I don't think we want to introduce one (we're trying to get rid of doctrine/common entirely).

@mdevlamynck
Copy link
Author

You prefer simply copying the code of ClassUtils::getRealClass() in this project?

@greg0ire
Copy link
Member

greg0ire commented Jan 5, 2023

I guess

mdevlamynck added a commit to mdevlamynck/data-fixtures that referenced this issue Jan 5, 2023
Fixes doctrine#417.

This fixes ReferenceRepository::getRealClass() to match with the
behaviour of the equiavlent function in doctrine\common
ClassUtils::getRealClass().
mdevlamynck added a commit to mdevlamynck/data-fixtures that referenced this issue Jan 5, 2023
Fixes doctrine#417.

This fixes ReferenceRepository::getRealClass() to match with the
behaviour of the equiavlent function in doctrine\common
ClassUtils::getRealClass().
mdevlamynck added a commit to mdevlamynck/data-fixtures that referenced this issue Jan 5, 2023
Fixes doctrine#417.

This fixes ReferenceRepository::getRealClass() to match with the
behaviour of the equiavlent function in doctrine\common
ClassUtils::getRealClass().
mdevlamynck added a commit to mdevlamynck/data-fixtures that referenced this issue Jan 5, 2023
Fixes doctrine#417.

This fixes ReferenceRepository::getRealClass() to match with the
behaviour of the equiavlent function in doctrine\common
ClassUtils::getRealClass().
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants