CronQueueTestDeriverQueue.php

Same filename in other branches
  1. 11.x core/modules/system/tests/modules/cron_queue_test/src/Plugin/QueueWorker/CronQueueTestDeriverQueue.php

Namespace

Drupal\cron_queue_test\Plugin\QueueWorker

File

core/modules/system/tests/modules/cron_queue_test/src/Plugin/QueueWorker/CronQueueTestDeriverQueue.php

View source
<?php

namespace Drupal\cron_queue_test\Plugin\QueueWorker;

use Drupal\Core\Queue\Attribute\QueueWorker;
use Drupal\Core\Queue\QueueWorkerBase;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\cron_queue_test\Plugin\Derivative\CronQueueTestDeriver;

/**
 * A queue worker for testing derivatives.
 */
class CronQueueTestDeriverQueue extends QueueWorkerBase {
    
    /**
     * The plugin ID.
     */
    public const PLUGIN_ID = 'cron_queue_test_deriver';
    
    /**
     * {@inheritdoc}
     */
    public function processItem($data) {
        $state = \Drupal::state();
        $processed = $state->get(self::PLUGIN_ID, 0);
        $state->set(self::PLUGIN_ID, ++$processed);
    }

}

Classes

Title Deprecated Summary
CronQueueTestDeriverQueue A queue worker for testing derivatives.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.