Skip to content

[5.x] Support dotted keys in data get #11848

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

Closed

Conversation

edalzell
Copy link
Contributor

@edalzell edalzell commented Jun 5, 2025

Would be nice to be able to $entry->get('parent.child')

@edalzell edalzell requested a review from duncanmcclean June 5, 2025 21:25
@jesseleite
Copy link
Member

Maybe $entry->set() can handle dot notation too? ❤️

@edalzell
Copy link
Contributor Author

edalzell commented Jun 6, 2025

Maybe $entry->set() can handle dot notation too? ❤️

Not really cuz $this->data is a collection not an array so dotted keys don't work. If someone needs it we can figure it out then.

Copy link
Member

@duncanmcclean duncanmcclean left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're going to add dot notation support in ->get(), I think we need to add it across the other methods in ContainsData too.

Otherwise, it might be confusing if you can do this...

$entry->get('venue.address');

But you can't do this:

$entry->has('venue.capacity');
$entry->increment('venue.capacity');
$entry->set('venue.address', '123 Test Lane');
$entry->modify('venue.address', function ($address) {
    //
});
$entry->remove('venue.capacity');

@edalzell
Copy link
Contributor Author

edalzell commented Jun 6, 2025

Not worth the effort

@edalzell edalzell closed this Jun 6, 2025
@edalzell edalzell deleted the feature/support-dotted-keys-for-data-get branch June 6, 2025 13:27
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