2022-09-30 10:49:02 -04:00
|
|
|
<?php declare(strict_types=1);
|
2022-09-29 20:09:31 -04:00
|
|
|
|
|
|
|
namespace App\Form;
|
|
|
|
|
2022-10-07 16:04:34 -04:00
|
|
|
use App\Entity\{Brand, GpuCore};
|
|
|
|
use Doctrine\ORM\EntityRepository;
|
|
|
|
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
2022-09-30 10:49:02 -04:00
|
|
|
use Symfony\Component\Form\{AbstractType, FormBuilderInterface};
|
2022-09-29 20:09:31 -04:00
|
|
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
|
|
|
|
|
|
|
class GPUCoreType extends AbstractType
|
|
|
|
{
|
|
|
|
public function buildForm(FormBuilderInterface $builder, array $options): void
|
|
|
|
{
|
|
|
|
$builder
|
2022-10-07 16:04:34 -04:00
|
|
|
->add('brand', EntityType::class, [
|
|
|
|
'class' => Brand::class,
|
|
|
|
'query_builder' => static fn (EntityRepository $e) => $e->createQueryBuilder('b')->orderBy('b.name', 'ASC'),
|
|
|
|
])
|
2022-09-29 20:09:31 -04:00
|
|
|
->add('name')
|
|
|
|
->add('variant')
|
|
|
|
->add('architecture')
|
|
|
|
->add('architectureLink')
|
2022-09-30 10:49:02 -04:00
|
|
|
->add('generationName')
|
2022-10-07 16:04:34 -04:00
|
|
|
->add('generationLink')
|
2022-09-30 10:49:02 -04:00
|
|
|
->add('processNode');
|
2022-09-29 20:09:31 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
public function configureOptions(OptionsResolver $resolver): void
|
|
|
|
{
|
|
|
|
$resolver->setDefaults([
|
|
|
|
'data_class' => GpuCore::class,
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|