70 lines
2.3 KiB
PHP
70 lines
2.3 KiB
PHP
|
<?php declare(strict_types=1);
|
||
|
|
||
|
namespace App\Form;
|
||
|
|
||
|
use App\Entity\{Brand, Gpu, GpuCore};
|
||
|
use Doctrine\ORM\EntityRepository;
|
||
|
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||
|
use Symfony\Component\Form\{AbstractType, FormBuilderInterface};
|
||
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||
|
|
||
|
class GpuType extends AbstractType
|
||
|
{
|
||
|
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||
|
{
|
||
|
$brandQueryBuilder = static fn (EntityRepository $e) => $e->createQueryBuilder('b')->orderBy('b.name', 'ASC');
|
||
|
|
||
|
$builder
|
||
|
->add('gpuBrand', EntityType::class, [
|
||
|
'class' => Brand::class,
|
||
|
'query_builder' => $brandQueryBuilder,
|
||
|
])
|
||
|
->add('modelName')
|
||
|
->add('gpuCore', EntityType::class, [
|
||
|
'class' => GpuCore::class,
|
||
|
'query_builder' => static fn (EntityRepository $e) => $e->createQueryBuilder('gc')->orderBy('gc.brand', 'ASC')->orderBy('gc.name', 'ASC'),
|
||
|
])
|
||
|
->add('boardBrand', EntityType::class, [
|
||
|
'class' => Brand::class,
|
||
|
'query_builder' => $brandQueryBuilder,
|
||
|
'empty_data' => NULL,
|
||
|
])
|
||
|
->add('alternateModelName')
|
||
|
->add('cardKey')
|
||
|
->add('busInterface')
|
||
|
->add('slotWidth')
|
||
|
->add('molexPower')
|
||
|
->add('pcie6power')
|
||
|
->add('pcie8power')
|
||
|
->add('tdp')
|
||
|
->add('baseClock')
|
||
|
->add('boostClock')
|
||
|
->add('memoryClock')
|
||
|
->add('memorySize')
|
||
|
->add('memoryBus')
|
||
|
->add('memoryType')
|
||
|
->add('shadingUnits')
|
||
|
->add('tmus')
|
||
|
->add('rops')
|
||
|
->add('computeUnits')
|
||
|
->add('l1cache')
|
||
|
->add('l2cache')
|
||
|
->add('directXSupport')
|
||
|
->add('openGLSupport')
|
||
|
->add('openCLSupport')
|
||
|
->add('vulkanSupport')
|
||
|
->add('shaderModel')
|
||
|
->add('link')
|
||
|
->add('count')
|
||
|
->add('acquired')
|
||
|
->add('notes');
|
||
|
}
|
||
|
|
||
|
public function configureOptions(OptionsResolver $resolver): void
|
||
|
{
|
||
|
$resolver->setDefaults([
|
||
|
'data_class' => Gpu::class,
|
||
|
]);
|
||
|
}
|
||
|
}
|