-
-
Notifications
You must be signed in to change notification settings - Fork 515
Change namespace of attribute classes from Annotations to Attribute
#2933
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: 2.16.x
Are you sure you want to change the base?
Conversation
|
This will force users to migrate without offering anything in return, except for consistency in the namespace with other projects (and not yet ORM). |
|
In fact, ORM don't have this subnamespace (example: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR modernizes the MongoDB ODM library's attribute system by moving attribute classes from the Annotations namespace to the new Attribute namespace. The old Annotations namespace is maintained as a deprecated alias to ensure backward compatibility while guiding users toward the new naming convention.
Key Changes:
- Introduced new
Doctrine\ODM\MongoDB\Mapping\Attributenamespace for all attribute classes - Added deprecation triggers when old
Annotationsnamespace classes are loaded - Updated all test files and internal references to use the new namespace
- Maintained backward compatibility through class aliases
Reviewed changes
Copilot reviewed 300 out of 434 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
src/Mapping/Attribute/*.php |
New attribute classes in the Attribute namespace with class aliases to Annotations namespace for backward compatibility |
src/Mapping/Annotations/*.php |
Converted to deprecation stubs that trigger warnings and load the new Attribute classes |
tests/**/*.php |
Updated import statements from Annotations to Attribute namespace |
src/Mapping/Driver/*.php |
Updated internal references to use new Attribute namespace |
src/Mapping/ClassMetadata.php |
Updated type hints to reference Attribute namespace |
UPGRADE-2.16.md |
Added migration guide for the namespace change |
phpstan-baseline.neon |
Updated static analysis baseline with new namespace references |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
71eff05 to
5e39484
Compare
malarzm
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't quite grasp it, but there's a "class_alias was problematic in the past" dangling in my head. Saying it out loud in case I'd jog somebody's memory with it. Alernative would be to:
- Move classes to Attributes (and drop final, leave it as a phpdoc)
- Classes in Annotations would extend their counterpart, emit a deprecation in ctor and forward everything
- Remove Annotations/* in 3.0 and bring back
finalin Attribute/*
Also I'd like to see docs updated for 2.16 - folks copying documentation should not be greeted by a deprecation :)
@malarzm I wrote an article about that, and @alcaeus wrote a medium article about the aftermath of doing this for |
|
@greg0ire ha! Thanks for the links, I tried to look in our blog and google but prolly I was too specific with "orm namespace change" :) |
5e39484 to
4ae6e4d
Compare
Summary
Doctrine\ODM\MongoDB\Mapping\AnnotationstoDoctrine\ODM\MongoDB\Mapping\AttributeAnnotationsnamespace is loaded using the autoloader.