EH doesnt work with Drupal 11.4 since DB classes are typehinted; new workflow doesnt work
Entity Hierarchy does not work with Drupal 11.4 because it has a call to fetchAll with a class name for the column. `\Drupal\entity_hierarchy\Storage\QueryBuilder::findAncestors` calls `$result->fetchAll($column_index)` with a class name. In Drupal 11, since https://www.drupal.org/project/drupal/issues/3522561, you can only call the parameter with `int|null`, class name or string is disallowed. Furthermore, when you go the long way via `\Drupal\Core\Database\StatementInterface::setFetchMode`, Drupal fails to use the class because it does not unset the internal column value. So Drupal tries to filter on `0` (zero). Since `\Drupal\Core\Database\Statement\StatementBase::$fetchOptions`'s `column` key is never unset. When `\Drupal\Core\Database\Statement\PdoResult::fetchAll` is called internally, its unable to use the class set by `setFetchMode` since `column` key is still set. A fix to the new `setFetchMode` is being devised in the core issue @ https://www.drupal.org/project/drupal/issues/3552669. As far as I can tell the ability to set `\Drupal\Core\Database\StatementInterface::fetchAll($column_index)` to a class name is accidental. It just happened to work, an we lost some functionality with the recent type-hinting. --- Old code: ```php $records = $result->fetchAll(\PDO::FETCH_CLASS, Record::class, [$type]); ``` New workaround code: ```php $result->setFetchMode(FetchAs::ClassObject, Record::class, [$type]); $records = iterator_to_array($result); ```
issue