collection-crud/src/Entity/CpuBase.php

164 lines
5.2 KiB
PHP

<?php declare(strict_types=1);
namespace App\Entity;
use App\Enum\CpuArchitecture;
use Doctrine\Common\Collections\{ArrayCollection, Collection};
use Doctrine\ORM\Mapping as ORM;
trait CpuBase {
#[ORM\ManyToOne(targetEntity: Brand::class, fetch: 'EAGER')]
#[ORM\OrderBy(['name' => 'asc'])]
#[ORM\JoinColumn('brand_id', referencedColumnName: 'id', nullable: FALSE)]
private Brand $brand;
// ------------------------------------------------------------------------
// CPU Specs
// ------------------------------------------------------------------------
#[ORM\Column('architecture', type: 'string', enumType: CpuArchitecture::class)]
private CpuArchitecture $architecture;
#[ORM\Column('product_line', type: 'string')]
private string $productLine;
#[ORM\Column('model', type: 'string')]
private string $model;
#[ORM\Column('part_number', type: 'string')]
private string $partNumber;
#[ORM\Column('lot_number', type: 'string', nullable: TRUE, options: [
'comment' => 'The CPU lot number, such as s-spec for Intel CPUs',
])]
private ?string $lotNumber;
#[ORM\Column('micro_architecture', type: 'string', nullable: TRUE)]
private ?string $microArchitecture = '';
#[ORM\Column('codename', type: 'string', nullable: TRUE)]
private ?string $codeName = '';
#[ORM\Column('base_speed', type: 'integer', options: [
'comment' => 'The stock speed of the cpu in MHz',
])]
private int $baseSpeed;
#[ORM\Column('boost_speed', type: 'integer', nullable: TRUE, options: [
'comment' => 'The max boost speed of the cpu in MHz, if applicable',
])]
private ?int $boostSpeed;
#[ORM\Column('cores', type: 'integer')]
private int $cores = 1;
#[ORM\Column('threads', type: 'integer')]
private int $threads = 1;
#[ORM\Column('igp', type: 'string', nullable: TRUE, options: [
'comment' => 'The name of the integrated graphics processor',
])]
private ?string $igp;
#[ORM\Column('voltage', type: 'float', nullable: TRUE)]
private ?float $voltage;
#[ORM\Column('tdp', type: 'integer', nullable: TRUE)]
private ?int $tdp;
#[ORM\Column('process_node', type: 'integer', nullable: TRUE)]
private ?int $processNode;
// ------------------------------------------------------------------------
// CPU Cache
// ------------------------------------------------------------------------
#[ORM\Column('l1_data_count', type: 'integer', nullable: TRUE, options: [
'comment' => 'The number of L1 data caches on the package, usually the same as the number of cores',
])]
private ?int $L1dCount = NULL;
#[ORM\Column('l1_data_size', type: 'integer', nullable: TRUE, options: [
'comment' => 'The size of each Level 1 data cache in KB',
])]
private ?int $L1dSize = NULL;
#[ORM\Column('l1_data_way', type: 'integer', nullable: TRUE)]
private ?int $L1dWay = NULL;
#[ORM\Column('l1_code_count', type: 'integer', nullable: TRUE, options: [
'comment' => 'The number of L1 instruction caches on the package, usually the same as the number of cores',
])]
private ?int $L1cCount = NULL;
#[ORM\Column('l1_code_size', type: 'integer', nullable: TRUE, options: [
'comment' => 'The size of each Level 1 instruction cache in KB',
])]
private ?int $L1cSize = NULL;
#[ORM\Column('l1_code_way', type: 'integer', nullable: TRUE)]
private ?int $L1cWay = NULL;
#[ORM\Column('l1_unified_count', type: 'integer', nullable: TRUE, options: [
'comment' => 'The number of L1 caches on the package, usually the same as the number of cores',
])]
private ?int $L1uCount = NULL;
#[ORM\Column('l1_unified_size', type: 'integer', nullable: TRUE, options: [
'comment' => 'The size of each Level 1 unified cache in KB',
])]
private ?int $L1uSize = NULL;
#[ORM\Column('l1_unified_way', type: 'integer', nullable: TRUE)]
private ?int $L1uWay = NULL;
#[ORM\Column('l2_count', type: 'integer', options: [
'comment' => 'The number of L2 caches on the package, usually the same as the number of cores',
])]
private int $L2Count = 1;
#[ORM\Column('l2_size', type: 'integer', nullable: TRUE, options: [
'comment' => 'The size of each Level 2 cache in KB',
])]
private ?int $L2Size;
#[ORM\Column('l2_way', type: 'integer', nullable: TRUE)]
private ?int $L2Way;
#[ORM\Column('l3_count', type: 'integer', options: [
'comment' => 'The number of L3 caches on the package',
])]
private int $L3Count = 0;
#[ORM\Column('l3_size', type: 'integer', nullable: TRUE, options: [
'comment' => 'The size of each Level 3 cache in KB',
])]
private ?int $L3Size;
#[ORM\Column('l3_way', type: 'integer', nullable: TRUE)]
private ?int $L3Way;
// ------------------------------------------------------------------------
// Collection Metadata
// ------------------------------------------------------------------------
#[ORM\Column('count', type: 'integer')]
private int $count = 1;
#[ORM\Column('usable', type: 'boolean', options: [
'comment' => 'Whether the chip is working, and can be used with other hardware I have',
])]
private bool $usable = TRUE;
#[ORM\Column('received', type: 'boolean', options: [
'comment' => 'Whether I have the chip in my possession (instead of in shipping)',
])]
private bool $received = TRUE;
#[ORM\Column('link', type: 'string')]
private string $link;
#[ORM\Column('notes', type: 'text', nullable: TRUE)]
private ?string $notes = '';
}