Added casts AsCollection for hyperf/database.#7607
Added casts AsCollection for hyperf/database.#7607limingxinleo merged 12 commits intohyperf:masterfrom
AsCollection for hyperf/database.#7607Conversation
There was a problem hiding this comment.
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 <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
|
@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 |
|
把单元测试加上,看不懂要怎么用 |
|
any update on this? @huangdijia |
AsCollection for hyperf/database.
Adding casts to make it compatible with Hypervel and other frameworks