Skip to content
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

Should we add support for property hooks in the package denormalization feature. #541

Open
nyamsprod opened this issue Oct 18, 2024 · 2 comments

Comments

@nyamsprod
Copy link
Member

nyamsprod commented Oct 18, 2024

Feature Request

Q A
New Feature yes
BC Break yes

Issue

class UserIdentity
{ 
    public function __construct(
        private string $firstName,
        private string $lastName
    ) {
    }
 
    public string $fullName {
        get => $this->firstName . " " . $this->lastName;
        set {
            [$this->firstName, $this->lastName] = explode(' ', $value, 2);
        }
    }
}
  • How should the deserialization feature works with this class ?
@nyamsprod
Copy link
Member Author

Should the Deserialization feature of the package even try to work correctly with a class containing property hook ?

The current Deserialization mechanism is geared toward simple DTO. The moment you add Property hooks or any advanced feature in PHP to your class you are better of using a fully fledge Serializer package and there are many of them in PHP land. So should Property hook even be supported by the feature ?

@nyamsprod nyamsprod changed the title Adding support for property hooks in the package denormalization feature. Should we add support for property hooks in the package denormalization feature. Oct 18, 2024
@shadowhand
Copy link
Member

shadowhand commented Oct 19, 2024

@nyamsprod in my opinion, this package should not try to support advanced deserialization. As you said, there are many other packages available for those use cases. I appreciate how pure this package is and don't want to see it overlap with others.

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

No branches or pull requests

2 participants