109 lines
2.5 KiB
PHP
109 lines
2.5 KiB
PHP
<?php
|
|
|
|
namespace App\Form;
|
|
|
|
use App\Entity\Brand;
|
|
use App\Entity\Cpu;
|
|
use App\Enum\CpuArchitecture;
|
|
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
|
use Symfony\Component\Form\AbstractType;
|
|
use Symfony\Component\Form\Extension\Core\Type\EnumType;
|
|
use Symfony\Component\Form\Extension\Core\Type\UrlType;
|
|
use Symfony\Component\Form\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' => 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,
|
|
]);
|
|
}
|
|
}
|