-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
added casts #7607
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: master
Are you sure you want to change the base?
added casts #7607
Conversation
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 introduces three new casting classes for the Hyperf database model layer, providing enhanced attribute casting functionality for models.
Key Changes:
- Adds a
Jsonclass with customizable JSON encoding/decoding capabilities - Adds an
Attributeclass for defining custom attribute accessors and mutators with caching options - Adds an
AsCollectionclass for casting JSON attributes to Collection instances with optional item mapping
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| src/database/src/Model/Casts/Json.php | Provides static methods for JSON encoding/decoding with support for custom encoders/decoders |
| src/database/src/Model/Casts/Attribute.php | Implements an attribute accessor/mutator builder with fluent API and caching control |
| src/database/src/Model/Casts/AsCollection.php | Implements a Castable interface for casting JSON data to Collection instances with optional item transformation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
@huangdijia all issues resolved, do review and feel free to merge. |
1 similar comment
|
@huangdijia all issues resolved, do review and feel free to merge. |
Increase unit testing |
|
@huangdijia there's error on tests, Let's fix smarty/smarty version and i can continue |
Rebase on master |
Done, + added PHP CS fixer changes |
|
把单元测试加上,看不懂要怎么用 |
Adding casts to make it compatible with Hypervel and other frameworks