You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

30 lines
598 B

<?php
namespace core\jobs;
use Yii;
use yii\base\InvalidConfigException;
use yii\queue\JobInterface;
use yii\queue\Queue;
abstract class Job implements JobInterface
{
/**
* @param Queue $queue
* @throws InvalidConfigException
*/
public function execute($queue): void
{
$listener = $this->resolveHandler();
$listener($this, $queue);
}
/**
* @return callable
* @throws InvalidConfigException
*/
private function resolveHandler(): callable
{
return [Yii::createObject(static::class . 'Handler'), 'handle'];
}
}