199 lines
5.9 KiB
PHP
199 lines
5.9 KiB
PHP
<?php declare(strict_types=1);
|
|
|
|
namespace App\Entity;
|
|
|
|
use App\Enum\CpuArchitecture;
|
|
use Doctrine\Common\Collections\{Collection, ArrayCollection};
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
|
|
#[ORM\Table('cpu', schema: 'collection')]
|
|
#[ORM\Entity]
|
|
class Cpu {
|
|
use GetSet;
|
|
|
|
#[ORM\Column('id', type: 'integer', nullable: FALSE)]
|
|
#[ORM\Id]
|
|
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
|
|
private int $id;
|
|
|
|
#[ORM\ManyToOne(targetEntity: Brand::class, fetch: 'EAGER')]
|
|
#[ORM\OrderBy(['name' => 'asc'])]
|
|
#[ORM\JoinColumn('brand_id', referencedColumnName: 'id', nullable: FALSE)]
|
|
private Brand $brand;
|
|
|
|
#[ORM\Column('architecture', type: 'string', enumType: CpuArchitecture::class)]
|
|
private CpuArchitecture $architecture;
|
|
|
|
/**
|
|
* @var Collection<int, Socket>
|
|
*/
|
|
#[ORM\ManyToMany(targetEntity: Socket::class, inversedBy: 'cpus', fetch: 'LAZY')]
|
|
#[ORM\JoinTable('collection.cpu_socket_link')]
|
|
#[ORM\JoinColumn('cpu_id', referencedColumnName: 'id')]
|
|
#[ORM\InverseJoinColumn('socket_id', referencedColumnName: 'id')]
|
|
#[ORM\OrderBy(['name' => 'asc'])]
|
|
private Collection $sockets;
|
|
|
|
#[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: array(
|
|
'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: array(
|
|
'comment' => 'The stock speed of the cpu in MHz'
|
|
))]
|
|
private int $baseSpeed;
|
|
|
|
#[ORM\Column('boost_speed', type: 'integer', nullable: true, options: array(
|
|
'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: array(
|
|
'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;
|
|
|
|
#[ORM\Column('count', type: 'integer')]
|
|
private int $count = 1;
|
|
|
|
#[ORM\Column('usable', type: 'boolean', options: array(
|
|
'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: array(
|
|
'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 = '';
|
|
|
|
// ------------------------------------------------------------------------
|
|
// CPU Cache
|
|
// ------------------------------------------------------------------------
|
|
|
|
#[ORM\Column('l1_data_count', type:'integer', nullable: true, options: array(
|
|
'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: array(
|
|
'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: array(
|
|
'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: array(
|
|
'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: array(
|
|
'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: array(
|
|
'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: array(
|
|
'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: array(
|
|
'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: array(
|
|
'comment' => 'The number of L3 caches on the package'
|
|
))]
|
|
private int $L3Count = 0;
|
|
|
|
#[ORM\Column('l3_size', type: 'integer', nullable: true, options: array(
|
|
'comment' => 'The size of each Level 3 cache in KB'
|
|
))]
|
|
private ?int $L3Size;
|
|
|
|
#[ORM\Column('l3_way', type: 'integer', nullable: true)]
|
|
private ?int $L3Way;
|
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
public function __construct()
|
|
{
|
|
$this->sockets = new ArrayCollection();
|
|
}
|
|
|
|
public function addSocket(Socket $socket): self
|
|
{
|
|
if ( ! $this->sockets->contains($socket))
|
|
{
|
|
$this->sockets->add($socket);
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function removeSocket(Socket $socket): self
|
|
{
|
|
$this->sockets->removeElement($socket);
|
|
|
|
return $this;
|
|
}
|
|
}
|