105 lines
2.5 KiB
PHP
105 lines
2.5 KiB
PHP
<?php declare(strict_types=1);
|
|
|
|
namespace App\Form;
|
|
|
|
use App\Entity\{Brand, Cpu};
|
|
use App\Enum\CpuArchitecture;
|
|
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
|
use Symfony\Component\Form\Extension\Core\Type\{EnumType, UrlType};
|
|
use Symfony\Component\Form\{AbstractType, FormBuilderInterface};
|
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
|
use UnitEnum;
|
|
|
|
class CpuType extends AbstractType {
|
|
use BrandCategoryTrait;
|
|
|
|
public function buildForm(FormBuilderInterface $builder, array $options): void
|
|
{
|
|
$builder
|
|
->add('architecture', EnumType::class, [
|
|
'class' => CpuArchitecture::class,
|
|
'choice_label' => static fn (UnitEnum $choice): string => $choice->value,
|
|
'choices' => CpuArchitecture::getGroups(),
|
|
])
|
|
->add('brand', EntityType::class, [
|
|
'class' => Brand::class,
|
|
'query_builder' => self::filterBrands('cpu'),
|
|
])
|
|
->add('sockets')
|
|
->add('productLine')
|
|
->add('model')
|
|
->add('partNumber')
|
|
->add('lotNumber')
|
|
->add('microArchitecture')
|
|
->add('codeName')
|
|
|
|
// Cache Stuff
|
|
->add('L1dCount', NULL, [
|
|
'label' => 'L1 Data Cache(s)',
|
|
])
|
|
->add('L1dSize', NULL, [
|
|
'label' => 'L1 Data Size KB',
|
|
])
|
|
->add('L1dWay', NULL, [
|
|
'label' => 'L1 Data (x-way)',
|
|
])
|
|
->add('L1cCount', NULL, [
|
|
'label' => 'L1 Instruction Cache(s)',
|
|
])
|
|
->add('L1cSize', NULL, [
|
|
'label' => 'L1 Instruction Size KB',
|
|
])
|
|
->add('L1cWay', NULL, [
|
|
'label' => 'L1 Instruction (x-way)',
|
|
])
|
|
->add('L1uCount', NULL, [
|
|
'label' => 'L1 Unified Cache(s)',
|
|
])
|
|
->add('L1uSize', NULL, [
|
|
'label' => 'L1 Unified Cache Size: KB',
|
|
])
|
|
->add('L1uWay', NULL, [
|
|
'label' => 'L1 Unified (x-way)',
|
|
])
|
|
->add('L2Count', NULL, [
|
|
'label' => 'L2 Cache(s)',
|
|
])
|
|
->add('L2Size', NULL, [
|
|
'label' => 'L2 Cache Size KB (per unit)',
|
|
])
|
|
->add('L2Way', NULL, [
|
|
'label' => 'L2 Cache (x-way)',
|
|
])
|
|
->add('L3Count', NULL, [
|
|
'label' => 'L3 Cache(s)',
|
|
])
|
|
->add('L3Size', NULL, [
|
|
'label' => 'L3 Cache Size KB (per unit)',
|
|
])
|
|
->add('L3Way', NULL, [
|
|
'label' => 'L3 Cache (x-way)',
|
|
])
|
|
|
|
->add('baseSpeed')
|
|
->add('boostSpeed')
|
|
->add('cores')
|
|
->add('threads')
|
|
->add('igp')
|
|
->add('voltage')
|
|
->add('tdp')
|
|
->add('processNode')
|
|
->add('count')
|
|
->add('usable')
|
|
->add('received')
|
|
->add('link', UrlType::class)
|
|
->add('notes');
|
|
}
|
|
|
|
public function configureOptions(OptionsResolver $resolver): void
|
|
{
|
|
$resolver->setDefaults([
|
|
'data_class' => Cpu::class,
|
|
]);
|
|
}
|
|
}
|