PHP code example of setono / cron-expression-bundle
1. Go to this page and download the library: Download setono/cron-expression-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/ */
// src/Form/TaskType.php
namespace App\Form;
use Setono\CronExpressionBundle\Form\Type\CronExpressionType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
class TaskType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('task')
->add('schedule', CronExpressionType::class)
->add('save', SubmitType::class)
;
}
}
declare(strict_types=1);
namespace App\Entity;
use Cron\CronExpression;
use Doctrine\ORM\Mapping as ORM;
use Setono\CronExpressionBundle\Doctrine\DBAL\Types\CronExpressionType;
#[ORM\Entity]
class Task
{
#[ORM\Column(type: CronExpressionType::CRON_EXPRESSION_TYPE)]
private CronExpression $schedule;
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.