Drupal 10 error

Created on 18 July 2024, 2 months ago
Updated 28 July 2024, about 2 months ago

Hello.
Please tell me why this error might occur.

TypeError: Drupal\user_ref_field_cache_context\CacheContext\UserReferenceField::__construct(): Argument #1 ($entity_type_manager) must be of type Drupal\Core\Entity\EntityTypeManagerInterface, Drupal\Core\Session\AccountProxy given, called in */core/lib/Drupal/Component/DependencyInjection/Container.php on line 261 in Drupal\user_ref_field_cache_context\CacheContext\UserReferenceField->__construct() (line 33 of modules/contrib/user_ref_field_cache_context/src/CacheContext/UserReferenceField.php).

Error after path (error-3462348.patch)

Error: Call to a member function getAccount() on null in Drupal\user_ref_field_cache_context\CacheContext\UserReferenceField->getContext() (line 60 of modules/contrib/user_ref_field_cache_context/src/CacheContext/UserReferenceField.php).

📌 Task
Status

Active

Version

1.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @stayr
  • Status changed to Needs review 2 months ago
  • Hi @stayr,

    You received this error due to a type hint mismatch. The error occurs when the type of the argument being passed to the constructor does not match the expected type. I reviewed your code and identified that you need to add some lines to the 'services.yml' file.

    Please refer to the attached patch for details.

    Thanks!

  • After patch error

    Error: Call to a member function getAccount() on null in Drupal\user_ref_field_cache_context\CacheContext\UserReferenceField->getContext() (line 60 of modules/contrib/user_ref_field_cache_context/src/CacheContext/UserReferenceField.php).

  • After patch error

    Error: Call to a member function getAccount() on null in Drupal\user_ref_field_cache_context\CacheContext\UserReferenceField->getContext() (line 60 of modules/contrib/user_ref_field_cache_context/src/CacheContext/UserReferenceField.php).

  • Status changed to Active 2 months ago
  • After patch error

    Error: Call to a member function getAccount() on null in Drupal\user_ref_field_cache_context\CacheContext\UserReferenceField->getContext() (line 60 of modules/contrib/user_ref_field_cache_context/src/CacheContext/UserReferenceField.php).

  • Status changed to Needs review 2 months ago
  • After patch error

    Error: Call to a member function getAccount() on null in Drupal\user_ref_field_cache_context\CacheContext\UserReferenceField->getContext() (line 60 of modules/contrib/user_ref_field_cache_context/src/CacheContext/UserReferenceField.php).

  • After patch error

    Error: Call to a member function getAccount() on null in Drupal\user_ref_field_cache_context\CacheContext\UserReferenceField->getContext() (line 60 of modules/contrib/user_ref_field_cache_context/src/CacheContext/UserReferenceField.php).

  • Status changed to Active 2 months ago
  • After patch error

    Error: Call to a member function getAccount() on null in Drupal\user_ref_field_cache_context\CacheContext\UserReferenceField->getContext() (line 60 of modules/contrib/user_ref_field_cache_context/src/CacheContext/UserReferenceField.php).

  • Assigned to stayr
  • Error after path

    Error: Call to a member function getAccount() on null in Drupal\user_ref_field_cache_context\CacheContext\UserReferenceField->getContext() (line 60 of modules/contrib/user_ref_field_cache_context/src/CacheContext/UserReferenceField.php).

  • Error after path

    Error: Call to a member function getAccount() on null in Drupal\user_ref_field_cache_context\CacheContext\UserReferenceField->getContext() (line 60 of modules/contrib/user_ref_field_cache_context/src/CacheContext/UserReferenceField.php).

  • Does anyone have any other ideas?

Production build 0.71.5 2024