ActivityWorkerActivities.php in Open Social 8
Same filename and directory in other branches
- 8.9 modules/custom/activity_creator/src/Plugin/QueueWorker/ActivityWorkerActivities.php
- 8.2 modules/custom/activity_creator/src/Plugin/QueueWorker/ActivityWorkerActivities.php
- 8.3 modules/custom/activity_creator/src/Plugin/QueueWorker/ActivityWorkerActivities.php
- 8.4 modules/custom/activity_creator/src/Plugin/QueueWorker/ActivityWorkerActivities.php
- 8.5 modules/custom/activity_creator/src/Plugin/QueueWorker/ActivityWorkerActivities.php
- 8.6 modules/custom/activity_creator/src/Plugin/QueueWorker/ActivityWorkerActivities.php
- 8.7 modules/custom/activity_creator/src/Plugin/QueueWorker/ActivityWorkerActivities.php
- 8.8 modules/custom/activity_creator/src/Plugin/QueueWorker/ActivityWorkerActivities.php
- 10.3.x modules/custom/activity_creator/src/Plugin/QueueWorker/ActivityWorkerActivities.php
- 10.0.x modules/custom/activity_creator/src/Plugin/QueueWorker/ActivityWorkerActivities.php
- 10.1.x modules/custom/activity_creator/src/Plugin/QueueWorker/ActivityWorkerActivities.php
- 10.2.x modules/custom/activity_creator/src/Plugin/QueueWorker/ActivityWorkerActivities.php
File
modules/custom/activity_creator/src/Plugin/QueueWorker/ActivityWorkerActivities.phpView source
<?php
namespace Drupal\activity_creator\Plugin\QueueWorker;
use Drupal\activity_creator\ActivityFactory;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* A report worker.
*
* @QueueWorker(
* id = "activity_creator_activities",
* title = @Translation("Process activity activities."),
* cron = {"time" = 60}
* )
*
* @TODO Change the weight to make sure it runs after the logger
* is this possible? See Cron.php::processQueues() and getDefinitions().
*
* This QueueWorker is responsible for creating Activity entities and will
* retrieve use information provided by activity_creator_logger.
*/
class ActivityWorkerActivities extends ActivityWorkerBase implements ContainerFactoryPluginInterface {
/**
* Activity Factory.
*
* @var \Drupal\activity_creator\ActivityFactory
*/
private $activityFactory;
/**
* {@inheritdoc}
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, ActivityFactory $activityFactory) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->activityFactory = $activityFactory;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($configuration, $plugin_id, $plugin_definition, $container
->get('activity_creator.activity_factory'));
}
/**
* {@inheritdoc}
*
* @TODO Can one item have multiple destinations; if not: split.
*/
public function processItem($data) {
// Let the factory work.
$this->activityFactory
->createActivities($data);
}
}
Classes
Name | Description |
---|---|
ActivityWorkerActivities | A report worker. |