8000 added casts by adhikjoshi · Pull Request #7607 · hyperf/hyperf · GitHub
[go: up one dir, main page]

Skip to content

Conversation

@adhikjoshi
Copy link
@adhikjoshi adhikjoshi commented Nov 9, 2025

Adding casts to make it compatible with Hypervel and other frameworks

@huangdijia huangdijia requested a review from Copilot November 9, 2025 13:33
Copy link
Copilot AI left a 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 Json class with customizable JSON encoding/decoding capabilities
  • Adds an Attribute class for defining custom attribute accessors and mutators with caching options
  • Adds an AsCollection class 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.

adhikjoshi and others added 5 commits November 11, 2025 09:55
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>
@adhikjoshi
Copy link
Author

@huangdijia all issues resolved, do review and feel free to merge.

1 similar comment
@adhikjoshi
Copy link
Author

@huangdijia all issues resolved, do review and feel free to merge.

huangdijia
huangdijia previously approved these changes Nov 19, 2025
@huangdijia
Copy link
Member

@huangdijia all issues resolved, do review and feel free to merge.

Increase unit testing

@adhikjoshi
Copy link
Author

@huangdijia there's error on tests,

- Root composer.json requires smarty/smarty ^3.1, found smarty/smarty[v3.1.11, ..., v3.1.48] but these were not loaded, because they are affected by security advisories. To ignore the advisories, add ("PKSA-5rsx-p2fk-h2gr") to the audit "ignore" config. To turn the feature off entirely, you can set "block-insecure" to false in your "audit" config.

Let's fix smarty/smarty version and i can continue

@huangdijia
Copy link
Member

@huangdijia there's error on tests,

- Root composer.json requires smarty/smarty ^3.1, found smarty/smarty[v3.1.11, ..., v3.1.48] but these were not loaded, because they are affected by security advisories. To ignore the advisories, add ("PKSA-5rsx-p2fk-h2gr") to the audit "ignore" config. To turn the feature off entirely, you can set "block-insecure" to false in your "audit" config.

Let's fix smarty/smarty version and i can continue

Rebase on master

@adhikjoshi
Copy link
Author

@huangdijia there's error on tests,

- Root composer.json requires smarty/smarty ^3.1, found smarty/smarty[v3.1.11, ..., v3.1.48] but these were not loaded, because they are affected by security advisories. To ignore the advisories, add ("PKSA-5rsx-p2fk-h2gr") to the audit "ignore" config. To turn the feature off entirely, you can set "block-insecure" to false in your "audit" config.

Let's fix smarty/smarty version and i can continue

Rebase on master

Done, + added PHP CS fixer changes

@limingxinleo
Copy link
Member

把单元测试加上,看不懂要怎么用

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

0