mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
doc for rector rule [ci-skip]
This commit is contained in:
parent
05822e7e4a
commit
aa6479fbf9
@ -32,7 +32,59 @@ class ChillBundleAddFormDefaultDataOnExportFilterAggregatorRector extends Abstra
|
|||||||
{
|
{
|
||||||
return new RuleDefinition(
|
return new RuleDefinition(
|
||||||
'Add a getFormDefault data method on exports, filters and aggregators, filled with default data',
|
'Add a getFormDefault data method on exports, filters and aggregators, filled with default data',
|
||||||
[]
|
[
|
||||||
|
<<<PHP
|
||||||
|
use Chill\MainBundle\Export\FilterInterface;
|
||||||
|
use Chill\MainBundle\Form\Type\PickRollingDateType;
|
||||||
|
use Chill\MainBundle\Service\RollingDate\RollingDate;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||||
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
|
||||||
|
class MyClass implements FilterInterface
|
||||||
|
{
|
||||||
|
public function buildForm(FormBuilderInterface $builder)
|
||||||
|
{
|
||||||
|
$builder->add('foo', PickRollingDateType::class, [
|
||||||
|
'label' => 'Test thing',
|
||||||
|
'data' => new RollingDate(RollingDate::T_TODAY)
|
||||||
|
]);
|
||||||
|
|
||||||
|
$builder->add('baz', TextType::class, [
|
||||||
|
'label' => 'OrNiCar',
|
||||||
|
'data' => 'Castor'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
PHP,
|
||||||
|
<<<PHP
|
||||||
|
|
||||||
|
use Chill\MainBundle\Export\FilterInterface;
|
||||||
|
use Chill\MainBundle\Form\Type\PickRollingDateType;
|
||||||
|
use Chill\MainBundle\Service\RollingDate\RollingDate;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||||
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
|
||||||
|
class MyClass implements FilterInterface
|
||||||
|
{
|
||||||
|
public function buildForm(FormBuilderInterface $builder)
|
||||||
|
{
|
||||||
|
$builder->add('foo', PickRollingDateType::class, [
|
||||||
|
'label' => 'Test thing',
|
||||||
|
'data' => new RollingDate(RollingDate::T_TODAY)
|
||||||
|
]);
|
||||||
|
|
||||||
|
$builder->add('baz', TextType::class, [
|
||||||
|
'label' => 'OrNiCar',
|
||||||
|
'data' => 'Castor'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
public function getFormDefaultData(): array
|
||||||
|
{
|
||||||
|
return ['foo' => new RollingDate(RollingDate::T_TODAY), 'baz' => 'Castor'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
PHP
|
||||||
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user