-
-
Notifications
You must be signed in to change notification settings - Fork 61
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
Prepended backslash in class name reloads the full metadata from scratch #300
Comments
Another alternative would be to assign the metadata to the alias, but as a PHP reference rather than a copy. |
Well I think that's already the case because it's an EntityMetaData instance being copied So I think it's just a question of trimming this slash in getRealClass, so that it's treated as an alias instead of reloaded from scratch |
Normalization seems more like the way to go yes. If I understood correctly, all this is caused because |
Also, be careful when talking about aliases because in |
@greg0ire Yes exactly that I think just this should cover it public function resolveClassName(string $className): string
{
$className = ltrim($className, '\\');
\\...
Yes sorry I used alias as in class_alias, but that's not really what I'm trying to depict either, so let's completely forget about aliases as they're not relevant to this, it's 100% a FQCN with multiple possible representation issue |
Would it? I think that wouldn't be enough to take advantage of this cache here: persistence/src/Persistence/Mapping/AbstractClassMetadataFactory.php Lines 164 to 166 in 25ec98a
If you call |
It would take advantage of the cache on line 180 just a bit after, otherwise we can ltrim straight away Do you know any other places where class names would be used as keys? |
That would make a lot more sense to me.
That normalization should also happen in |
Co-authored-by: Grégoire Paris <postmaster@greg0ire.fr>
Co-authored-by: Grégoire Paris <postmaster@greg0ire.fr>
Co-authored-by: Grégoire Paris <postmaster@greg0ire.fr>
Co-authored-by: Grégoire Paris <postmaster@greg0ire.fr>
fix: Normalize class names doctrine#300 (doctrine#301) Author: Adrien Foulon Co-authored-by: Grégoire Paris <postmaster@greg0ire.fr>
Co-authored-by: Grégoire Paris <postmaster@greg0ire.fr>
Co-authored-by: Grégoire Paris <postmaster@greg0ire.fr>
fix: Normalize class names doctrine#300 (doctrine#301) Author: Adrien Foulon Co-authored-by: Adrien Foulon Co-authored-by: Grégoire Paris <postmaster@greg0ire.fr>
Bug Report
Follow up of symfony/symfony#46837
Summary
When extracting class metadata, doctrine copies the original class data and caches it only the first time
But following that copy, calls to
addEntityListener
are made which are not repercuted on the aliaspersistence/src/Persistence/Mapping/AbstractClassMetadataFactory.php
Line 180 in 25ec98a
Solution
The alias should not be copied, but should just be added to an alias map to retrieve the original cached class straight awayThe text was updated successfully, but these errors were encountered: