Problem/Motivation

I'm seeing,

Deprecated function: Creation of dynamic property Drupal\queue_stats\Plugin\QueueStatistic\EstimatedTimeToFinish::$container is deprecated in Drupal\queue_stats\Plugin\QueueStatistic\EstimatedTimeToFinish->__construct() (line 47 of modules/composer/queue_stats/src/Plugin/QueueStatistic/EstimatedTimeToFinish.php).

Steps to reproduce

I'm seeing this when using migrate_preview module to preview a migration, but the dependency injection needs to be fixed in any case.

Proposed resolution

Instead of passing the container object from create() to __construct() and then using that to obtain the plugin.manager in getValue(), get the plugin.manager in create() and pass that.

Remaining tasks

make a MR.

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

benstallings created an issue. See original summary.

benstallings’s picture

Assigned: Unassigned » benstallings

benstallings’s picture

Status: Active » Needs review
benstallings’s picture

Status: Needs review » Needs work

Upon further investigation, this seems to result in a circular reference. Someone who has a better grasp on the code should take a look.

benstallings’s picture

Assigned: benstallings » Unassigned
achton’s picture

Thanks for reporting this and for the merge request. Your circular reference finding was the key: QueueStatisticManager created every statistic plugin in its constructor, so a plugin that gets the manager injected asks for a service that is still being built. #3434069: Automated Drupal 11 compatibility fixes for queue_stats fixes it by creating the plugins on first use. It includes the dependency injection from this issue and your return 0;, and you are credited there. Closing as a duplicate.

achton’s picture

Status: Needs work » Closed (duplicate)

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.