mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-04-16 10:16:22 +02:00
Optimized PureSourceCreateType
This commit is contained in:
parent
559aa60e0f
commit
d6999cb601
@ -1,21 +1,42 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Form\Source;
|
namespace App\Form\Source;
|
||||||
|
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
|
use App\Entity\Source\PureSource;
|
||||||
|
use App\Attribut\SlugAttributInterface;
|
||||||
|
use App\Attribut\ClassAttributInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
* @author kevinfrantz
|
* @author kevinfrantz
|
||||||
*/
|
*/
|
||||||
final class PureSourceCreateType extends SourceType
|
final class PureSourceCreateType extends SourceType
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*
|
*
|
||||||
* @see \Symfony\Component\Form\AbstractType::buildForm()
|
* @see \Symfony\Component\Form\AbstractType::buildForm()
|
||||||
*/
|
*/
|
||||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||||
{
|
{
|
||||||
$builder->add('slug');
|
$builder
|
||||||
|
->add(SlugAttributInterface::SLUG_ATTRIBUT_NAME)
|
||||||
|
->add(ClassAttributInterface::CLASS_ATTRIBUT_NAME, SourceType::class, [
|
||||||
|
'mapped' => false
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
* @see \Symfony\Component\Form\AbstractType::configureOptions()
|
||||||
|
*/
|
||||||
|
public function configureOptions(OptionsResolver $resolver)
|
||||||
|
{
|
||||||
|
$resolver->setDefaults([
|
||||||
|
'data_class' => PureSource::class
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user