Add PreviouslyOwnedCpu and upgrade Symfony

This commit is contained in:
Timothy Warren 2024-03-27 16:23:08 -04:00
parent 5e0e5576d1
commit 6c863022f5
29 changed files with 1711 additions and 1307 deletions

View File

@ -6,26 +6,25 @@
"composer/package-versions-deprecated": "1.11.99.5",
"doctrine/doctrine-bundle": "^2.8.2",
"doctrine/doctrine-migrations-bundle": "^3.2.2",
"doctrine/orm": "^2.14.1",
"sensio/framework-extra-bundle": "^6.2.9",
"symfony/form": "^6.2.5",
"doctrine/orm": "^3.1.1",
"symfony/form": "^7.0.4",
"symfony/maker-bundle": "^1.48",
"symfony/monolog-bundle": "^3.8",
"symfony/security-bundle": "^6.2.6",
"symfony/security-csrf": "^6.2.5",
"symfony/translation": "^6.2.5",
"symfony/twig-bundle": "^6.2.5",
"symfony/validator": "^6.2.5",
"symfony/yaml": "^6.2.5",
"symfony/security-bundle": "^7.0.5",
"symfony/security-csrf": "^7.0.3",
"symfony/translation": "^7.0.4",
"symfony/twig-bundle": "^7.0.4",
"symfony/validator": "^7.0.5",
"symfony/yaml": "^7.0.3",
"twig/twig": "^2.12|^3.5"
},
"require-dev": {
"phpunit/phpunit": "^9.5.28",
"phpunit/phpunit": "^11.0.8",
"roave/security-advisories": "dev-master",
"symfony/dotenv": "^6.2.5",
"symfony/dotenv": "^7.0.4",
"symfony/flex": "^2.2.4",
"symfony/stopwatch": "^6.2.5",
"symfony/web-profiler-bundle": "^6.2.5"
"symfony/stopwatch": "^7.0.3",
"symfony/web-profiler-bundle": "^7.0.4"
},
"config": {
"preferred-install": {

1706
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,13 +1,12 @@
<?php declare(strict_types=1);
<?php
return [
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => TRUE],
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => TRUE],
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => TRUE],
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => TRUE],
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => TRUE, 'test' => TRUE],
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => TRUE],
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => TRUE],
Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => TRUE],
Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => TRUE],
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true],
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
];

View File

@ -21,6 +21,7 @@ return static function (ContainerConfigurator $containerConfigurator): void {
'auto_generate_proxy_classes' => '%kernel.debug%',
'naming_strategy' => 'doctrine.orm.naming_strategy.underscore_number_aware',
'auto_mapping' => TRUE,
'enable_lazy_ghost_objects' => TRUE,
'mappings' => [
'App' => [
'is_bundle' => FALSE,
@ -29,6 +30,9 @@ return static function (ContainerConfigurator $containerConfigurator): void {
'prefix' => 'App\Entity',
'alias' => 'App'],
],
'controller_resolver' => [
'auto_mapping' => true,
]
],
]);
};

View File

@ -6,7 +6,17 @@ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigura
use Symfony\Config\FrameworkConfig;
return static function (ContainerConfigurator $containerConfigurator, FrameworkConfig $config): void {
$config->session(['handler_id' => NULL]);
$config->handleAllThrowables(true);
$config->annotations([
'enabled' => FALSE
]);
$config->session([
'handler_id' => NULL,
'cookie_secure' => 'auto',
'cookie_samesite' => 'strict',
]);
$config->secret('%env(APP_SECRET)%')
->defaultLocale('en')

View File

@ -1,9 +0,0 @@
<?php declare(strict_types=1);
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->extension('sensio_framework_extra', [
'router' => ['annotations' => FALSE],
]);
};

View File

@ -1,6 +1,4 @@
<?php
declare(strict_types=1);
<?php declare(strict_types=1);
use App\Kernel;
use Symfony\Component\Dotenv\Dotenv;

View File

@ -1,6 +1,14 @@
$(document).foundation();
(function() {
// Disable weird scrolling behavior on input[type=number] fields
// Based on https://stackoverflow.com/questions/9712295/disable-scrolling-on-input-type-number/38589039#38589039
document.addEventListener('wheel', () => {
if (document.activeElement !== null && document.activeElement['type'] === 'number') {
document.activeElement['blur']()
}
})
let tables = document.querySelectorAll('table.sortable');
let i = 0;
let len = tables.length;

View File

@ -6,7 +6,9 @@ use App\Entity\Cpu;
use App\Form\CpuType;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\{Request, Response};
use Symfony\Component\HttpFoundation\
{RedirectResponse, Request, Response};
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Routing\Annotation\Route;
#[Route('/cpu')]
@ -70,4 +72,23 @@ class CpuController extends AbstractController {
{
return $this->deleteCSRF($request, $cpu);
}
/**
* Moves a cpu to the previouslyOwned table
*/
#[Route(path: '/{id}/deacquire', name: 'cpu_deacquire', methods: ['POST'])]
public function reacquireAction(Request $request, Cpu $cpu): RedirectResponse
{
return $this->itemDeacquire($request, $cpu, 'previously_owned_cpu_index');
}
/**
* Creates a form to move
*
* @param cpu $cpu The cpu entity
*/
private function createDeacquireForm(cpu $cpu): FormInterface
{
return $this->buildForm($cpu, 'cpu_deacquire');
}
}

View File

@ -0,0 +1,70 @@
<?php declare(strict_types=1);
namespace App\Controller;
use App\Entity\PreviouslyOwnedCpu;
use App\Form\PreviouslyOwnedCpuType;
use App\Repository\CpuRepository;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\
{RedirectResponse, Request, Response};
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Routing\Annotation\Route;
#[Route('previously_owned_cpu')]
class PreviouslyOwnedCpuController extends AbstractController {
use FormControllerBase;
protected const ENTITY = PreviouslyOwnedCpu::class;
protected const TEMPLATE_PATH = 'previously_owned_cpu/';
protected const ROUTE_PREFIX = 'previously_owned_cpu_';
protected const FORM = PreviouslyOwnedCpuType::class;
public function __construct(private readonly EntityManagerInterface $entityManager)
{
}
#[Route('/', name: 'previously_owned_cpu_index', methods: ['GET'])]
public function index(): Response
{
return $this->itemListView('cpus');
}
#[Route('/{id}', name: 'previously_owned_cpu_show', methods: ['GET'])]
public function show(PreviouslyOwnedCpu $previouslyOwnedCpu): Response
{
return $this->itemView($previouslyOwnedCpu, 'previously_owned_cpu');
}
#[Route('/{id}/edit', name: 'previously_owned_cpu_edit', methods: ['GET', 'POST'])]
public function edit(Request $request, PreviouslyOwnedCpu $previouslyOwnedCpu): Response
{
return $this->itemUpdate($request, $previouslyOwnedCpu, 'previously_owned_cpu');
}
#[Route('/{id}', name: 'previously_owned_cpu_delete', methods: ['POST'])]
public function delete(Request $request, PreviouslyOwnedCpu $previouslyOwnedCpu): Response
{
return $this->deleteCSRF($request, $previouslyOwnedCpu);
}
/**
* Moves a Gpu to the previouslyOwned table
*/
#[Route(path: '/{id}/reacquire', name: 'previously_owned_cpu_reacquire', methods: ['POST'])]
public function reacquireAction(Request $request, PreviouslyOwnedCpu $Cpu): RedirectResponse
{
return $this->itemReacquire($request, $Cpu, 'cpu_index');
}
/**
* Creates a form to move
*
* @param PreviouslyOwnedCpu $Cpu The Cpu entity
*/
private function createReacquireForm(PreviouslyOwnedCpu $Cpu): FormInterface
{
return $this->buildForm($Cpu, 'previously_owned_cpu_reacquire', 'POST');
}
}

View File

@ -3,7 +3,6 @@
namespace App\Controller;
use App\Entity\PreviouslyOwnedGpu;
use App\Enum\SlotKey;
use App\Form\PreviouslyOwnedGpuType;
use Doctrine\ORM\{EntityManagerInterface, ORMInvalidArgumentException};
use LogicException;

View File

@ -3,27 +3,21 @@
namespace App\Entity;
use App\Enum\CpuArchitecture;
use App\Repository\CpuRepository;
use Doctrine\Common\Collections\{ArrayCollection, Collection};
use Doctrine\ORM\Mapping as ORM;
#[ORM\Table('cpu', schema: 'collection')]
#[ORM\Entity]
#[ORM\Entity(repositoryClass: CpuRepository::class)]
class Cpu {
use GetSet;
use CpuBase;
#[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>
*/
@ -34,144 +28,6 @@ class Cpu {
#[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: [
'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;
#[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 = '';
// ------------------------------------------------------------------------
// 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;
// ------------------------------------------------------------------------
public function __construct()

163
src/Entity/CpuBase.php Normal file
View File

@ -0,0 +1,163 @@
<?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 = '';
}

View File

@ -0,0 +1,21 @@
<?php declare(strict_types=1);
namespace App\Entity;
use Doctrine\Common\Collections\{ArrayCollection, Collection};
use Doctrine\ORM\Mapping as ORM;
#[ORM\Table(name: 'expansion_slot', schema: 'collection')]
#[ORM\Entity]
class ExpansionSlot {
use GetSet;
#[ORM\Column(name: 'id', type: 'integer', nullable: FALSE)]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
#[ORM\SequenceGenerator(sequenceName: 'expansion_slot_id_seq', allocationSize: 1, initialValue: 1)]
private int $id;
#[ORM\Column(name: 'name', unique: TRUE, nullable: FALSE)]
private string $name;
}

View File

@ -27,6 +27,10 @@ trait GpuBase {
#[ORM\Column(name: 'alternate_model_name', nullable: TRUE)]
private ?string $alternateModelName = '';
// ------------------------------------------------------------------------
// Physical Details
// ------------------------------------------------------------------------
#[ORM\Column(
name: 'card_key',
type: 'string',
@ -56,6 +60,10 @@ trait GpuBase {
)]
private int $slotSpan = 1;
// ------------------------------------------------------------------------
// Power / Gpu Clock
// ------------------------------------------------------------------------
#[ORM\Column(name: 'molex_power', options: ['default' => 0])]
private int $molexPower = 0;
@ -86,6 +94,10 @@ trait GpuBase {
)]
private ?int $boostClock;
// ------------------------------------------------------------------------
// Memory Specs
// ------------------------------------------------------------------------
#[ORM\Column(
name: 'memory_clock',
nullable: TRUE,
@ -110,6 +122,10 @@ trait GpuBase {
#[ORM\Column(name: 'memory_type', nullable: TRUE)]
private ?string $memoryType;
// ------------------------------------------------------------------------
// GPU Core Specs
// ------------------------------------------------------------------------
#[ORM\Column(name: 'shading_units', nullable: TRUE)]
private ?int $shadingUnits;
@ -128,6 +144,10 @@ trait GpuBase {
#[ORM\Column(name: 'l2_cache', nullable: TRUE)]
private ?string $l2cache;
// ------------------------------------------------------------------------
// Rendering API support
// ------------------------------------------------------------------------
#[ORM\Column(name: 'direct_x_support', nullable: TRUE)]
private ?string $directXSupport;
@ -143,6 +163,10 @@ trait GpuBase {
#[ORM\Column(name: 'shader_model', nullable: TRUE)]
private ?string $shaderModel;
// ------------------------------------------------------------------------
// Collection metadata
// ------------------------------------------------------------------------
#[ORM\Column(name: 'link', nullable: TRUE)]
private ?string $link;

View File

@ -10,6 +10,10 @@ use Doctrine\ORM\Mapping as ORM;
class Motherboard {
use GetSet;
// ------------------------------------------------------------------------
// General
// ------------------------------------------------------------------------
#[ORM\Column('id', type: 'integer', nullable: FALSE)]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
@ -23,6 +27,9 @@ class Motherboard {
#[ORM\Column('model', type: 'string')]
private string $model;
#[ORM\Column('revision', type: 'string', nullable: TRUE)]
private string $revision;
/**
* @var Collection<int, Socket>
*/
@ -38,12 +45,37 @@ class Motherboard {
#[ORM\JoinColumn('chipset_id', 'id', FALSE)]
private Chipset $chipset;
// ------------------------------------------------------------------------
// Ram
// ------------------------------------------------------------------------
#[ORM\Column(name: 'ram_slot_count', type: 'integer', nullable: FALSE)]
private int $ramSlots;
#[ORM\Column(name: 'max_ram', type: 'string', nullable: TRUE)]
private int $ramMaximum;
#[ORM\Column(name: 'max_ram_speed', type: 'string', nullable: TRUE)]
private int $ramMaxSpeed;
// ------------------------------------------------------------------------
// Misc
// ------------------------------------------------------------------------
#[ORM\Column(name: 'count', nullable: FALSE, options: ['default' => 1])]
private int $count = 1;
#[ORM\Column(name: 'acquired', nullable: FALSE, options: ['default' => TRUE])]
private bool $acquired;
#[ORM\Column('link', type: 'string')]
private string $link;
#[ORM\Column('notes', type: 'text', nullable: TRUE)]
private ?string $notes = '';
// ------------------------------------------------------------------------
// Getters / Setters
// ------------------------------------------------------------------------
public function __construct()

View File

@ -0,0 +1,53 @@
<?php declare(strict_types=1);
namespace App\Entity;
use App\Repository\CpuRepository;
use Doctrine\Common\Collections\{ArrayCollection, Collection};
use Doctrine\ORM\Mapping as ORM;
#[ORM\Table('previously_owned_cpu', schema: 'collection')]
#[ORM\Entity(repositoryClass: CpuRepository::class)]
class PreviouslyOwnedCpu {
use GetSet;
use CpuBase;
#[ORM\Column('id', type: 'integer', nullable: FALSE)]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
private int $id;
/**
* @var Collection<int, Socket>
*/
#[ORM\ManyToMany(targetEntity: Socket::class, inversedBy: 'previously_owned_cpus', fetch: 'LAZY')]
#[ORM\JoinTable('collection.previously_owned_cpu_socket_link')]
#[ORM\JoinColumn('cpu_id', referencedColumnName: 'id')]
#[ORM\InverseJoinColumn('socket_id', referencedColumnName: 'id')]
#[ORM\OrderBy(['name' => 'asc'])]
private Collection $sockets;
// ------------------------------------------------------------------------
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;
}
}

View File

@ -0,0 +1,105 @@
<?php declare(strict_types=1);
namespace App\Form;
use App\Enum\CpuArchitecture;
use App\Entity\
{Brand, PreviouslyOwnedCpu, Socket};
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\
{AbstractType, Extension\Core\Type\EnumType, Extension\Core\Type\UrlType, FormBuilderInterface};
use Symfony\Component\OptionsResolver\OptionsResolver;
use UnitEnum;
class PreviouslyOwnedCpuType 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' => PreviouslyOwnedCpu::class,
]);
}
}

View File

@ -12,36 +12,8 @@
namespace App;
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
class Kernel extends BaseKernel {
use MicroKernelTrait;
protected function configureContainer(
ContainerConfigurator $container,
LoaderInterface $loader,
ContainerBuilder $builder
): void {
$configDir = $this->getConfigDir();
$container->import('../config/{packages}/*.yaml');
$container->import('../config/{packages}/' . $this->environment . '/*.yaml');
$container->import('../config/{packages}/*.php');
$container->import('../config/{packages}/' . $this->environment . '/*.php');
$container->import('../config/{services}.php');
$container->import('../config/{services}_' . $this->environment . '.php');
}
protected function configureRoutes(RoutingConfigurator $routes): void
{
$routes->import('../config/{routes}/' . $this->environment . '/*.php');
$routes->import('../config/{routes}/*.php');
$routes->import('../config/{routes}.php');
}
}

View File

@ -0,0 +1,74 @@
<?php
declare(strict_types=1);
namespace App\Migrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20240327190849 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE collection.expansion_slot (id SERIAL NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_892885ED5E237E06 ON collection.expansion_slot (name)');
$this->addSql('CREATE TABLE collection.previously_owned_cpu (id SERIAL NOT NULL, brand_id INT NOT NULL, architecture VARCHAR(255) NOT NULL, product_line VARCHAR(255) NOT NULL, model VARCHAR(255) NOT NULL, part_number VARCHAR(255) NOT NULL, lot_number VARCHAR(255) DEFAULT NULL, micro_architecture VARCHAR(255) DEFAULT NULL, codename VARCHAR(255) DEFAULT NULL, base_speed INT NOT NULL, boost_speed INT DEFAULT NULL, cores INT NOT NULL, threads INT NOT NULL, igp VARCHAR(255) DEFAULT NULL, voltage DOUBLE PRECISION DEFAULT NULL, tdp INT DEFAULT NULL, process_node INT DEFAULT NULL, l1_data_count INT DEFAULT NULL, l1_data_size INT DEFAULT NULL, l1_data_way INT DEFAULT NULL, l1_code_count INT DEFAULT NULL, l1_code_size INT DEFAULT NULL, l1_code_way INT DEFAULT NULL, l1_unified_count INT DEFAULT NULL, l1_unified_size INT DEFAULT NULL, l1_unified_way INT DEFAULT NULL, l2_count INT NOT NULL, l2_size INT DEFAULT NULL, l2_way INT DEFAULT NULL, l3_count INT NOT NULL, l3_size INT DEFAULT NULL, l3_way INT DEFAULT NULL, count INT NOT NULL, usable BOOLEAN NOT NULL, received BOOLEAN NOT NULL, link VARCHAR(255) NOT NULL, notes TEXT DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_5C01C1D844F5D008 ON collection.previously_owned_cpu (brand_id)');
$this->addSql('COMMENT ON COLUMN collection.previously_owned_cpu.lot_number IS \'The CPU lot number, such as s-spec for Intel CPUs\'');
$this->addSql('COMMENT ON COLUMN collection.previously_owned_cpu.base_speed IS \'The stock speed of the cpu in MHz\'');
$this->addSql('COMMENT ON COLUMN collection.previously_owned_cpu.boost_speed IS \'The max boost speed of the cpu in MHz, if applicable\'');
$this->addSql('COMMENT ON COLUMN collection.previously_owned_cpu.igp IS \'The name of the integrated graphics processor\'');
$this->addSql('COMMENT ON COLUMN collection.previously_owned_cpu.l1_data_count IS \'The number of L1 data caches on the package, usually the same as the number of cores\'');
$this->addSql('COMMENT ON COLUMN collection.previously_owned_cpu.l1_data_size IS \'The size of each Level 1 data cache in KB\'');
$this->addSql('COMMENT ON COLUMN collection.previously_owned_cpu.l1_code_count IS \'The number of L1 instruction caches on the package, usually the same as the number of cores\'');
$this->addSql('COMMENT ON COLUMN collection.previously_owned_cpu.l1_code_size IS \'The size of each Level 1 instruction cache in KB\'');
$this->addSql('COMMENT ON COLUMN collection.previously_owned_cpu.l1_unified_count IS \'The number of L1 caches on the package, usually the same as the number of cores\'');
$this->addSql('COMMENT ON COLUMN collection.previously_owned_cpu.l1_unified_size IS \'The size of each Level 1 unified cache in KB\'');
$this->addSql('COMMENT ON COLUMN collection.previously_owned_cpu.l2_count IS \'The number of L2 caches on the package, usually the same as the number of cores\'');
$this->addSql('COMMENT ON COLUMN collection.previously_owned_cpu.l2_size IS \'The size of each Level 2 cache in KB\'');
$this->addSql('COMMENT ON COLUMN collection.previously_owned_cpu.l3_count IS \'The number of L3 caches on the package\'');
$this->addSql('COMMENT ON COLUMN collection.previously_owned_cpu.l3_size IS \'The size of each Level 3 cache in KB\'');
$this->addSql('COMMENT ON COLUMN collection.previously_owned_cpu.usable IS \'Whether the chip is working, and can be used with other hardware I have\'');
$this->addSql('COMMENT ON COLUMN collection.previously_owned_cpu.received IS \'Whether I have the chip in my possession (instead of in shipping)\'');
$this->addSql('CREATE TABLE collection.previously_owned_cpu_socket_link (cpu_id INT NOT NULL, socket_id INT NOT NULL, PRIMARY KEY(cpu_id, socket_id))');
$this->addSql('CREATE INDEX IDX_3FDC320D3917014 ON collection.previously_owned_cpu_socket_link (cpu_id)');
$this->addSql('CREATE INDEX IDX_3FDC320DD20E239C ON collection.previously_owned_cpu_socket_link (socket_id)');
$this->addSql('ALTER TABLE collection.previously_owned_cpu ADD CONSTRAINT FK_5C01C1D844F5D008 FOREIGN KEY (brand_id) REFERENCES collection.brand (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE collection.previously_owned_cpu_socket_link ADD CONSTRAINT FK_3FDC320D3917014 FOREIGN KEY (cpu_id) REFERENCES collection.previously_owned_cpu (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE collection.previously_owned_cpu_socket_link ADD CONSTRAINT FK_3FDC320DD20E239C FOREIGN KEY (socket_id) REFERENCES collection.socket (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE collection.motherboard ADD revision VARCHAR(255) DEFAULT NULL');
$this->addSql('ALTER TABLE collection.motherboard ADD ram_slot_count INT NOT NULL');
$this->addSql('ALTER TABLE collection.motherboard ADD max_ram VARCHAR(255) DEFAULT NULL');
$this->addSql('ALTER TABLE collection.motherboard ADD max_ram_speed VARCHAR(255) DEFAULT NULL');
$this->addSql('ALTER TABLE collection.motherboard ADD count INT DEFAULT 1 NOT NULL');
$this->addSql('ALTER TABLE collection.motherboard ADD acquired BOOLEAN DEFAULT true NOT NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA public');
$this->addSql('ALTER TABLE collection.previously_owned_cpu DROP CONSTRAINT FK_5C01C1D844F5D008');
$this->addSql('ALTER TABLE collection.previously_owned_cpu_socket_link DROP CONSTRAINT FK_3FDC320D3917014');
$this->addSql('ALTER TABLE collection.previously_owned_cpu_socket_link DROP CONSTRAINT FK_3FDC320DD20E239C');
$this->addSql('DROP TABLE collection.expansion_slot');
$this->addSql('DROP TABLE collection.previously_owned_cpu');
$this->addSql('DROP TABLE collection.previously_owned_cpu_socket_link');
$this->addSql('ALTER TABLE collection.motherboard DROP revision');
$this->addSql('ALTER TABLE collection.motherboard DROP ram_slot_count');
$this->addSql('ALTER TABLE collection.motherboard DROP max_ram');
$this->addSql('ALTER TABLE collection.motherboard DROP max_ram_speed');
$this->addSql('ALTER TABLE collection.motherboard DROP count');
$this->addSql('ALTER TABLE collection.motherboard DROP acquired');
}
}

View File

@ -0,0 +1,18 @@
<?php declare(strict_types=1);
namespace App\Repository;
use App\Entity\{Cpu, PreviouslyOwnedCpu};
class CpuRepository extends AcquireRepository {
public function deacquire(mixed $currentRecord): void
{
$currentRecord->setReceived(TRUE);
$this->moveRecord($currentRecord, new PreviouslyOwnedCpu());
}
public function reacquire(mixed $currentRecord): void
{
$this->moveRecord($currentRecord, new Cpu());
}
}

View File

@ -32,7 +32,7 @@ class <?= $class_name ?> extends AbstractController {
<?php endif ?>
<?= $generator->generateRouteForControllerMethod('/new', sprintf('%s_new', $route_name), ['GET', 'POST']) ?>
<?php if (isset($repository_full_class_name) && $generator->repositoryHasSaveAndRemoveMethods($repository_full_class_name))
<?php if (isset($repository_full_class_name))
{ ?>
public function new(Request $request, <?= $repository_class_name ?> $<?= $repository_var ?>): Response
<?php }
@ -51,7 +51,7 @@ class <?= $class_name ?> extends AbstractController {
}
<?= $generator->generateRouteForControllerMethod(sprintf('/{%s}/edit', $entity_identifier), sprintf('%s_edit', $route_name), ['GET', 'POST']) ?>
<?php if (isset($repository_full_class_name) && $generator->repositoryHasSaveAndRemoveMethods($repository_full_class_name))
<?php if (isset($repository_full_class_name))
{ ?>
public function edit(Request $request, <?= $entity_class_name ?> $<?= $entity_var_singular ?>, <?= $repository_class_name ?> $<?= $repository_var ?>): Response
<?php }
@ -64,7 +64,7 @@ class <?= $class_name ?> extends AbstractController {
}
<?= $generator->generateRouteForControllerMethod(sprintf('/{%s}', $entity_identifier), sprintf('%s_delete', $route_name), ['POST']) ?>
<?php if (isset($repository_full_class_name) && $generator->repositoryHasSaveAndRemoveMethods($repository_full_class_name))
<?php if (isset($repository_full_class_name))
{ ?>
public function delete(Request $request, <?= $entity_class_name ?> $<?= $entity_var_singular ?>, <?= $repository_class_name ?> $<?= $repository_var ?>): Response
<?php }

View File

@ -2,27 +2,12 @@
"composer/package-versions-deprecated": {
"version": "1.11.99.3"
},
"doctrine/annotations": {
"version": "1.0",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "1.0",
"ref": "a2759dd6123694c8d901d0ec80006e044c2e6457"
},
"files": [
"config/routes/annotations.yaml"
]
},
"doctrine/cache": {
"version": "1.10.2"
},
"doctrine/collections": {
"version": "1.6.7"
},
"doctrine/common": {
"version": "2.13.3"
},
"doctrine/dbal": {
"version": "2.12.1"
},
@ -197,27 +182,12 @@
"sebastian/recursion-context": {
"version": "4.0.4"
},
"sebastian/resource-operations": {
"version": "3.0.3"
},
"sebastian/type": {
"version": "2.3.4"
},
"sebastian/version": {
"version": "3.0.2"
},
"sensio/framework-extra-bundle": {
"version": "5.2",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "5.2",
"ref": "fb7e19da7f013d0d422fa9bce16f5c510e27609b"
},
"files": [
"config/packages/sensio_framework_extra.yaml"
]
},
"symfony/cache": {
"version": "v5.2.3"
},
@ -352,9 +322,6 @@
"symfony/polyfill-mbstring": {
"version": "v1.22.1"
},
"symfony/polyfill-php72": {
"version": "v1.24.0"
},
"symfony/polyfill-php80": {
"version": "v1.22.1"
},

View File

@ -34,17 +34,17 @@
<a href="{{ path('gpu_index') }}">🎮 GPUs</a>
</li>
<li class="not-implemented {{ route starts with 'motherboard_' ? 'is-active' }}">
<a href="/motherboard/">🤰 Motherboards</a>
<a href="/motherboards/">🤰 Motherboards</a>
</li>
</ul>
<ul class="menu">
<li class="menu-text">Previously Owned</li>
<li class="not-implemented {{ route starts with 'previously-owned-cpu_' ? 'is-active' }}">
<a href="#">🧠 CPUs</a>
<li class="{{ route starts with 'previously_owned_cpu_' ? 'is-active' }}">
<a href="{{ path('previously_owned_cpu_index') }}">🧠 CPUs</a>
</li>
<li class="not-implemented {{ route starts with 'previously-owned-fpu_' ? 'is-active' }}">
<!-- <li class="not-implemented {{ route starts with 'previously-owned-fpu_' ? 'is-active' }}">
<a href="#">🧮 FPUs</a>
</li>
</li>-->
<li class="{{ route starts with 'previously-owned-gpu_' ? 'is-active' }}">
<a href="{{ path('previously-owned-gpu_index') }}">🎮 GPUs</a>
</li>

View File

@ -104,9 +104,21 @@
>Update</button>
{{ form_end(form) }}
<form method="post" action="{{ path('cpu_delete', {'id': cpu.id}) }}" onsubmit="return confirm('Are you sure you want to delete this item?');">
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ cpu.id) }}">
<button type="submit" class="alert button expanded">Delete</button>
</form>
<div class="grid-x grid-margin-x">
<div class="cell large-6 small-12">
{{ form_start(deacquire_form) }}
{{ form_widget(deacquire_form) }}
<button type="submit" class="button expanded">De-acquire</button>
{{ form_end(deacquire_form) }}
</div>
<div class="cell large-6 small-12">
<form method="post" action="{{ path('cpu_delete', {'id': cpu.id}) }}" onsubmit="return confirm('Are you sure you want to delete this item?');">
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ cpu.id) }}">
<button type="submit" class="alert button expanded">Delete</button>
</form>
</div>
</div>
{% endblock %}

View File

@ -22,10 +22,10 @@
data-tabs
id="classifications"
>
<li class="tabs-title is-active" aria-selected="true">
<li class="tabs-title">
<a href="#not_acquired">On the Way</a>
</li>
<li class="tabs-title">
<li class="tabs-title is-active" aria-selected="true">
<a href="#pcie">PCIe</a>
</li>
<li class="tabs-title">
@ -44,7 +44,7 @@
<div class="tabs-content" data-tabs-content="classifications">
{% for label, gpus in gpus %}
<div class="tabs-panel {% if label == 'not_acquired' %}is-active{% endif %}" id="{{ label }}">
<div class="tabs-panel {% if label == 'pcie' %}is-active{% endif %}" id="{{ label }}">
<table class="hover scroll sortable stack">
<thead>
<tr>

View File

@ -0,0 +1,114 @@
{% extends 'form.html.twig' %}
{% block title %}Previously Owned Cpu - Edit{% endblock %}
{% block form %}
<h2>Edit Previously-Owned Cpu</h2>
<div class="small callout">
<ul>
<li>
<a href="{{ path('previously_owned_cpu_index') }}">Back to the list</a>
</li>
</ul>
</div>
{{ form_start(form) }}
<fieldset class="large primary callout">
<legend>Brand, Model, Family</legend>
<div class="grid-x grid-margin-x">
<div class="cell">{{ form_row(form.architecture) }}</div>
<div class="cell">{{ form_row(form.sockets) }}</div>
<div class="cell medium-4">{{ form_row(form.brand) }}</div>
<div class="cell medium-4">{{ form_row(form.productLine) }}</div>
<div class="cell medium-4">{{ form_row(form.model) }}</div>
<div class="cell medium-6">{{ form_row(form.partNumber) }}</div>
<div class="cell medium-6">{{ form_row(form.lotNumber) }}</div>
<div class="cell medium-6">{{ form_row(form.microArchitecture) }}</div>
<div class="cell medium-6">{{ form_row(form.codeName) }}</div>
</div>
</fieldset>
<fieldset class="large primary callout">
<legend>Cache</legend>
<details {% if previously_owned_cpu.L1uSize %}open{% endif %}>
<summary>Unified Cache</summary>
<div class="grid-x grid-margin-x">
<div class="cell medium-4">{{ form_row(form.L1uCount) }}</div>
<div class="cell medium-4">{{ form_row(form.L1uSize) }}</div>
<div class="cell medium-4">{{ form_row(form.L1uWay) }}</div>
</div>
</details>
<details {% if previously_owned_cpu.L1cSize %}open{% endif %}>
<summary>Split cache</summary>
<div class="grid-x grid-margin-x">
<div class="cell medium-4">{{ form_row(form.L1cCount) }}</div>
<div class="cell medium-4">{{ form_row(form.L1cSize) }}</div>
<div class="cell medium-4">{{ form_row(form.L1cWay) }}</div>
<div class="cell medium-4">{{ form_row(form.L1dCount) }}</div>
<div class="cell medium-4">{{ form_row(form.L1dSize) }}</div>
<div class="cell medium-4">{{ form_row(form.L1dWay) }}</div>
</div>
</details>
<hr />
<div class="grid-x grid-margin-x">
<div class="cell medium-4">{{ form_row(form.L2Count) }}</div>
<div class="cell medium-4">{{ form_row(form.L2Size) }}</div>
<div class="cell medium-4">{{ form_row(form.L2Way) }}</div>
</div>
<hr />
<div class="grid-x grid-margin-x">
<div class="cell medium-4">{{ form_row(form.L3Count) }}</div>
<div class="cell medium-4">{{ form_row(form.L3Size) }}</div>
<div class="cell medium-4">{{ form_row(form.L3Way) }}</div>
</div>
</fieldset>
<fieldset class="large primary callout">
<legend>Speed and Power</legend>
<div class="grid-x grid-margin-x">
<div class="cell medium-6">{{ form_row(form.baseSpeed) }}</div>
<div class="cell medium-6">{{ form_row(form.boostSpeed) }}</div>
<div class="cell medium-6">{{ form_row(form.cores) }}</div>
<div class="cell medium-6">{{ form_row(form.threads) }}</div>
<div class="cell">{{ form_row(form.igp) }}</div>
<div class="cell">{{ form_row(form.voltage) }}</div>
<div class="cell medium-6">{{ form_row(form.tdp) }}</div>
<div class="cell medium-6">{{ form_row(form.processNode) }}</div>
</div>
</fieldset>
<fieldset class="large primary callout">
<legend>Misc</legend>
<div class="grid-x grid-margin-x">
<div class="cell medium-4">{{ form_row(form.count) }}</div>
<div class="cell medium-8">&nbsp;</div>
<div class="cell medium-6">{{ form_row(form.usable) }}</div>
<div class="cell medium-6">{{ form_row(form.received) }}</div>
<div class="cell">{{ form_row(form.link) }}</div>
<div class="cell">{{ form_row(form.notes) }}</div>
</div>
</fieldset>
{{ form_widget(form) }}
<button
type="submit"
class="success button expanded"
>Update</button>
{{ form_end(form) }}
{{ form_start(reacquire_form) }}
{{ form_widget(reacquire_form) }}
<button type="submit" class="button expanded">Re-acquire</button>
{{ form_end(reacquire_form) }}
{% endblock %}

View File

@ -0,0 +1,102 @@
{% extends 'base.html.twig' %}
{% block title %}Previously Owned Cpus{% endblock %}
{% block body %}
<h2>Previously Owned CPUs</h2>
<table class="hover scroll sortable stack">
<thead>
<tr>
<th>&nbsp;</th>
<th>Id</th>
<th>Arch</th>
<th>Model</th>
<th>Socket(s)</th>
<th>Part Number</th>
<th>Lot Number</th>
<th>uArch</th>
<th>Code Name</th>
<th>Speed</th>
<th>C/T</th>
<th>L1 Cache</th>
<th>L2 Cache</th>
<th>L3 Cache</th>
<th>Igp</th>
<th>Count</th>
<th>Usable</th>
<th>Received</th>
<th>Notes</th>
</tr>
</thead>
<tbody>
{% for cpu in cpus %}
<tr>
<td>
<ul>
<li>
<a href="{{ path('previously_owned_cpu_show', {'id': cpu.id}) }}">
View 👁
</a>
</li>
<li>
<a href="{{ path('previously_owned_cpu_edit', {'id': cpu.id}) }}">
Edit <span class="edit-icon">&#9998;</span>
</a>
</li>
</ul>
</td>
<td>{{ cpu.id }}</td>
<td>{{ cpu.architecture.value }}</td>
<td>{{ cpu.brand.name }} {{ cpu.productLine }} {{ cpu.model }}</td>
<td>
<ul>
{% for socket in cpu.sockets %}
<li>{{ socket.name }}</li>
{% endfor %}
</ul>
</td>
<td>{{ cpu.partNumber }}</td>
<td>{{ cpu.lotNumber }}</td>
<td>{{ cpu.microArchitecture }}</td>
<td>{{ cpu.codeName }}</td>
<td>
{{ cpu.baseSpeed }}
{% if cpu.boostSpeed > 0 %}
-{{ cpu.boostSpeed }}
{% endif %}
</td>
<td>{{ cpu.cores }} / {{ cpu.threads }}</td>
<td>
{% if cpu.L1uCount > 0 %}
{{ cpu.L1uCount }}x {{ cpu.L1uSize }}KB {{ cpu.L1uWay }}-way
{% endif %}
{% if cpu.L1cCount > 0 %}
{{ cpu.L1cCount }}x {{ cpu.L1dSize }}KB {{ cpu.L1dWay }}-way data,
{{ cpu.L1dCount }}x {{ cpu.L1cSize }}KB {{ cpu.L1cWay }}-way instruction
{% endif %}
</td>
<td>
{% if cpu.L2Count > 0 %}
{{ cpu.L2Count }}x {{ cpu.L2Size }}KB {{ cpu.L2Way }}-way
{% endif %}
</td>
<td>
{% if cpu.L3Count > 0 %}
{{ cpu.L3Count }}x {{ cpu.L3Size }}KB {{ cpu.L3Way }}-way
{% endif %}
</td>
<td>{{ cpu.igp }}</td>
<td>{{ cpu.count }}</td>
<td>{{ cpu.usable ? 'Yes' : 'No' }}</td>
<td>{{ cpu.received ? 'Yes' : 'No' }}</td>
<td>{{ cpu.notes }}</td>
</tr>
{% else %}
<tr>
<td colspan="33">no records found</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock %}

View File

@ -0,0 +1,178 @@
{% extends 'form.html.twig' %}
{% block title %}PreviouslyOwnedCpu{% endblock %}
{% block form %}
<h2>PreviouslyOwnedCpu</h2>
<div class="callout">
<ul>
<li>
<a href="{{ path('previously_owned_cpu_index') }}">Back to the list</a>
</li>
<li>
<a href="{{ path('previously_owned_cpu_edit', {'id': previously_owned_cpu.id}) }}">Edit</a>
</li>
</ul>
<hr/>
<form method="post" action="{{ path('previously_owned_cpu_delete', {'id': previously_owned_cpu.id}) }}" onsubmit="return confirm('Are you sure you want to delete this item?');">
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ previously_owned_cpu.id) }}">
<button type="submit" class="alert button expanded">Delete</button>
</form>
</div>
<div class="large primary callout">
<table class="table">
<tbody>
<tr>
<th>Id</th>
<td>{{ previously_owned_cpu.id }}</td>
</tr>
<tr>
<th>Architecture</th>
<td>{{ previously_owned_cpu.architecture }}</td>
</tr>
<tr>
<th>ProductLine</th>
<td>{{ previously_owned_cpu.productLine }}</td>
</tr>
<tr>
<th>Model</th>
<td>{{ previously_owned_cpu.model }}</td>
</tr>
<tr>
<th>PartNumber</th>
<td>{{ previously_owned_cpu.partNumber }}</td>
</tr>
<tr>
<th>LotNumber</th>
<td>{{ previously_owned_cpu.lotNumber }}</td>
</tr>
<tr>
<th>MicroArchitecture</th>
<td>{{ previously_owned_cpu.microArchitecture }}</td>
</tr>
<tr>
<th>CodeName</th>
<td>{{ previously_owned_cpu.codeName }}</td>
</tr>
<tr>
<th>BaseSpeed</th>
<td>{{ previously_owned_cpu.baseSpeed }}</td>
</tr>
<tr>
<th>BoostSpeed</th>
<td>{{ previously_owned_cpu.boostSpeed }}</td>
</tr>
<tr>
<th>Cores</th>
<td>{{ previously_owned_cpu.cores }}</td>
</tr>
<tr>
<th>Threads</th>
<td>{{ previously_owned_cpu.threads }}</td>
</tr>
<tr>
<th>Igp</th>
<td>{{ previously_owned_cpu.igp }}</td>
</tr>
<tr>
<th>Voltage</th>
<td>{{ previously_owned_cpu.voltage }}</td>
</tr>
<tr>
<th>Tdp</th>
<td>{{ previously_owned_cpu.tdp }}</td>
</tr>
<tr>
<th>ProcessNode</th>
<td>{{ previously_owned_cpu.processNode }}</td>
</tr>
<tr>
<th>L1dCount</th>
<td>{{ previously_owned_cpu.L1dCount }}</td>
</tr>
<tr>
<th>L1dSize</th>
<td>{{ previously_owned_cpu.L1dSize }}</td>
</tr>
<tr>
<th>L1dWay</th>
<td>{{ previously_owned_cpu.L1dWay }}</td>
</tr>
<tr>
<th>L1cCount</th>
<td>{{ previously_owned_cpu.L1cCount }}</td>
</tr>
<tr>
<th>L1cSize</th>
<td>{{ previously_owned_cpu.L1cSize }}</td>
</tr>
<tr>
<th>L1cWay</th>
<td>{{ previously_owned_cpu.L1cWay }}</td>
</tr>
<tr>
<th>L1uCount</th>
<td>{{ previously_owned_cpu.L1uCount }}</td>
</tr>
<tr>
<th>L1uSize</th>
<td>{{ previously_owned_cpu.L1uSize }}</td>
</tr>
<tr>
<th>L1uWay</th>
<td>{{ previously_owned_cpu.L1uWay }}</td>
</tr>
<tr>
<th>L2Count</th>
<td>{{ previously_owned_cpu.L2Count }}</td>
</tr>
<tr>
<th>L2Size</th>
<td>{{ previously_owned_cpu.L2Size }}</td>
</tr>
<tr>
<th>L2Way</th>
<td>{{ previously_owned_cpu.L2Way }}</td>
</tr>
<tr>
<th>L3Count</th>
<td>{{ previously_owned_cpu.L3Count }}</td>
</tr>
<tr>
<th>L3Size</th>
<td>{{ previously_owned_cpu.L3Size }}</td>
</tr>
<tr>
<th>L3Way</th>
<td>{{ previously_owned_cpu.L3Way }}</td>
</tr>
<tr>
<th>Count</th>
<td>{{ previously_owned_cpu.count }}</td>
</tr>
<tr>
<th>Usable</th>
<td>{{ previously_owned_cpu.usable ? 'Yes' : 'No' }}</td>
</tr>
<tr>
<th>Received</th>
<td>{{ previously_owned_cpu.received ? 'Yes' : 'No' }}</td>
</tr>
<tr>
<th>Link</th>
<td>{{ previously_owned_cpu.link }}</td>
</tr>
<tr>
<th>Notes</th>
<td>{{ previously_owned_cpu.notes }}</td>
</tr>
</tbody>
</table>
</div>
{% endblock %}