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

DatabaseQueryProcessor with returnFlattenObject=1 Does Not Return null When No Entries Are Found #797

Open
KrohnMi opened this issue Nov 21, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@KrohnMi
Copy link
Contributor

KrohnMi commented Nov 21, 2024

Describe the bug
When using the DatabaseQueryProcessor with the option returnFlattenObject=1, the processor returns a flatten object (e.g., an empty array) instead of null when no entries are found. This behavior is inconsistent with expectations, as returning null would make it clear that no results exist.

This issue impacts use cases where the absence of entries needs to be explicitly detected, and the current behavior introduces ambiguity.

To Reproduce
Steps to reproduce the behavior:

  1. Configure a DatabaseQueryProcessor in TypoScript with the option returnFlattenObject=1.
  2. Query a database table with conditions that result in no matching entries.
  3. Observe the output.
lib.queryExample = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
lib.queryExample {
    table = your_table
    pidInList = 1
    where = some_field = 'non_existing_value'
    returnFlattenObject = 1
}

Expected behavior
null is returned when no entries match the query.

Actual behavior
An empty object/array is returned.

TYPO3 version and TYPO3 Headless version
Typo3: 12.4.23
Headless: 4.5.

@KrohnMi KrohnMi added the bug Something isn't working label Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant