Fix search scope when performing fallback mapping driver detection #48097
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When using
auto_mapping
insideorm
configuration to enable automatic entity registration for all bundles that are used within your application, the fallback mechanism for determining which mapping driver should be used for extracting entity information has a wrong starting point.Instead of beginning its search from the
Entity
folder, the entire bundle root gets traversed recursively, which can lead to wrong mapping driver being selected or just plainly having a performance hit during development just because the potential list of files that need to be examined can get huge.We actually stumbled upon this bug because we noticed a big jump in memory usage during development (
850+ MB vs ~100 MB
) ever since we switched to using attributes for describing our entities. Turns out, theDoctrineBridge
was scanning all files inside ourResources
folder (and we had a lot of files in there).