-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[PropertyAccess] Allow custom methods on property accesses #18016
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
Closed
Closed
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
af3a824
[PropertyAccess] Allow custom methods on property accesses
lrlopez 5b82237
Added support for YAML and XML mapping
lrlopez 00a26eb
Renamed Attribute to Property on most classes and methods
lrlopez e4aaac9
Annotation renamed to @Property
lrlopez e46df98
Added method annotation for virtual properties
lrlopez 5f206e6
Renamed "attribute" to "property" in XSD and YAML
lrlopez 94e6157
Fixed the metadata caching mess
lrlopez 09707ad
Replaced metadata caching with standard PSR-6 cache pool
lrlopez d02d93a
Added support to metadata factories in PropertyAccesorBuilder
lrlopez 748b894
Fix outdated type hint in LazyLoadingMetadataFactory
lrlopez 688cbda
Fixed typo in variable name
lrlopez 003efdb
Added 'Property' prefix to method annotations
lrlopez dc5cacb
Renamed 'propertiesMetadata' to 'propertyMetadataCollection' in 'Clas…
lrlopez 1a35d45
Minor rebase fixes
lrlopez 1e29523
Addressed @xabbuh and @fabpot comments
lrlopez 7c6a79c
Make fabbot.io happy :)
lrlopez d0bd777
Fixed class name clash in FrameworkExtension
lrlopez 6b7eeff
Revert unintended change in composer.json
lrlopez File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Annotation renamed to @Property
- Loading branch information
commit e4aaac903a7bea8b30b83c509d3ddca76b9a4d9c
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
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.
This annotation duplicates the other annotations. I don't think we should add multiple ways to add the same thing:
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.
There are also some advantages of using property annotations:
Property annotations are implemented with just 19 lines of code (not taking into account the empty annotation class). In fact, all new annotations are loaded from the same method
AnnotationLoader->loadClassMetadata()
, so the code will be easy to maintain and optimize as changes would be centralized.About being harder to understand for newcomers, we could just give them some initial guidelines (i.e. method annotations for virtual properties and property annotations for everything else) and let them use whatever they want, just like the YAML vs XML vs Annotation debate.
Anyway, if you feel that only method annotations must be kept, I'll do that, of course!
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 agree with @webmozart, it's weird to have different way to do the same thing. What about having only a
@Property
annotation with an optionalname
attribute in case you use it on a method?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.
@dunglas @webmozart 👍 for having only one annotation.
@Property
looks weird on a method, maybe@Accessor
?