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

feat/add-re-mapping-support #23

Merged
merged 4 commits into from
Oct 21, 2024
Merged

Conversation

zero-to-prod
Copy link
Owner

Description

Map a key to a property of a different name like this:

use Zerotoprod\DataModel\Describe;

class User
{
    use \Zerotoprod\DataModel\DataModel;

    #[Describe(['from' => 'firstName'])]
    public string $first_name;
}

$User = User::from([
    'firstName' => 'John',
]);

echo $User->first_name; // John

@zero-to-prod zero-to-prod self-assigned this Oct 21, 2024
@zero-to-prod zero-to-prod added the enhancement New feature or request label Oct 21, 2024
@zero-to-prod zero-to-prod merged commit 9bcd5bc into main Oct 21, 2024
3 checks passed
@zero-to-prod zero-to-prod deleted the feat/add-re-mapping-support branch October 21, 2024 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant