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

[SearchKit] Do not crash on entities without fields #26045

Merged
merged 1 commit into from
Apr 11, 2023

Conversation

jensschuppe
Copy link
Contributor

Overview

The SearchKit admin interface crashes when there are entities without fields (e.g. custom API entities not derived from DAOs).

Before

A custom API entity without any fields causes the SearchKit admin interface to crash with TypeError: array_reverse(): Argument #1 ($array) must be of type array, null given in array_reverse().

After

Entites without fields just don't have fields in SearchKit, no crashing.

Technical Details

There's an assumption that empty attributes for entities should not be part of the schema at all in \Civi\Search\Admin::getSchema(), but SearchKit relies on the attribute fields being there in \Civi\Search\Admin::addImplicitFKFields().

@civibot
Copy link

civibot bot commented Apr 11, 2023

(Standard links)

@civibot civibot bot added the master label Apr 11, 2023
@colemanw colemanw merged commit 553672c into civicrm:master Apr 11, 2023
@jensschuppe jensschuppe deleted the searchKitNoFields branch July 10, 2024 09:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants