Skip to content

Commit

Permalink
updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
loevgaard committed Oct 2, 2018
1 parent 5050698 commit afb8b21
Showing 1 changed file with 62 additions and 1 deletion.
63 changes: 62 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,68 @@ This command requires you to have Composer installed globally, as explained in t

### Step 2: Enable the bundle

Will be enabled by default when you use Symfony Flex.
If you use Symfony Flex it will be enabled automatically. Else you need to add it to the `bundles.php`.

```php
<?php
// config/bundles.php

return [
// ...
Setono\CronExpressionBundle\SetonoCronExpressionBundle::class => ['all' => true],
// ...
];
```

# Step 3: Add to form type
```php
<?php
// 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)
;
}
}
```

# Step 4: Add to entity
```php
<?php
// src/Entity/Task.php

namespace App\Entity;

use Cron\CronExpression;
use Doctrine\ORM\Mapping as ORM;

class Task
{
// ...

/**
* @var CronExpression
*
* @ORM\Column(type="cron_expression")
*/
protected $schedule;

// ...
}
```

[ico-version]: https://img.shields.io/packagist/v/setono/cron-expression-bundle.svg?style=flat-square
[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square
Expand Down

0 comments on commit afb8b21

Please sign in to comment.