2.17.0 Undefined array key in IdentifierFlattener #7264

Open
opened 2026-01-22 15:48:31 +01:00 by admin · 2 comments
Owner

Originally created by @ppaulis on GitHub (Nov 29, 2023).

Bug Report

Q A
BC Break no
Version 2.17.0

Summary

When upgrading from 2.16.3 to 2.17.0, I get the following error when calling findAll() on the EntityRepository :

Warning: Undefined array key "id" in vendor/doctrine/orm/lib/Doctrine/ORM/Utility/IdentifierFlattener.php line 80

I'm using the Doctrine in combination with Laminas API Tools, through the Doctrine ORM Module 5.3.0.

It seems that the array on line 80 is empty :

} else {
    if ($id[$field] instanceof BackedEnum) {  // <=============== array $id is empty
        $flatId[$field] = $id[$field]->value;
    } else {
        $flatId[$field] = $id[$field];
    }
}

Current behavior

EntityRepository::findAll() triggers a warning

How to reproduce

$entityRepository->findAll()

Expected behavior

I would have expected findAll() not to trigger this warning. If there is simply an array_key_exists() call missing, I can gladly submit a PR for this. But perhaps I'm missing something here. Any hint is appreciated!

Thanks,
Pascal

Originally created by @ppaulis on GitHub (Nov 29, 2023). ### Bug Report | Q | A |------------ | ------ | BC Break | no | Version | 2.17.0 #### Summary When upgrading from 2.16.3 to 2.17.0, I get the following error when calling `findAll()` on the `EntityRepository` : ``` Warning: Undefined array key "id" in vendor/doctrine/orm/lib/Doctrine/ORM/Utility/IdentifierFlattener.php line 80 ``` I'm using the Doctrine in combination with Laminas API Tools, through the Doctrine ORM Module `5.3.0`. It seems that the array on line 80 is empty : ``` } else { if ($id[$field] instanceof BackedEnum) { // <=============== array $id is empty $flatId[$field] = $id[$field]->value; } else { $flatId[$field] = $id[$field]; } } ``` #### Current behavior `EntityRepository::findAll()` triggers a warning #### How to reproduce ``` $entityRepository->findAll() ``` #### Expected behavior I would have expected `findAll()` not to trigger this warning. If there is simply an `array_key_exists()` call missing, I can gladly submit a PR for this. But perhaps I'm missing something here. Any hint is appreciated! Thanks, Pascal
Author
Owner

@dbannik commented on GitHub (Nov 29, 2023):

Look at this problem https://github.com/doctrine/orm/issues/11091, this can happen when featch=EAGER

@dbannik commented on GitHub (Nov 29, 2023): Look at this problem https://github.com/doctrine/orm/issues/11091, this can happen when **featch=EAGER**
Author
Owner

@ppaulis commented on GitHub (Nov 30, 2023):

Look at this problem #11091, this can happen when featch=EAGER

@dbannik nice, thank you :-) you already did a lot of digging there 👍

@ppaulis commented on GitHub (Nov 30, 2023): > Look at this problem #11091, this can happen when **featch=EAGER** @dbannik nice, thank you :-) you already did a lot of digging there :+1:
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#7264