mirror of
				https://github.com/kevinveenbirkenbach/infinito.git
				synced 2025-11-04 03:07:58 +00:00 
			
		
		
		
	Optimized PureSourceCreateType
This commit is contained in:
		@@ -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
 | 
			
		||||
        ]);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user