PHP code example of tourze / doctrine-cron-job-bundle
1. Go to this page and download the library: Download tourze/doctrine-cron-job-bundle library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
tourze / doctrine-cron-job-bundle example snippets
use Tourze\DoctrineCronJobBundle\Entity\CronJob;
$job = new CronJob();
$job->setName('my-job');
$job->setCommand('php bin/console app:my-command');
$job->setSchedule('* * * * *'); // Run every minute
$job->setDescription('My cron job');
$job->setValid(true);
// Save to database
$entityManager->persist($job);
$entityManager->flush();
use Tourze\DoctrineCronJobBundle\Entity\CronSql;
$cronSql = new CronSql();
$cronSql->setTitle('Statistics Task');
$cronSql->setSqlStatement('SELECT COUNT(*) FROM users');
$cronSql->setCronExpression('0 0 * * *'); // Run at midnight every day
$cronSql->setValid(true);
// Save to database
$entityManager->persist($cronSql);
$entityManager->flush();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.