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

[5.x] Fix querying the status log #962

Merged
merged 2 commits into from
Jan 2, 2024
Merged

Conversation

duncanmcclean
Copy link
Owner

@duncanmcclean duncanmcclean commented Jan 2, 2024

This pull request fixes an issue where the Status Log field couldn't be queried due to the new format introduced in #956.

After the changes in #956, querying the status log would result in nothing being returned because stuff was being returned in a different format than previously.

// Used to work but doesn't after #956

Entry::query()
    ->where('collection', 'orders')
    ->whereDate('status_log->paid', '>=', '2024-01-01');

This PR essentially maps the new format into what was being returned first - where it's a key/value array with the status and timestamp. This allows for this:

If you have the same status repeated multiple times in your "status log", the latest event of that status will be the one used for querying.

@duncanmcclean duncanmcclean merged commit ac48cf4 into 5.x Jan 2, 2024
9 checks passed
@duncanmcclean duncanmcclean deleted the fix/status-log-queryable-value branch January 2, 2024 20:35
Copy link

Released as part of v5.9.1.

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.

1 participant