40 lines
913 B
PHP
40 lines
913 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace KupShop\WatchdogBundle\EventSubscriber;
|
|
|
|
use KupShop\KupShopBundle\Event\CronEvent;
|
|
use KupShop\WatchdogBundle\Util\Watchdog;
|
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
|
|
|
class CronSubscriber implements EventSubscriberInterface
|
|
{
|
|
private Watchdog $watchdog;
|
|
|
|
public function __construct(Watchdog $watchdog)
|
|
{
|
|
$this->watchdog = $watchdog;
|
|
}
|
|
|
|
public static function getSubscribedEvents()
|
|
{
|
|
return [
|
|
CronEvent::RUN_NORMAL => [
|
|
['generateWatchdogs', 200],
|
|
['deletePurchasedWatchdogProducts', 200],
|
|
],
|
|
];
|
|
}
|
|
|
|
public function generateWatchdogs(): void
|
|
{
|
|
$this->watchdog->generateWatchdogs();
|
|
}
|
|
|
|
public function deletePurchasedWatchdogProducts(): void
|
|
{
|
|
$this->watchdog->deletePurchasedWatchdogProducts();
|
|
}
|
|
}
|