mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2024-12-04 23:17:19 +01:00
Optimized PureSourceCreateType
This commit is contained in:
parent
559aa60e0f
commit
d6999cb601
@ -1,21 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Form\Source;
|
||||
|
||||
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
|
||||
*/
|
||||
final class PureSourceCreateType extends SourceType
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @see \Symfony\Component\Form\AbstractType::buildForm()
|
||||
*/
|
||||
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…
Reference in New Issue
Block a user