Generated with the help of an LLM.

PHP Fatal Error when saving content

Updated Advanced Insert View to 2.10 and Entity Usage to 5.0.1

I did these updates and found that when I tried to save and content I got a 500 error.
I looked at the server error logs and saw this:

Drupal\insert_view_adv\Plugin\EntityUsage\Track\InsertViewArguments::create(Symfony\Component\DependencyInjection\ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) must be compatible with Drupal\entity_usage\EntityUsageTrackBase::create(Symfony\Component\DependencyInjection\ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition): static in /home/mysite/public_html/modules/contrib/insert_view_adv/src/Plugin/EntityUsage/Track/InsertViewArguments.php on line 46

Proposed resolution

I fed the error message into Google gemini and it gave me this solution.

1/ Open the file: /home/mysite/public_html/modules/contrib/insert_view_adv/src/Plugin/EntityUsage/Track/InsertViewArguments.php"

2/ Go to line 46 and find the create method signature:
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {

3/ Add : static right before the opening curly brace {: -- so it reads
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition): static {

4/ Save the file and and run drush

This worked, after modifying the file, i can save content again.

Remaining tasks

I don't know how to write a patch. Hopefully one of the maintainers can look at this and see if it is a viable solution and incorporate this into a patch.

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

dadderley created an issue. See original summary.

a.dmitriiev’s picture

Hi @dadderley,

Thank you for bug report. It seems that the entity usage plugin in the module was written for the previous version of the Entity Usage module and now the method definition is changed. I will check it and add the fix to a next patch release.

a.dmitriiev’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

dadderley’s picture

Thanks a.dmitriiev