Optimized PureSourceCreateType

This commit is contained in:
Kevin Frantz 2019-02-13 18:39:14 +01:00
parent 559aa60e0f
commit d6999cb601

View File

@ -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
]);
}
}