Problem/Motivation

I'm working at getting Scheduled Transitions going with CI's next major, which is D12/main-branch.

The one remaining test failure im seeing, and what I'm now also seeing in the DER CI pipelines, is the error:

Time: 01:08.314, Memory: 14.00 MB
There was 1 error:
1) Drupal\Tests\scheduled_transitions\Functional\ScheduledTransitionViewsListTest::testList
InvalidArgumentException: Class "dynamic_entity_reference_views_data" does not exist.
/builds/project/scheduled_transitions/web/core/lib/Drupal/Core/DependencyInjection/ClassResolver.php:32
/builds/project/scheduled_transitions/web/core/lib/Drupal/Core/Utility/CallableResolver.php:78
/builds/project/scheduled_transitions/web/core/lib/Drupal/Core/Extension/ModuleHandler.php:637
/builds/project/scheduled_transitions/web/core/lib/Drupal/Core/Extension/ModuleHandler.php:285
/builds/project/scheduled_transitions/web/core/modules/views/src/ViewsData.php:244
/builds/project/scheduled_transitions/web/core/modules/views/src/ViewsData.php:164
/builds/project/scheduled_transitions/web/core/modules/views/src/Entity/View.php:455
/builds/project/scheduled_transitions/web/core/lib/Drupal/Core/Config/ConfigInstaller.php:428
/builds/project/scheduled_transitions/web/core/lib/Drupal/Core/Config/ConfigInstaller.php:299
/builds/project/scheduled_transitions/web/core/lib/Drupal/Core/Config/ConfigInstaller.php:192
/builds/project/scheduled_transitions/web/core/lib/Drupal/Core/Extension/ModuleInstaller.php:451
/builds/project/scheduled_transitions/web/core/lib/Drupal/Core/Extension/ModuleInstaller.php:219
/builds/project/scheduled_transitions/web/core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php:511
/builds/project/scheduled_transitions/web/core/tests/Drupal/Tests/BrowserTestBase.php:560
/builds/project/scheduled_transitions/web/core/tests/Drupal/Tests/BrowserTestBase.php:350

It seems to me this is because \Drupal\Core\Utility\CallableResolver::getCallableFromDefinition is_callable is failing. My guess is that DER's dynamic_entity_reference.views.inc isnt being included automatically.

I wasnt able to trace an exact issue where .inc files may not be included anymore yet, but I can see various changes to core which are removing inc files...

Proposed resolution

So I took a stab at seeing if changing the .inc file to `#[Hook]`'s would solve it, and it seems it does. So, I'm proposing we move to convert this file.

The MR herein simply:

  • copies and pastes the functions into methods into a new class
  • changes \Drupal:: calls to use DI
  • adds gates in case views is not enabled, which will satisfy phpstan
  • \t() -> $this->t()
  • is based on DER HEAD

Remaining tasks

  • Evaluate if this is the right solution at the right time.
  • Bring up the minimum Drupal version.
  • If DER maintainers dont want to change the minimum supported Drupal versions to ones which universally support `#[Hook]`, id suggest some kind of hook bridge between the existing file, which has a version gate/sniff in it (perhaps via class_exists(Hook::class)`.

User interface changes

None

API changes

Some, but considered private API surface.

Data model changes

None.

CommentFileSizeAuthor
#4 der-views-hooks-for-3.2.1-stable.patch25.88 KBdpi
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

dpi created an issue. See original summary.

dpi’s picture

Issue summary: View changes
dpi’s picture

Assigned: dpi » Unassigned
StatusFileSize
new25.88 KB

Heres a patch for v3.2.1, since patches generated from the MR based on 3.x HEAD will not apply due to intermediate changes.

dpi’s picture

DER recent failure in daily: March 10, 2026 at 6:00:56 AM GMT+8

6 errors containing:

InvalidArgumentException: Class "dynamic_entity_reference_views_data" does not exist.

https://git.drupalcode.org/project/dynamic_entity_reference/-/pipelines/...

test: phpunit (next major): job: https://git.drupalcode.org/project/dynamic_entity_reference/-/jobs/8837997

4) Drupal\Tests\dynamic_entity_reference\Kernel\Views\DynamicEntityReferenceRelationshipTest::testReverseMultipleRelationship
Exception: Exception when installing config for module views, message was: Class "dynamic_entity_reference_views_data" does not exist.
/builds/project/dynamic_entity_reference/web/core/tests/Drupal/KernelTests/KernelTestBase.php:765
/builds/project/dynamic_entity_reference/web/core/modules/views/tests/src/Kernel/ViewsKernelTestBase.php:77
/builds/project/dynamic_entity_reference/web/core/modules/views/tests/src/Kernel/ViewsKernelTestBase.php:51
/builds/project/dynamic_entity_reference/tests/src/Kernel/Views/DynamicEntityReferenceRelationshipTest.php:58
Caused by
InvalidArgumentException: Class "dynamic_entity_reference_views_data" does not exist.
/builds/project/dynamic_entity_reference/web/core/lib/Drupal/Core/DependencyInjection/ClassResolver.php:32
/builds/project/dynamic_entity_reference/web/core/lib/Drupal/Core/Utility/CallableResolver.php:78
/builds/project/dynamic_entity_reference/web/core/lib/Drupal/Core/Extension/ModuleHandler.php:637
/builds/project/dynamic_entity_reference/web/core/lib/Drupal/Core/Extension/ModuleHandler.php:285
/builds/project/dynamic_entity_reference/web/core/modules/views/src/ViewsData.php:244
/builds/project/dynamic_entity_reference/web/core/modules/views/src/ViewsData.php:164
/builds/project/dynamic_entity_reference/web/core/modules/views/src/Entity/View.php:455
/builds/project/dynamic_entity_reference/web/core/lib/Drupal/Core/Config/ConfigInstaller.php:428
/builds/project/dynamic_entity_reference/web/core/lib/Drupal/Core/Config/ConfigInstaller.php:299
/builds/project/dynamic_entity_reference/web/core/lib/Drupal/Core/Config/ConfigInstaller.php:208
/builds/project/dynamic_entity_reference/web/core/tests/Drupal/KernelTests/KernelTestBase.php:762
/builds/project/dynamic_entity_reference/web/core/modules/views/tests/src/Kernel/ViewsKernelTestBase.php:77
/builds/project/dynamic_entity_reference/web/core/modules/views/tests/src/Kernel/ViewsKernelTestBase.php:51
/builds/project/dynamic_entity_reference/tests/src/Kernel/Views/DynamicEntityReferenceRelationshipTest.php:58

dpi’s picture

dpi’s picture

If you're looking at this anytime soon, know that the current builds may be broken due to #3570077-39: Update to Symfony 8

dpi’s picture

Issue summary: View changes