Reformat files

This commit is contained in:
Timothy Warren 2023-07-21 10:35:15 -04:00
parent 80bb63fdd6
commit 0909a5e499
101 changed files with 2738 additions and 2836 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,13 +1,13 @@
<?php declare(strict_types=1);
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],
Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => TRUE],
Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => TRUE],
];

View File

@ -3,5 +3,5 @@
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->extension('framework', ['cache' => null]);
$containerConfigurator->extension('framework', ['cache' => NULL]);
};

View File

@ -5,9 +5,9 @@ declare(strict_types=1);
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services = $containerConfigurator->services();
$services->set('EasyCorp\EasyLog\EasyLogHandler')
->private()
->args(['%kernel.logs_dir%/%kernel.environment%.log']);
$services->set('EasyCorp\EasyLog\EasyLogHandler')
->private()
->args(['%kernel.logs_dir%/%kernel.environment%.log']);
};

View File

@ -3,15 +3,15 @@
use Symfony\Config\MonologConfig;
return static function (MonologConfig $config): void {
$config->handler('main', [
$config->handler('main', [
'type' => 'stream',
'path' => '%kernel.logs_dir%/%kernel.environment%.log',
'level' => 'debug',
'channels' => ['elements' => ['!event']]
'channels' => ['elements' => ['!event']],
]);
$config->handler('console', [
'type' => 'console',
'process_psr_3_messages' => false,
'channels' => ['elements' => ['!event', '!doctrine', '!console']]
'process_psr_3_messages' => FALSE,
'channels' => ['elements' => ['!event', '!doctrine', '!console']],
]);
};

View File

@ -5,5 +5,5 @@ declare(strict_types=1);
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->extension('framework', ['router' => ['strict_requirements' => true]]);
$containerConfigurator->extension('framework', ['router' => ['strict_requirements' => TRUE]]);
};

View File

@ -3,14 +3,14 @@
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->extension('web_profiler', [
'toolbar' => true,
'intercept_redirects' => false
$containerConfigurator->extension('web_profiler', [
'toolbar' => TRUE,
'intercept_redirects' => FALSE,
]);
$containerConfigurator->extension('framework', [
$containerConfigurator->extension('framework', [
'profiler' => [
'only_exceptions' => false
]
'only_exceptions' => FALSE,
],
]);
};

View File

@ -15,7 +15,7 @@ return static function (ContainerConfigurator $containerConfigurator): void {
'types' => ['money' => MoneyType::class],
'logging' => '%kernel.debug%',
'mapping_types' => ['bit' => 'boolean', 'money' => 'money'],
'url' => '%env(DATABASE_URL)%'
'url' => '%env(DATABASE_URL)%',
],
'orm' => [
'auto_generate_proxy_classes' => '%kernel.debug%',
@ -27,8 +27,8 @@ return static function (ContainerConfigurator $containerConfigurator): void {
'type' => 'attribute',
'dir' => '%kernel.project_dir%/src/Entity',
'prefix' => 'App\Entity',
'alias' => 'App']
]
]
'alias' => 'App'],
],
],
]);
};

View File

@ -4,5 +4,5 @@ use Symfony\Config\DoctrineMigrationsConfig;
return static function (DoctrineMigrationsConfig $doctrineMigrations): void {
$doctrineMigrations->migrationsPath('App\\Migrations', '%kernel.project_dir%/src/Migrations')
->checkDatabasePlatform(true);
->checkDatabasePlatform(TRUE);
};

View File

@ -2,15 +2,14 @@
declare(strict_types=1);
use Symfony\Config\FrameworkConfig;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symfony\Config\FrameworkConfig;
return static function (ContainerConfigurator $containerConfigurator, FrameworkConfig $config): void {
$config->session(['handler_id' => null]);
$config->session(['handler_id' => NULL]);
$config->secret('%env(APP_SECRET)%')
->defaultLocale('en')
->httpMethodOverride(true)
->phpErrors(['log' => true])
;
->httpMethodOverride(TRUE)
->phpErrors(['log' => TRUE]);
};

View File

@ -4,43 +4,43 @@ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigura
use function Symfony\Component\DependencyInjection\Loader\Configurator\service;
return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->extension('doctrine', [
$containerConfigurator->extension('doctrine', [
'orm' => [
'metadata_cache_driver' => [
'type' => 'service',
'id' => 'doctrine.system_cache_provider'
'id' => 'doctrine.system_cache_provider',
],
'query_cache_driver' => [
'type' => 'service',
'id' => 'doctrine.system_cache_provider'
'id' => 'doctrine.system_cache_provider',
],
'result_cache_driver' => [
'type' => 'service',
'id' => 'doctrine.result_cache_provider'
]
]
'id' => 'doctrine.result_cache_provider',
],
],
]);
$services = $containerConfigurator->services();
$services = $containerConfigurator->services();
$services->set('doctrine.result_cache_provider', 'Symfony\Component\Cache\DoctrineProvider')
->private()
->args([service('doctrine.result_cache_pool')]);
$services->set('doctrine.result_cache_provider', 'Symfony\Component\Cache\DoctrineProvider')
->private()
->args([service('doctrine.result_cache_pool')]);
$services->set('doctrine.system_cache_provider', 'Symfony\Component\Cache\DoctrineProvider')
->private()
->args([service('doctrine.system_cache_pool')]);
$services->set('doctrine.system_cache_provider', 'Symfony\Component\Cache\DoctrineProvider')
->private()
->args([service('doctrine.system_cache_pool')]);
$containerConfigurator->extension('framework', [
$containerConfigurator->extension('framework', [
'cache' => [
'pools' => [
'doctrine.result_cache_pool' => [
'adapter' => 'cache.app'
'adapter' => 'cache.app',
],
'doctrine.system_cache_pool' => [
'adapter' => 'cache.system'
]
]
]
'adapter' => 'cache.system',
],
],
],
]);
};

View File

@ -3,24 +3,24 @@
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->extension('monolog', [
$containerConfigurator->extension('monolog', [
'handlers' => [
'main' => [
'type' => 'fingers_crossed',
'action_level' => 'error',
'handler' => 'nested',
'excluded_404s' => ['^/']
'excluded_404s' => ['^/'],
],
'nested' => [
'type' => 'stream',
'path' => '%kernel.logs_dir%/%kernel.environment%.log',
'level' => 'debug'
'level' => 'debug',
],
'console' => [
'type' => 'console',
'process_psr_3_messages' => false,
'channels' => ['!event', '!doctrine']
]
]
'process_psr_3_messages' => FALSE,
'channels' => ['!event', '!doctrine'],
],
],
]);
};

View File

@ -3,7 +3,7 @@
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->extension('framework', [
'router' => ['strict_requirements' => null]
$containerConfigurator->extension('framework', [
'router' => ['strict_requirements' => NULL],
]);
};

View File

@ -3,10 +3,10 @@
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->extension('framework', [
$containerConfigurator->extension('framework', [
'router' => [
'strict_requirements' => null,
'utf8' => true
]
'strict_requirements' => NULL,
'utf8' => TRUE,
],
]);
};

View File

@ -1,36 +1,36 @@
<?php declare(strict_types=1);
use Symfony\Config\SecurityConfig;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
use Symfony\Config\SecurityConfig;
return static function (ContainerConfigurator $containerConfigurator, SecurityConfig $security): void {
$security->passwordHasher(PasswordAuthenticatedUserInterface::class, 'auto')
;
$security->passwordHasher(PasswordAuthenticatedUserInterface::class, 'auto');
$containerConfigurator->extension('security', [
'providers' => [
'users_in_memory' => [
'memory' => null]
'memory' => NULL],
],
'firewalls' => [
'dev' => [
'pattern' => '^/(_(profiler|wdt)|css|images|js)/',
'security' => false
'security' => FALSE,
],
'main' => [
'lazy' => true,
'provider' => 'users_in_memory'
]
'lazy' => TRUE,
'provider' => 'users_in_memory',
],
],
'access_control' => null
'access_control' => NULL,
]);
if ($containerConfigurator->env() === 'test') {
if ($containerConfigurator->env() === 'test')
{
$security->passwordHasher(PasswordAuthenticatedUserInterface::class, [
'algorithm' => 'auto',
'cost' => 4,
'time_cost' => 3,
'memory_cost' => 10
'memory_cost' => 10,
]);
}
}
};

View File

@ -3,7 +3,7 @@
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->extension('sensio_framework_extra', [
'router' => ['annotations' => false]
$containerConfigurator->extension('sensio_framework_extra', [
'router' => ['annotations' => FALSE],
]);
};

View File

@ -5,5 +5,5 @@ declare(strict_types=1);
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->extension('framework', ['test' => null]);
$containerConfigurator->extension('framework', ['test' => NULL]);
};

View File

@ -5,5 +5,5 @@ declare(strict_types=1);
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->extension('monolog', ['handlers' => ['main' => ['type' => 'stream', 'path' => '%kernel.logs_dir%/%kernel.environment%.log', 'level' => 'debug', 'channels' => ['!event']]]]);
$containerConfigurator->extension('monolog', ['handlers' => ['main' => ['type' => 'stream', 'path' => '%kernel.logs_dir%/%kernel.environment%.log', 'level' => 'debug', 'channels' => ['!event']]]]);
};

View File

@ -5,5 +5,5 @@ declare(strict_types=1);
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->extension('twig', ['strict_variables' => true]);
$containerConfigurator->extension('twig', ['strict_variables' => TRUE]);
};

View File

@ -5,5 +5,5 @@ declare(strict_types=1);
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->extension('framework', ['validation' => ['not_compromised_password' => false]]);
$containerConfigurator->extension('framework', ['validation' => ['not_compromised_password' => FALSE]]);
};

View File

@ -5,7 +5,7 @@ declare(strict_types=1);
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->extension('web_profiler', ['toolbar' => false, 'intercept_redirects' => false]);
$containerConfigurator->extension('web_profiler', ['toolbar' => FALSE, 'intercept_redirects' => FALSE]);
$containerConfigurator->extension('framework', ['profiler' => ['collect' => false]]);
$containerConfigurator->extension('framework', ['profiler' => ['collect' => FALSE]]);
};

View File

@ -3,11 +3,11 @@
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->extension('framework', [
$containerConfigurator->extension('framework', [
'default_locale' => 'en',
'translator' => [
'default_path' => '%kernel.project_dir%/translations',
'fallbacks' => ['%locale%']
]
'fallbacks' => ['%locale%'],
],
]);
};

View File

@ -6,6 +6,5 @@ return static function (TwigConfig $config): void {
$config->formThemes(['form_custom_layout.html.twig'])
->defaultPath('%kernel.project_dir%/templates')
->debug('%kernel.debug%')
->strictVariables('%kernel.debug%')
;
->strictVariables('%kernel.debug%');
};

View File

@ -3,5 +3,5 @@
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->extension('framework', ['validation' => ['email_validation_mode' => 'html5']]);
$containerConfigurator->extension('framework', ['validation' => ['email_validation_mode' => 'html5']]);
};

View File

@ -1,5 +1,6 @@
<?php declare(strict_types=1);
if (file_exists(dirname(__DIR__) . '/var/cache/prod/App_KernelProdContainer.preload.php')) {
require dirname(__DIR__) . '/var/cache/prod/App_KernelProdContainer.preload.php';
if (file_exists(dirname(__DIR__) . '/var/cache/prod/App_KernelProdContainer.preload.php'))
{
require dirname(__DIR__) . '/var/cache/prod/App_KernelProdContainer.preload.php';
}

View File

@ -3,5 +3,5 @@
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
return static function (RoutingConfigurator $routingConfigurator): void {
$routingConfigurator->import('../../src/Controller/', 'annotation');
$routingConfigurator->import('../../src/Controller/', 'annotation');
};

View File

@ -3,6 +3,6 @@
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
return static function (RoutingConfigurator $routingConfigurator): void {
$routingConfigurator->import('@FrameworkBundle/Resources/config/routing/errors.xml')
->prefix('/_error');
$routingConfigurator->import('@FrameworkBundle/Resources/config/routing/errors.xml')
->prefix('/_error');
};

View File

@ -3,9 +3,9 @@
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
return static function (RoutingConfigurator $routingConfigurator): void {
$routingConfigurator->import('@WebProfilerBundle/Resources/config/routing/wdt.xml')
->prefix('/_wdt');
$routingConfigurator->import('@WebProfilerBundle/Resources/config/routing/wdt.xml')
->prefix('/_wdt');
$routingConfigurator->import('@WebProfilerBundle/Resources/config/routing/profiler.xml')
->prefix('/_profiler');
$routingConfigurator->import('@WebProfilerBundle/Resources/config/routing/profiler.xml')
->prefix('/_profiler');
};

View File

@ -4,7 +4,7 @@ namespace Symfony\Component\DependencyInjection\Loader\Configurator;
use App\Maker\MakeCollectionCrud;
return function (ContainerConfigurator $configurator): void {
return static function (ContainerConfigurator $configurator): void {
$parameters = $configurator->parameters();
$parameters->set('locale', 'en');

View File

@ -11,18 +11,21 @@ require dirname(__DIR__) . '/vendor/autoload.php';
(new Dotenv())->bootEnv(dirname(__DIR__) . '/.env');
if ($_SERVER['APP_DEBUG']) {
umask(0000);
if ($_SERVER['APP_DEBUG'])
{
umask(0000);
Debug::enable();
Debug::enable();
}
if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? FALSE) {
Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST);
if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? FALSE)
{
Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST);
}
if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? FALSE) {
Request::setTrustedHosts([$trustedHosts]);
if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? FALSE)
{
Request::setTrustedHosts([$trustedHosts]);
}
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);

View File

@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
namespace App\Controller;
@ -6,13 +6,11 @@ use App\Entity\BrandCategory;
use App\Form\BrandCategoryType;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\{Request, Response};
use Symfony\Component\Routing\Annotation\Route;
#[Route('/brand/category')]
class BrandCategoryController extends AbstractController
{
class BrandCategoryController extends AbstractController {
use FormControllerBase;
protected const ENTITY = BrandCategory::class;
@ -24,33 +22,33 @@ class BrandCategoryController extends AbstractController
{
}
#[Route('/', name: 'brand-category_index', methods: ['GET'])]
public function index(): Response
{
#[Route('/', name: 'brand-category_index', methods: ['GET'])]
public function index(): Response
{
return $this->indexView('brand_categories');
}
}
#[Route('/new', name: 'brand-category_new', methods: ['GET', 'POST'])]
public function new(Request $request, EntityManagerInterface $entityManager): Response
{
#[Route('/new', name: 'brand-category_new', methods: ['GET', 'POST'])]
public function new(Request $request, EntityManagerInterface $entityManager): Response
{
return $this->itemCreate($request, 'brand_category');
}
}
#[Route('/{name}', name: 'brand-category_show', methods: ['GET'])]
public function show(BrandCategory $brandCategory): Response
{
#[Route('/{name}', name: 'brand-category_show', methods: ['GET'])]
public function show(BrandCategory $brandCategory): Response
{
return $this->itemView($brandCategory, 'brand_category');
}
}
#[Route('/{name}/edit', name: 'brand-category_edit', methods: ['GET', 'POST'])]
public function edit(Request $request, BrandCategory $brandCategory): Response
{
#[Route('/{name}/edit', name: 'brand-category_edit', methods: ['GET', 'POST'])]
public function edit(Request $request, BrandCategory $brandCategory): Response
{
return $this->itemUpdate($request, $brandCategory, 'brand_category');
}
}
#[Route('/{name}', name: 'brand-category_delete', methods: ['POST'])]
public function delete(Request $request, BrandCategory $brandCategory): Response
{
#[Route('/{name}', name: 'brand-category_delete', methods: ['POST'])]
public function delete(Request $request, BrandCategory $brandCategory): Response
{
return $this->deleteCSRF($request, $brandCategory);
}
}
}

View File

@ -10,48 +10,47 @@ use Symfony\Component\HttpFoundation\{Request, Response};
use Symfony\Component\Routing\Annotation\Route;
#[Route('/brand')]
class BrandController extends AbstractController
{
use FormControllerBase;
class BrandController extends AbstractController {
use FormControllerBase;
protected const ENTITY = Brand::class;
protected const TEMPLATE_PATH = 'brand/';
protected const ROUTE_PREFIX = 'brand_';
protected const FORM = BrandType::class;
protected const ENTITY = Brand::class;
protected const TEMPLATE_PATH = 'brand/';
protected const ROUTE_PREFIX = 'brand_';
protected const FORM = BrandType::class;
public function __construct(private readonly EntityManagerInterface $entityManager)
{
}
public function __construct(private readonly EntityManagerInterface $entityManager)
{
}
#[Route('/', name: 'brand_index', methods: ['GET'])]
public function index(): Response
{
return $this->itemListView('brands', [
'name' => 'asc',
]);
}
#[Route('/', name: 'brand_index', methods: ['GET'])]
public function index(): Response
{
return $this->itemListView('brands', [
'name' => 'asc',
]);
}
#[Route('/new', name: 'brand_new', methods: ['GET', 'POST'])]
public function new(Request $request): Response
{
return $this->itemCreate($request, 'brand');
}
#[Route('/new', name: 'brand_new', methods: ['GET', 'POST'])]
public function new(Request $request): Response
{
return $this->itemCreate($request, 'brand');
}
#[Route('/{id}', name: 'brand_show', methods: ['GET'])]
public function show(Brand $brand): Response
{
return $this->itemView($brand, 'brand');
}
#[Route('/{id}', name: 'brand_show', methods: ['GET'])]
public function show(Brand $brand): Response
{
return $this->itemView($brand, 'brand');
}
#[Route('/{id}/edit', name: 'brand_edit', methods: ['GET', 'POST'])]
public function edit(Request $request, Brand $brand): Response
{
return $this->itemUpdate($request, $brand, 'brand');
}
#[Route('/{id}/edit', name: 'brand_edit', methods: ['GET', 'POST'])]
public function edit(Request $request, Brand $brand): Response
{
return $this->itemUpdate($request, $brand, 'brand');
}
#[Route('/{id}', name: 'brand_delete', methods: ['POST'])]
public function delete(Request $request, Brand $brand): Response
{
return $this->deleteCSRF($request, $brand);
}
#[Route('/{id}', name: 'brand_delete', methods: ['POST'])]
public function delete(Request $request, Brand $brand): Response
{
return $this->deleteCSRF($request, $brand);
}
}

View File

@ -2,10 +2,10 @@
namespace App\Controller;
use App\Entity\Camera;
use App\Form\CameraType;
use App\Controller\
{DeleteFormTrait};
use App\Entity\Camera;
use App\Form\CameraType;
use Doctrine\ORM\{EntityManagerInterface, ORMInvalidArgumentException};
use LogicException;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
@ -17,120 +17,119 @@ use Symfony\Component\Routing\Annotation\Route;
* Camera controller.
*/
#[Route(path: 'camera')]
class CameraController extends AbstractController
{
use FormControllerBase;
use DeleteFormTrait;
class CameraController extends AbstractController {
use FormControllerBase;
use DeleteFormTrait;
protected const ENTITY = Camera::class;
protected const TEMPLATE_PATH = 'camera/';
protected const ROUTE_PREFIX = 'camera_';
protected const FORM = CameraType::class;
protected const ENTITY = Camera::class;
protected const TEMPLATE_PATH = 'camera/';
protected const ROUTE_PREFIX = 'camera_';
protected const FORM = CameraType::class;
public function __construct(private readonly EntityManagerInterface $entityManager)
{
}
public function __construct(private readonly EntityManagerInterface $entityManager)
{
}
/**
* Lists all camera entities.
*/
#[Route(path: '/', name: 'camera_index', methods: ['GET'])]
public function indexAction(): Response
{
$receivedItems = $this->entityManager->getRepository(self::ENTITY)->findBy([
'received' => TRUE,
], [
'isWorking' => 'ASC',
'brand' => 'ASC',
'mount' => 'ASC',
'model' => 'ASC',
]);
$newItems = $this->entityManager->getRepository(self::ENTITY)->findBy([
'received' => FALSE,
], [
'brand' => 'ASC',
'mount' => 'ASC',
'model' => 'ASC',
]);
$working = array_filter($receivedItems, [$this, 'isWorking']);
$notWorking = array_filter($receivedItems, [$this, 'isNotWorking']);
/**
* Lists all camera entities.
*/
#[Route(path: '/', name: 'camera_index', methods: ['GET'])]
public function indexAction(): Response
{
$receivedItems = $this->entityManager->getRepository(self::ENTITY)->findBy([
'received' => TRUE,
], [
'isWorking' => 'ASC',
'brand' => 'ASC',
'mount' => 'ASC',
'model' => 'ASC',
]);
$newItems = $this->entityManager->getRepository(self::ENTITY)->findBy([
'received' => FALSE,
], [
'brand' => 'ASC',
'mount' => 'ASC',
'model' => 'ASC',
]);
$working = array_filter($receivedItems, [$this, 'isWorking']);
$notWorking = array_filter($receivedItems, [$this, 'isNotWorking']);
return $this->render('camera/index.html.twig', [
'not_received' => $newItems,
'not_working' => $notWorking,
'working' => $working,
]);
}
return $this->render('camera/index.html.twig', [
'not_received' => $newItems,
'not_working' => $notWorking,
'working' => $working,
]);
}
/**
* Creates a new camera entity.
*/
#[Route(path: '/new', name: 'camera_new', methods: ['GET', 'POST'])]
public function newAction(Request $request): RedirectResponse|Response
{
return $this->itemCreate($request, 'camera');
}
/**
* Creates a new camera entity.
*/
#[Route(path: '/new', name: 'camera_new', methods: ['GET', 'POST'])]
public function newAction(Request $request): RedirectResponse|Response
{
return $this->itemCreate($request, 'camera');
}
/**
* Finds and displays a camera entity.
*/
#[Route(path: '/{id}', name: 'camera_show', methods: ['GET'])]
public function showAction(Camera $camera): Response
{
return $this->itemView($camera, 'camera');
}
/**
* Finds and displays a camera entity.
*/
#[Route(path: '/{id}', name: 'camera_show', methods: ['GET'])]
public function showAction(Camera $camera): Response
{
return $this->itemView($camera, 'camera');
}
/**
* Displays a form to edit an existing camera entity.
*
* @throws LogicException
*/
#[Route(path: '/{id}/edit', name: 'camera_edit', methods: ['GET', 'POST'])]
public function editAction(Request $request, Camera $camera): RedirectResponse|Response
{
return $this->itemUpdate($request, $camera, 'camera');
}
/**
* Displays a form to edit an existing camera entity.
*
* @throws LogicException
*/
#[Route(path: '/{id}/edit', name: 'camera_edit', methods: ['GET', 'POST'])]
public function editAction(Request $request, Camera $camera): RedirectResponse|Response
{
return $this->itemUpdate($request, $camera, 'camera');
}
/**
* Deletes a camera entity.
*
* @throws LogicException
*/
#[Route(path: '/{id}', name: 'camera_delete', methods: ['POST', 'DELETE'])]
public function deleteAction(Request $request, Camera $camera): RedirectResponse
{
return $this->itemDelete($request, $camera);
}
/**
* Deletes a camera entity.
*
* @throws LogicException
*/
#[Route(path: '/{id}', name: 'camera_delete', methods: ['POST', 'DELETE'])]
public function deleteAction(Request $request, Camera $camera): RedirectResponse
{
return $this->itemDelete($request, $camera);
}
/**
* Moves a camera to the previouslyOwned table
*
* @throws LogicException
* @throws ORMInvalidArgumentException
*/
#[Route(path: '/{id}/deacquire', name: 'camera_deacquire', methods: ['POST'])]
public function deacquireAction(Request $request, Camera $camera): RedirectResponse
{
return $this->itemDeacquire($request, $camera, 'previously-owned-camera_index');
}
/**
* Moves a camera to the previouslyOwned table
*
* @throws LogicException
* @throws ORMInvalidArgumentException
*/
#[Route(path: '/{id}/deacquire', name: 'camera_deacquire', methods: ['POST'])]
public function deacquireAction(Request $request, Camera $camera): RedirectResponse
{
return $this->itemDeacquire($request, $camera, 'previously-owned-camera_index');
}
/**
* Creates a form to move
*
* @param Camera $camera The camera entity
*/
private function createDeacquireForm(Camera $camera): FormInterface
{
return $this->buildForm($camera, 'camera_deacquire');
}
/**
* Creates a form to move
*
* @param Camera $camera The camera entity
*/
private function createDeacquireForm(Camera $camera): FormInterface
{
return $this->buildForm($camera, 'camera_deacquire');
}
private function isWorking(Camera $camera): bool
{
return $camera->getIsWorking();
}
private function isWorking(Camera $camera): bool
{
return $camera->getIsWorking();
}
private function isNotWorking(Camera $camera): bool
{
return ! $this->isWorking($camera);
}
private function isNotWorking(Camera $camera): bool
{
return ! $this->isWorking($camera);
}
}

View File

@ -2,74 +2,73 @@
namespace App\Controller;
use App\Entity\CameraType;
use App\Form\CameraTypeType;
use App\Controller\
{DeleteFormTrait};
use App\Entity\CameraType;
use App\Form\CameraTypeType;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\{RedirectResponse, Request, Response};
use Symfony\Component\Routing\Annotation\Route;
#[Route(path: 'camera-type')]
class CameraTypeController extends AbstractController
{
use FormControllerBase;
use DeleteFormTrait;
class CameraTypeController extends AbstractController {
use FormControllerBase;
use DeleteFormTrait;
protected const ENTITY = CameraType::class;
protected const TEMPLATE_PATH = 'cameratype/';
protected const ROUTE_PREFIX = 'camera-type_';
protected const FORM = CameraTypeType::class;
protected const ENTITY = CameraType::class;
protected const TEMPLATE_PATH = 'cameratype/';
protected const ROUTE_PREFIX = 'camera-type_';
protected const FORM = CameraTypeType::class;
public function __construct(private readonly EntityManagerInterface $entityManager)
{
}
public function __construct(private readonly EntityManagerInterface $entityManager)
{
}
/**
* Lists all cameraType entities.
*/
#[Route(path: '/', name: 'camera-type_index', methods: ['GET'])]
public function indexAction(): Response
{
return $this->itemListView('cameraTypes', [
'type' => 'ASC',
]);
}
/**
* Lists all cameraType entities.
*/
#[Route(path: '/', name: 'camera-type_index', methods: ['GET'])]
public function indexAction(): Response
{
return $this->itemListView('cameraTypes', [
'type' => 'ASC',
]);
}
/**
* Creates a new cameraType entity.
*/
#[Route(path: '/new', name: 'camera-type_new', methods: ['GET', 'POST'])]
public function newAction(Request $request): Response
{
return $this->itemCreate($request, 'cameraType');
}
/**
* Creates a new cameraType entity.
*/
#[Route(path: '/new', name: 'camera-type_new', methods: ['GET', 'POST'])]
public function newAction(Request $request): Response
{
return $this->itemCreate($request, 'cameraType');
}
/**
* Finds and displays a cameraType entity.
*/
#[Route(path: '/{id}', name: 'camera-type_show', methods: ['GET'])]
public function showAction(CameraType $cameraType): Response
{
return $this->itemView($cameraType, 'cameraType');
}
/**
* Finds and displays a cameraType entity.
*/
#[Route(path: '/{id}', name: 'camera-type_show', methods: ['GET'])]
public function showAction(CameraType $cameraType): Response
{
return $this->itemView($cameraType, 'cameraType');
}
/**
* Displays a form to edit an existing cameraType entity.
*/
#[Route(path: '/{id}/edit', name: 'camera-type_edit', methods: ['GET', 'POST'])]
public function editAction(Request $request, CameraType $cameraType): RedirectResponse|Response
{
return $this->itemUpdate($request, $cameraType, 'cameraType');
}
/**
* Displays a form to edit an existing cameraType entity.
*/
#[Route(path: '/{id}/edit', name: 'camera-type_edit', methods: ['GET', 'POST'])]
public function editAction(Request $request, CameraType $cameraType): RedirectResponse|Response
{
return $this->itemUpdate($request, $cameraType, 'cameraType');
}
/**
* Deletes a cameraType entity.
*/
#[Route(path: '/{id}', name: 'camera-type_delete', methods: ['POST', 'DELETE'])]
public function deleteAction(Request $request, CameraType $cameraType): RedirectResponse
{
return $this->itemDelete($request, $cameraType);
}
/**
* Deletes a cameraType entity.
*/
#[Route(path: '/{id}', name: 'camera-type_delete', methods: ['POST', 'DELETE'])]
public function deleteAction(Request $request, CameraType $cameraType): RedirectResponse
{
return $this->itemDelete($request, $cameraType);
}
}

View File

@ -6,8 +6,7 @@ use App\Entity\Chipset;
use App\Form\ChipsetType;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\{Request, Response};
use Symfony\Component\Routing\Annotation\Route;
#[Route('/chipset')]

View File

@ -6,8 +6,7 @@ use App\Entity\Cpu;
use App\Form\CpuType;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\{Request, Response};
use Symfony\Component\Routing\Annotation\Route;
#[Route('/cpu')]
@ -35,8 +34,8 @@ class CpuController extends AbstractController {
$amd = array_filter($items, static fn (Cpu $cpu) => $cpu->getBrand()->getName() === 'AMD' && $cpu->isReceived());
$intel = array_filter($items, static fn (Cpu $cpu) => $cpu->getBrand()->getName() === 'Intel' && $cpu->isReceived());
$others = array_filter($items, static fn (Cpu $cpu) => ( ! in_array($cpu->getBrand()->getName(), ['AMD','Intel'])) && $cpu->isReceived());
$notReceived = array_filter($items, static fn(CPU $cpu) => $cpu->isReceived() === FALSE);
$others = array_filter($items, static fn (Cpu $cpu) => ( ! in_array($cpu->getBrand()->getName(), ['AMD', 'Intel'], TRUE)) && $cpu->isReceived());
$notReceived = array_filter($items, static fn (CPU $cpu) => $cpu->isReceived() === FALSE);
return $this->render($template, [
'all' => [

View File

@ -6,14 +6,13 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\{Request, Response};
use Symfony\Component\Routing\Annotation\Route;
class DefaultController extends AbstractController
{
#[Route(path: '/', name: 'homepage')]
public function indexAction(Request $request): Response
{
// replace this example code with whatever you need
return $this->render('default/index.html.twig', [
'base_dir' => realpath($this->getParameter('kernel.project_dir')) . DIRECTORY_SEPARATOR,
]);
}
class DefaultController extends AbstractController {
#[Route(path: '/', name: 'homepage')]
public function indexAction(Request $request): Response
{
// replace this example code with whatever you need
return $this->render('default/index.html.twig', [
'base_dir' => realpath($this->getParameter('kernel.project_dir')) . DIRECTORY_SEPARATOR,
]);
}
}

View File

@ -4,13 +4,12 @@ namespace App\Controller;
use Symfony\Component\Form\FormInterface;
trait DeleteFormTrait
{
/**
* Creates a form to delete an entity.
*/
private function createDeleteForm(mixed $item): FormInterface
{
return $this->buildForm($item, self::ROUTE_PREFIX . 'delete', 'DELETE');
}
trait DeleteFormTrait {
/**
* Creates a form to delete an entity.
*/
private function createDeleteForm(mixed $item): FormInterface
{
return $this->buildForm($item, self::ROUTE_PREFIX . 'delete', 'DELETE');
}
}

View File

@ -4,8 +4,6 @@ namespace App\Controller;
use App\Entity\Film;
use App\Form\FilmType;
use App\Controller\
{DeleteFormTrait};
use Doctrine\Common\Collections\Criteria;
use Doctrine\ORM\EntityManagerInterface;
use LogicException;
@ -17,87 +15,86 @@ use Symfony\Component\Routing\Annotation\Route;
* Film controller.
*/
#[Route(path: 'film')]
class FilmController extends AbstractController
{
use FormControllerBase;
use DeleteFormTrait;
class FilmController extends AbstractController {
use FormControllerBase;
use DeleteFormTrait;
protected const ENTITY = Film::class;
protected const TEMPLATE_PATH = 'film/';
protected const ROUTE_PREFIX = 'film_';
protected const FORM = FilmType::class;
protected const ENTITY = Film::class;
protected const TEMPLATE_PATH = 'film/';
protected const ROUTE_PREFIX = 'film_';
protected const FORM = FilmType::class;
public function __construct(private readonly EntityManagerInterface $entityManager)
{
}
public function __construct(private readonly EntityManagerInterface $entityManager)
{
}
/**
* Lists all film entities.
*/
#[Route(path: '/', name: 'film_index', methods: ['GET'])]
public function indexAction(): Response
{
$repo = $this->entityManager->getRepository(self::ENTITY);
$criteria = Criteria::create()
->where(Criteria::expr()->gt('rollsInCamera', 0))
->orderBy([
'filmFormat' => Criteria::ASC,
'brand' => Criteria::ASC,
'rollsInCamera' => Criteria::DESC,
'productLine' => Criteria::ASC,
]);
$inCamera = $repo->matching($criteria);
$notInCamera = $repo->findBy([
'rollsInCamera' => 0,
], [
'brand' => 'ASC',
'productLine' => 'ASC',
'filmFormat' => 'ASC',
]);
/**
* Lists all film entities.
*/
#[Route(path: '/', name: 'film_index', methods: ['GET'])]
public function indexAction(): Response
{
$repo = $this->entityManager->getRepository(self::ENTITY);
$criteria = Criteria::create()
->where(Criteria::expr()->gt('rollsInCamera', 0))
->orderBy([
'filmFormat' => Criteria::ASC,
'brand' => Criteria::ASC,
'rollsInCamera' => Criteria::DESC,
'productLine' => Criteria::ASC,
]);
$inCamera = $repo->matching($criteria);
$notInCamera = $repo->findBy([
'rollsInCamera' => 0,
], [
'brand' => 'ASC',
'productLine' => 'ASC',
'filmFormat' => 'ASC',
]);
return $this->render('film/index.html.twig', [
'in_camera' => $inCamera,
'films' => $notInCamera,
]);
}
return $this->render('film/index.html.twig', [
'in_camera' => $inCamera,
'films' => $notInCamera,
]);
}
/**
* Creates a new film entity.
*/
#[Route(path: '/new', name: 'film_new', methods: ['GET', 'POST'])]
public function newAction(Request $request): RedirectResponse|Response
{
return $this->itemCreate($request, 'film');
}
/**
* Creates a new film entity.
*/
#[Route(path: '/new', name: 'film_new', methods: ['GET', 'POST'])]
public function newAction(Request $request): RedirectResponse|Response
{
return $this->itemCreate($request, 'film');
}
/**
* Finds and displays a film entity.
*/
#[Route(path: '/{id}', name: 'film_show', methods: ['GET'])]
public function showAction(Film $film): Response
{
return $this->itemView($film, 'film');
}
/**
* Finds and displays a film entity.
*/
#[Route(path: '/{id}', name: 'film_show', methods: ['GET'])]
public function showAction(Film $film): Response
{
return $this->itemView($film, 'film');
}
/**
* Displays a form to edit an existing film entity.
*
* @throws LogicException
*/
#[Route(path: '/{id}/edit', name: 'film_edit', methods: ['GET', 'POST'])]
public function editAction(Request $request, Film $film): RedirectResponse|Response
{
return $this->itemUpdate($request, $film, 'film');
}
/**
* Displays a form to edit an existing film entity.
*
* @throws LogicException
*/
#[Route(path: '/{id}/edit', name: 'film_edit', methods: ['GET', 'POST'])]
public function editAction(Request $request, Film $film): RedirectResponse|Response
{
return $this->itemUpdate($request, $film, 'film');
}
/**
* Deletes a film entity.
*
* @throws LogicException
*/
#[Route(path: '/{id}', name: 'film_delete', methods: ['POST', 'DELETE'])]
public function deleteAction(Request $request, Film $film): RedirectResponse
{
return $this->itemDelete($request, $film);
}
/**
* Deletes a film entity.
*
* @throws LogicException
*/
#[Route(path: '/{id}', name: 'film_delete', methods: ['POST', 'DELETE'])]
public function deleteAction(Request $request, Film $film): RedirectResponse
{
return $this->itemDelete($request, $film);
}
}

View File

@ -2,10 +2,10 @@
namespace App\Controller;
use App\Entity\Flash;
use App\Form\FlashType;
use App\Controller\
{DeleteFormTrait};
use App\Entity\Flash;
use App\Form\FlashType;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\{RedirectResponse, Request, Response};
@ -15,62 +15,61 @@ use Symfony\Component\Routing\Annotation\Route;
* Flash controller.
*/
#[Route(path: 'flash')]
class FlashController extends AbstractController
{
use FormControllerBase;
use DeleteFormTrait;
class FlashController extends AbstractController {
use FormControllerBase;
use DeleteFormTrait;
protected const ENTITY = Flash::class;
protected const TEMPLATE_PATH = 'flash/';
protected const ROUTE_PREFIX = 'flash_';
protected const FORM = FlashType::class;
protected const ENTITY = Flash::class;
protected const TEMPLATE_PATH = 'flash/';
protected const ROUTE_PREFIX = 'flash_';
protected const FORM = FlashType::class;
public function __construct(private readonly EntityManagerInterface $entityManager)
{
}
public function __construct(private readonly EntityManagerInterface $entityManager)
{
}
/**
* Lists all flash entities.
*/
#[Route(path: '/', name: 'flash_index', methods: ['GET'])]
public function indexAction(): Response
{
return $this->itemListView('flashes');
}
/**
* Lists all flash entities.
*/
#[Route(path: '/', name: 'flash_index', methods: ['GET'])]
public function indexAction(): Response
{
return $this->itemListView('flashes');
}
/**
* Creates a new flash entity.
*/
#[Route(path: '/new', name: 'flash_new', methods: ['GET', 'POST'])]
public function newAction(Request $request): RedirectResponse|Response
{
return $this->itemCreate($request, 'flash');
}
/**
* Creates a new flash entity.
*/
#[Route(path: '/new', name: 'flash_new', methods: ['GET', 'POST'])]
public function newAction(Request $request): RedirectResponse|Response
{
return $this->itemCreate($request, 'flash');
}
/**
* Finds and displays a flash entity.
*/
#[Route(path: '/{id}', name: 'flash_show', methods: ['GET'])]
public function showAction(Flash $flash): Response
{
return $this->itemView($flash, 'flash');
}
/**
* Finds and displays a flash entity.
*/
#[Route(path: '/{id}', name: 'flash_show', methods: ['GET'])]
public function showAction(Flash $flash): Response
{
return $this->itemView($flash, 'flash');
}
/**
* Displays a form to edit an existing flash entity.
*/
#[Route(path: '/{id}/edit', name: 'flash_edit', methods: ['GET', 'POST'])]
public function editAction(Request $request, Flash $flash): RedirectResponse|Response
{
return $this->itemUpdate($request, $flash, 'flash');
}
/**
* Displays a form to edit an existing flash entity.
*/
#[Route(path: '/{id}/edit', name: 'flash_edit', methods: ['GET', 'POST'])]
public function editAction(Request $request, Flash $flash): RedirectResponse|Response
{
return $this->itemUpdate($request, $flash, 'flash');
}
/**
* Deletes a flash entity.
*/
#[Route(path: '/{id}', name: 'flash_delete', methods: ['POST', 'DELETE'])]
public function deleteAction(Request $request, Flash $flash): RedirectResponse
{
return $this->itemDelete($request, $flash);
}
/**
* Deletes a flash entity.
*/
#[Route(path: '/{id}', name: 'flash_delete', methods: ['POST', 'DELETE'])]
public function deleteAction(Request $request, Flash $flash): RedirectResponse
{
return $this->itemDelete($request, $flash);
}
}

View File

@ -6,185 +6,191 @@ use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\{RedirectResponse, Request, Response};
trait FormControllerBase
{
trait FormControllerBase {
public function __construct(private readonly EntityManagerInterface $entityManager)
{
}
/**
* Create a form generator
*/
protected function buildForm(mixed $item, string $actionRoute, string $method = 'POST'): FormInterface
{
return $this->createFormBuilder()
->setAction($this->generateUrl($actionRoute, ['id' => $item->getId()]))
->setMethod($method)
->getForm();
}
/**
* Create a form generator
*/
protected function buildForm(mixed $item, string $actionRoute, string $method = 'POST'): FormInterface
{
return $this->createFormBuilder()
->setAction($this->generateUrl($actionRoute, ['id' => $item->getId()]))
->setMethod($method)
->getForm();
}
/**
* Show create form / create an item
*/
protected function itemCreate(Request $request, string $templateKey): RedirectResponse|Response
{
$template = self::TEMPLATE_PATH . 'new.html.twig';
$redirectRoute = self::ROUTE_PREFIX . 'show';
/**
* Show create form / create an item
*/
protected function itemCreate(Request $request, string $templateKey): RedirectResponse|Response
{
$template = self::TEMPLATE_PATH . 'new.html.twig';
$redirectRoute = self::ROUTE_PREFIX . 'show';
$Entity = self::ENTITY;
$item = new $Entity();
$form = $this->createForm(self::FORM, $item);
$form->handleRequest($request);
$Entity = self::ENTITY;
$item = new $Entity();
$form = $this->createForm(self::FORM, $item);
$form->handleRequest($request);
// If creating the item
if ($form->isSubmitted() && $form->isValid()) {
$this->entityManager->persist($item);
$this->entityManager->flush();
// If creating the item
if ($form->isSubmitted() && $form->isValid())
{
$this->entityManager->persist($item);
$this->entityManager->flush();
return $this->redirectToRoute($redirectRoute, ['id' => $item->getId()]);
}
return $this->redirectToRoute($redirectRoute, ['id' => $item->getId()]);
}
// If showing the form
return $this->render($template, [
$templateKey => $item,
'form' => $form->createView(),
]);
}
// If showing the form
return $this->render($template, [
$templateKey => $item,
'form' => $form->createView(),
]);
}
protected function indexView(string $templateKey, array $sort = []): Response
{
return $this->itemListView($templateKey, $sort);
}
protected function indexView(string $templateKey, array $sort = []): Response
{
return $this->itemListView($templateKey, $sort);
}
/**
* List view for the data type
*/
protected function itemListView(string $templateKey, array $sort = []): Response
{
$template = self::TEMPLATE_PATH . 'index.html.twig';
/**
* List view for the data type
*/
protected function itemListView(string $templateKey, array $sort = []): Response
{
$template = self::TEMPLATE_PATH . 'index.html.twig';
$items = $this->entityManager->getRepository(self::ENTITY)->findBy([], $sort);
$items = $this->entityManager->getRepository(self::ENTITY)->findBy([], $sort);
return $this->render($template, [
$templateKey => $items,
]);
}
return $this->render($template, [
$templateKey => $items,
]);
}
/**
* View details for a specific item
*/
protected function itemView(mixed $item, string $templateKey): Response
{
$template = self::TEMPLATE_PATH . 'show.html.twig';
/**
* View details for a specific item
*/
protected function itemView(mixed $item, string $templateKey): Response
{
$template = self::TEMPLATE_PATH . 'show.html.twig';
$templateData = [
$templateKey => $item,
];
$templateData = [
$templateKey => $item,
];
if (method_exists($this, 'createDeleteForm')) {
$deleteForm = $this->createDeleteForm($item);
$templateData['delete_form'] = $deleteForm->createView();
}
if (method_exists($this, 'createDeleteForm'))
{
$deleteForm = $this->createDeleteForm($item);
$templateData['delete_form'] = $deleteForm->createView();
}
return $this->render($template, $templateData);
}
return $this->render($template, $templateData);
}
/**
* Show edit form / update an item
*/
protected function itemUpdate(Request $request, mixed $item, string $templateKey): RedirectResponse|Response
{
$template = self::TEMPLATE_PATH . 'edit.html.twig';
$redirectRoute = self::ROUTE_PREFIX . 'show';
/**
* Show edit form / update an item
*/
protected function itemUpdate(Request $request, mixed $item, string $templateKey): RedirectResponse|Response
{
$template = self::TEMPLATE_PATH . 'edit.html.twig';
$redirectRoute = self::ROUTE_PREFIX . 'show';
$editForm = $this->createForm(self::FORM, $item);
$editForm->handleRequest($request);
$editForm = $this->createForm(self::FORM, $item);
$editForm->handleRequest($request);
// If updating the item
if ($editForm->isSubmitted() && $editForm->isValid()) {
$this->entityManager->persist($item);
$this->entityManager->flush();
// If updating the item
if ($editForm->isSubmitted() && $editForm->isValid())
{
$this->entityManager->persist($item);
$this->entityManager->flush();
return $this->redirectToRoute($redirectRoute, ['id' => $item->getId()]);
}
return $this->redirectToRoute($redirectRoute, ['id' => $item->getId()]);
}
// If showing the edit form
$templateData = [
$templateKey => $item,
'form' => $editForm->createView(),
];
// If showing the edit form
$templateData = [
$templateKey => $item,
'form' => $editForm->createView(),
];
if (method_exists($this, 'createDeleteForm')) {
$deleteForm = $this->createDeleteForm($item);
$templateData['delete_form'] = $deleteForm->createView();
}
if (method_exists($this, 'createDeleteForm'))
{
$deleteForm = $this->createDeleteForm($item);
$templateData['delete_form'] = $deleteForm->createView();
}
if (method_exists($this, 'createDeacquireForm')) {
$deacquireForm = $this->createDeacquireForm($item);
$templateData['deacquire_form'] = $deacquireForm->createView();
}
if (method_exists($this, 'createDeacquireForm'))
{
$deacquireForm = $this->createDeacquireForm($item);
$templateData['deacquire_form'] = $deacquireForm->createView();
}
if (method_exists($this, 'createReacquireForm')) {
$reacquireForm = $this->createReacquireForm($item);
$templateData['reacquire_form'] = $reacquireForm->createView();
}
if (method_exists($this, 'createReacquireForm'))
{
$reacquireForm = $this->createReacquireForm($item);
$templateData['reacquire_form'] = $reacquireForm->createView();
}
return $this->render($template, $templateData);
}
return $this->render($template, $templateData);
}
/**
* Move an item to a previously_owned table
*/
protected function itemDeacquire(Request $request, mixed $item, string $redirectRoute): RedirectResponse
{
$form = $this->createDeacquireForm($item);
$form->handleRequest($request);
/**
* Move an item to a previously_owned table
*/
protected function itemDeacquire(Request $request, mixed $item, string $redirectRoute): RedirectResponse
{
$form = $this->createDeacquireForm($item);
$form->handleRequest($request);
$repository = $this->entityManager->getRepository(self::ENTITY);
$repository->deacquire($item);
$repository = $this->entityManager->getRepository(self::ENTITY);
$repository->deacquire($item);
return $this->redirectToRoute($redirectRoute);
}
return $this->redirectToRoute($redirectRoute);
}
/**
* Move an item from a previously_owned table back to the original table
*/
protected function itemReacquire(Request $request, mixed $item, string $redirectRoute): RedirectResponse
{
$form = $this->createReacquireForm($item);
$form->handleRequest($request);
/**
* Move an item from a previously_owned table back to the original table
*/
protected function itemReacquire(Request $request, mixed $item, string $redirectRoute): RedirectResponse
{
$form = $this->createReacquireForm($item);
$form->handleRequest($request);
$repository = $this->entityManager->getRepository(self::ENTITY);
$repository->reacquire($item);
$repository = $this->entityManager->getRepository(self::ENTITY);
$repository->reacquire($item);
return $this->redirectToRoute($redirectRoute);
}
return $this->redirectToRoute($redirectRoute);
}
/**
* Actually delete an item
*/
protected function itemDelete(Request $request, mixed $item): RedirectResponse
{
$redirectRoute = self::ROUTE_PREFIX . 'index';
/**
* Actually delete an item
*/
protected function itemDelete(Request $request, mixed $item): RedirectResponse
{
$redirectRoute = self::ROUTE_PREFIX . 'index';
$form = $this->createDeleteForm($item);
$form->handleRequest($request);
$form = $this->createDeleteForm($item);
$form->handleRequest($request);
// if ($this->isCsrfTokenValid((string)$item->getId(), $request->request->get('_token'))) {
$this->entityManager->remove($item);
$this->entityManager->flush();
//}
// if ($this->isCsrfTokenValid((string)$item->getId(), $request->request->get('_token'))) {
$this->entityManager->remove($item);
$this->entityManager->flush();
//}
return $this->redirectToRoute($redirectRoute, [], Response::HTTP_SEE_OTHER);
}
return $this->redirectToRoute($redirectRoute, [], Response::HTTP_SEE_OTHER);
}
protected function deleteCSRF(Request $request, mixed $item): RedirectResponse
{
if ($this->isCsrfTokenValid('delete' . $item->getId(), $request->request->get('_token'))) {
$this->entityManager->remove($item);
$this->entityManager->flush();
}
protected function deleteCSRF(Request $request, mixed $item): RedirectResponse
{
if ($this->isCsrfTokenValid('delete' . $item->getId(), $request->request->get('_token')))
{
$this->entityManager->remove($item);
$this->entityManager->flush();
}
return $this->redirectToRoute(self::ROUTE_PREFIX . 'index', [], Response::HTTP_SEE_OTHER);
}
return $this->redirectToRoute(self::ROUTE_PREFIX . 'index', [], Response::HTTP_SEE_OTHER);
}
}

View File

@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
namespace App\Controller;
@ -6,13 +6,11 @@ use App\Entity\Fpu;
use App\Form\FpuType;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\{Request, Response};
use Symfony\Component\Routing\Annotation\Route;
#[Route('/fpu')]
class FpuController extends AbstractController
{
class FpuController extends AbstractController {
use FormControllerBase;
protected const ENTITY = Fpu::class;
@ -24,33 +22,33 @@ class FpuController extends AbstractController
{
}
#[Route('/', name: 'fpu_index', methods: ['GET'])]
public function index(): Response
{
#[Route('/', name: 'fpu_index', methods: ['GET'])]
public function index(): Response
{
return $this->indexView('fpus', []);
}
}
#[Route('/new', name: 'fpu_new', methods: ['GET', 'POST'])]
public function new(Request $request): Response
{
#[Route('/new', name: 'fpu_new', methods: ['GET', 'POST'])]
public function new(Request $request): Response
{
return $this->itemCreate($request, 'fpu');
}
}
#[Route('/{id}', name: 'fpu_show', methods: ['GET'])]
public function show(Fpu $fpu): Response
{
#[Route('/{id}', name: 'fpu_show', methods: ['GET'])]
public function show(Fpu $fpu): Response
{
return $this->itemView($fpu, 'fpu');
}
}
#[Route('/{id}/edit', name: 'fpu_edit', methods: ['GET', 'POST'])]
public function edit(Request $request, Fpu $fpu): Response
{
#[Route('/{id}/edit', name: 'fpu_edit', methods: ['GET', 'POST'])]
public function edit(Request $request, Fpu $fpu): Response
{
return $this->itemUpdate($request, $fpu, 'fpu');
}
}
#[Route('/{id}', name: 'fpu_delete', methods: ['POST'])]
public function delete(Request $request, Fpu $fpu): Response
{
#[Route('/{id}', name: 'fpu_delete', methods: ['POST'])]
public function delete(Request $request, Fpu $fpu): Response
{
return $this->deleteCSRF($request, $fpu);
}
}
}

View File

@ -11,27 +11,26 @@ use Symfony\Component\HttpFoundation\{Request, Response};
use Symfony\Component\Routing\Annotation\Route;
#[Route('/gpu')]
class GpuController extends AbstractController
{
use FormControllerBase;
class GpuController extends AbstractController {
use FormControllerBase;
protected const ENTITY = Gpu::class;
protected const TEMPLATE_PATH = 'gpu/';
protected const ROUTE_PREFIX = 'gpu_';
protected const FORM = GpuType::class;
protected const ENTITY = Gpu::class;
protected const TEMPLATE_PATH = 'gpu/';
protected const ROUTE_PREFIX = 'gpu_';
protected const FORM = GpuType::class;
public function __construct(private readonly EntityManagerInterface $entityManager)
{
}
public function __construct(private readonly EntityManagerInterface $entityManager)
{
}
#[Route('/', name: 'gpu_index', methods: ['GET'])]
public function index(): Response
{
#[Route('/', name: 'gpu_index', methods: ['GET'])]
public function index(): Response
{
$items = $this->entityManager->getRepository(self::ENTITY)->findAll();
$acquiredItems = array_filter($items, fn (Gpu $item) => $item->isAcquired());
$newItems = array_filter($items, fn ($item) => !$item->isAcquired());
$acquiredItems = array_filter($items, static fn (Gpu $item) => $item->isAcquired());
$newItems = array_filter($items, static fn ($item) => ! $item->isAcquired());
$filter = fn (array $itemTypes) => array_filter($acquiredItems, fn (Gpu $item) => in_array($item->getCardKey(), $itemTypes));
$filter = static fn (array $itemTypes) => array_filter($acquiredItems, static fn (Gpu $item) => in_array($item->getCardKey(), $itemTypes, TRUE));
$cardTypes = SlotKey::getGroups();
$pcieCardTypes = $cardTypes['PCI Express'];
@ -47,31 +46,31 @@ class GpuController extends AbstractController
'agp' => $filter($agpCardTypes),
'pci' => $filter($pciCardTypes),
'isa' => $filter($isaCardTypes),
]
],
]);
}
}
#[Route('/new', name: 'gpu_new', methods: ['GET', 'POST'])]
public function new(Request $request): Response
{
return $this->itemCreate($request, 'gpu');
}
#[Route('/new', name: 'gpu_new', methods: ['GET', 'POST'])]
public function new(Request $request): Response
{
return $this->itemCreate($request, 'gpu');
}
#[Route('/{id}', name: 'gpu_show', methods: ['GET'])]
public function show(Gpu $gpu): Response
{
return $this->itemView($gpu, 'gpu');
}
#[Route('/{id}', name: 'gpu_show', methods: ['GET'])]
public function show(Gpu $gpu): Response
{
return $this->itemView($gpu, 'gpu');
}
#[Route('/{id}/edit', name: 'gpu_edit', methods: ['GET', 'POST'])]
public function edit(Request $request, Gpu $gpu): Response
{
return $this->itemUpdate($request, $gpu, 'gpu');
}
#[Route('/{id}/edit', name: 'gpu_edit', methods: ['GET', 'POST'])]
public function edit(Request $request, Gpu $gpu): Response
{
return $this->itemUpdate($request, $gpu, 'gpu');
}
#[Route('/{id}', name: 'gpu_delete', methods: ['POST'])]
public function delete(Request $request, Gpu $gpu): Response
{
return $this->deleteCSRF($request, $gpu);
}
#[Route('/{id}', name: 'gpu_delete', methods: ['POST'])]
public function delete(Request $request, Gpu $gpu): Response
{
return $this->deleteCSRF($request, $gpu);
}
}

View File

@ -10,58 +10,58 @@ use Symfony\Component\HttpFoundation\{Request, Response};
use Symfony\Component\Routing\Annotation\Route;
#[Route('/gpu-core')]
class GpuCoreController extends AbstractController
{
use FormControllerBase;
class GpuCoreController extends AbstractController {
use FormControllerBase;
protected const ENTITY = GpuCore::class;
protected const TEMPLATE_PATH = 'gpu_core/';
protected const ROUTE_PREFIX = 'gpu-core_';
protected const FORM = GPUCoreType::class;
protected const ENTITY = GpuCore::class;
protected const TEMPLATE_PATH = 'gpu_core/';
protected const ROUTE_PREFIX = 'gpu-core_';
protected const FORM = GPUCoreType::class;
public function __construct(private readonly EntityManagerInterface $entityManager)
{
}
public function __construct(private readonly EntityManagerInterface $entityManager)
{
}
#[Route('/', name: 'gpu-core_index', methods: ['GET'])]
public function index(): Response
{
return $this->indexView('gpu_cores', [
'brand' => 'asc',
'processNode' => 'desc',
'generationName' => 'asc',
'architecture' => 'asc',
'name' => 'asc',
'variant' => 'asc',
]);
}
#[Route('/', name: 'gpu-core_index', methods: ['GET'])]
public function index(): Response
{
return $this->indexView('gpu_cores', [
'brand' => 'asc',
'processNode' => 'desc',
'generationName' => 'asc',
'architecture' => 'asc',
'name' => 'asc',
'variant' => 'asc',
]);
}
#[Route('/new', name: 'gpu-core_new', methods: ['GET', 'POST'])]
public function new(Request $request): Response
{
return $this->itemCreate($request, 'gpu_core');
}
#[Route('/new', name: 'gpu-core_new', methods: ['GET', 'POST'])]
public function new(Request $request): Response
{
return $this->itemCreate($request, 'gpu_core');
}
#[Route('/{id}', name: 'gpu-core_show', methods: ['GET'])]
public function show(GpuCore $gPUCore): Response
{
return $this->itemView($gPUCore, 'gpu_core');
}
#[Route('/{id}', name: 'gpu-core_show', methods: ['GET'])]
public function show(GpuCore $gPUCore): Response
{
return $this->itemView($gPUCore, 'gpu_core');
}
#[Route('/{id}/edit', name: 'gpu-core_edit', methods: ['GET', 'POST'])]
public function edit(Request $request, GpuCore $gPUCore): Response
{
return $this->itemUpdate($request, $gPUCore, 'gpu_core');
}
#[Route('/{id}/edit', name: 'gpu-core_edit', methods: ['GET', 'POST'])]
public function edit(Request $request, GpuCore $gPUCore): Response
{
return $this->itemUpdate($request, $gPUCore, 'gpu_core');
}
#[Route('/{id}', name: 'gpu-core_delete', methods: ['POST'])]
public function delete(Request $request, GpuCore $gPUCore, EntityManagerInterface $entityManager): Response
{
if ($this->isCsrfTokenValid('delete' . $gPUCore->getId(), $request->request->get('_token'))) {
$entityManager->remove($gPUCore);
$entityManager->flush();
}
#[Route('/{id}', name: 'gpu-core_delete', methods: ['POST'])]
public function delete(Request $request, GpuCore $gPUCore, EntityManagerInterface $entityManager): Response
{
if ($this->isCsrfTokenValid('delete' . $gPUCore->getId(), $request->request->get('_token')))
{
$entityManager->remove($gPUCore);
$entityManager->flush();
}
return $this->redirectToRoute('gpu-core_index', [], Response::HTTP_SEE_OTHER);
}
return $this->redirectToRoute('gpu-core_index', [], Response::HTTP_SEE_OTHER);
}
}

View File

@ -2,10 +2,10 @@
namespace App\Controller;
use App\Entity\Lenses;
use App\Form\LensesType;
use App\Controller\
{DeleteFormTrait};
use App\Entity\Lenses;
use App\Form\LensesType;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\FormInterface;
@ -16,107 +16,102 @@ use Symfony\Component\Routing\Annotation\Route;
* Lens controller.
*/
#[Route(path: 'lens')]
class LensesController extends AbstractController
{
use FormControllerBase;
use DeleteFormTrait;
class LensesController extends AbstractController {
use FormControllerBase;
use DeleteFormTrait;
protected const ENTITY = Lenses::class;
protected const TEMPLATE_PATH = 'lenses/';
protected const ROUTE_PREFIX = 'lens_';
protected const FORM = LensesType::class;
protected const ENTITY = Lenses::class;
protected const TEMPLATE_PATH = 'lenses/';
protected const ROUTE_PREFIX = 'lens_';
protected const FORM = LensesType::class;
public function __construct(private readonly EntityManagerInterface $entityManager)
{
}
public function __construct(private readonly EntityManagerInterface $entityManager)
{
}
/**
* Lists all lens entities.
*/
#[Route(path: '/', name: 'lens_index', methods: ['GET'])]
public function indexAction(): Response
{
$receivedItems = $this->entityManager->getRepository(self::ENTITY)->findBy([
'received' => TRUE,
], [
'brand' => 'ASC',
'productLine' => 'ASC',
'mount' => 'ASC',
'minFocalLength' => 'ASC',
'maxFStop' => 'ASC',
]);
$newItems = $this->entityManager->getRepository(self::ENTITY)->findBy([
'received' => FALSE,
], [
'brand' => 'ASC',
'productLine' => 'ASC',
'mount' => 'ASC',
'minFocalLength' => 'ASC',
'maxFStop' => 'ASC',
]);
/**
* Lists all lens entities.
*/
#[Route(path: '/', name: 'lens_index', methods: ['GET'])]
public function indexAction(): Response
{
$receivedItems = $this->entityManager->getRepository(self::ENTITY)->findBy([
'received' => TRUE,
], [
'brand' => 'ASC',
'productLine' => 'ASC',
'mount' => 'ASC',
'minFocalLength' => 'ASC',
'maxFStop' => 'ASC',
]);
$newItems = $this->entityManager->getRepository(self::ENTITY)->findBy([
'received' => FALSE,
], [
'brand' => 'ASC',
'productLine' => 'ASC',
'mount' => 'ASC',
'minFocalLength' => 'ASC',
'maxFStop' => 'ASC',
]);
return $this->render('lenses/index.html.twig', [
'not_received' => $newItems,
'lenses' => $receivedItems,
]);
}
return $this->render('lenses/index.html.twig', [
'not_received' => $newItems,
'lenses' => $receivedItems,
]);
}
/**
* Creates a new lens entity.
*/
#[Route(path: '/new', name: 'lens_new', methods: ['GET', 'POST'])]
public function newAction(Request $request): RedirectResponse|Response
{
return $this->itemCreate($request, 'lense');
}
/**
* Creates a new lens entity.
*/
#[Route(path: '/new', name: 'lens_new', methods: ['GET', 'POST'])]
public function newAction(Request $request): RedirectResponse|Response
{
return $this->itemCreate($request, 'lense');
}
/**
* Finds and displays a lens entity.
*/
#[Route(path: '/{id}', name: 'lens_show', methods: ['GET'])]
public function showAction(Lenses $lens): Response
{
return $this->itemView($lens, 'lense');
}
/**
* Finds and displays a lens entity.
*/
#[Route(path: '/{id}', name: 'lens_show', methods: ['GET'])]
public function showAction(Lenses $lens): Response
{
return $this->itemView($lens, 'lense');
}
/**
* Displays a form to edit an existing lens entity.
*/
#[Route(path: '/{id}/edit', name: 'lens_edit', methods: ['GET', 'POST'])]
public function editAction(Request $request, Lenses $lens): RedirectResponse|Response
{
return $this->itemUpdate($request, $lens, 'lense');
}
/**
* Displays a form to edit an existing lens entity.
*/
#[Route(path: '/{id}/edit', name: 'lens_edit', methods: ['GET', 'POST'])]
public function editAction(Request $request, Lenses $lens): RedirectResponse|Response
{
return $this->itemUpdate($request, $lens, 'lense');
}
/**
* Moves a camera to the previouslyOwned table
*
* @param Request $request
*
* @return RedirectResponse
*/
#[Route(path: '/{id}/deacquire', name: 'lens_deacquire', methods: ['POST'])]
public function deacquireAction(Request $request, Lenses $lens): RedirectResponse
{
return $this->itemDeacquire($request, $lens, 'previously-owned-lens_index');
}
/**
* Moves a camera to the previouslyOwned table
*/
#[Route(path: '/{id}/deacquire', name: 'lens_deacquire', methods: ['POST'])]
public function deacquireAction(Request $request, Lenses $lens): RedirectResponse
{
return $this->itemDeacquire($request, $lens, 'previously-owned-lens_index');
}
/**
* Deletes a lens entity.
*/
#[Route(path: '/{id}', name: 'lens_delete', methods: ['POST', 'DELETE'])]
public function deleteAction(Request $request, Lenses $lens): RedirectResponse
{
return $this->itemDelete($request, $lens);
}
/**
* Deletes a lens entity.
*/
#[Route(path: '/{id}', name: 'lens_delete', methods: ['POST', 'DELETE'])]
public function deleteAction(Request $request, Lenses $lens): RedirectResponse
{
return $this->itemDelete($request, $lens);
}
/**
* Creates a form to move
*
* @param Lenses $lens The lens entity
*/
private function createDeacquireForm(Lenses $lens): FormInterface
{
return $this->buildForm($lens, 'lens_deacquire');
}
/**
* Creates a form to move
*
* @param Lenses $lens The lens entity
*/
private function createDeacquireForm(Lenses $lens): FormInterface
{
return $this->buildForm($lens, 'lens_deacquire');
}
}

View File

@ -4,7 +4,6 @@ namespace App\Controller;
use App\Entity\PreviouslyOwnedCamera;
use App\Form\PreviouslyOwnedCameraType;
use App\Controller\FormControllerBase;
use Doctrine\ORM\{EntityManagerInterface, ORMInvalidArgumentException};
use LogicException;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
@ -17,77 +16,72 @@ use UnexpectedValueException;
* Previouslyownedcamera controller.
*/
#[Route(path: 'previously-owned-camera')]
class PreviouslyOwnedCameraController extends AbstractController
{
use FormControllerBase;
class PreviouslyOwnedCameraController extends AbstractController {
use FormControllerBase;
protected const ENTITY = PreviouslyOwnedCamera::class;
protected const TEMPLATE_PATH = 'previouslyownedcamera/';
protected const ROUTE_PREFIX = 'previously-owned-camera_';
protected const FORM = PreviouslyOwnedCameraType::class;
protected const ENTITY = PreviouslyOwnedCamera::class;
protected const TEMPLATE_PATH = 'previouslyownedcamera/';
protected const ROUTE_PREFIX = 'previously-owned-camera_';
protected const FORM = PreviouslyOwnedCameraType::class;
public function __construct(private readonly EntityManagerInterface $entityManager)
{
}
public function __construct(private readonly EntityManagerInterface $entityManager)
{
}
/**
* Lists all previouslyOwnedCamera entities.
*
* @throws UnexpectedValueException
*/
#[Route(path: '/', name: 'previously-owned-camera_index', methods: ['GET'])]
public function indexAction(): Response
{
return $this->itemListView('previouslyOwnedCameras', [
'brand' => 'ASC',
'mount' => 'ASC',
'model' => 'ASC',
]);
}
/**
* Lists all previouslyOwnedCamera entities.
*
* @throws UnexpectedValueException
*/
#[Route(path: '/', name: 'previously-owned-camera_index', methods: ['GET'])]
public function indexAction(): Response
{
return $this->itemListView('previouslyOwnedCameras', [
'brand' => 'ASC',
'mount' => 'ASC',
'model' => 'ASC',
]);
}
/**
* Finds and displays a previouslyOwnedCamera entity.
*/
#[Route(path: '/{id}', name: 'previously-owned-camera_show', methods: ['GET'])]
public function showAction(PreviouslyOwnedCamera $previouslyOwnedCamera): Response
{
return $this->itemView($previouslyOwnedCamera, 'previouslyOwnedCamera');
}
/**
* Finds and displays a previouslyOwnedCamera entity.
*/
#[Route(path: '/{id}', name: 'previously-owned-camera_show', methods: ['GET'])]
public function showAction(PreviouslyOwnedCamera $previouslyOwnedCamera): Response
{
return $this->itemView($previouslyOwnedCamera, 'previouslyOwnedCamera');
}
/**
* Displays a form to edit an existing previouslyOwnedCamera entity.
*
* @throws LogicException
*/
#[Route(path: '/{id}/edit', name: 'previously-owned-camera_edit', methods: ['GET', 'POST'])]
public function editAction(Request $request, PreviouslyOwnedCamera $previouslyOwnedCamera): RedirectResponse|Response
{
return $this->itemUpdate($request, $previouslyOwnedCamera, 'previouslyOwnedCamera');
}
/**
* Displays a form to edit an existing previouslyOwnedCamera entity.
*
* @throws LogicException
*/
#[Route(path: '/{id}/edit', name: 'previously-owned-camera_edit', methods: ['GET', 'POST'])]
public function editAction(Request $request, PreviouslyOwnedCamera $previouslyOwnedCamera): RedirectResponse|Response
{
return $this->itemUpdate($request, $previouslyOwnedCamera, 'previouslyOwnedCamera');
}
/**
* Moves a camera to the previouslyOwned table
*
* @param Request $request
*
* @throws LogicException
* @throws ORMInvalidArgumentException
*
* @return RedirectResponse
*/
#[Route(path: '/{id}/reacquire', name: 'previously-owned-camera_reacquire', methods: ['POST'])]
public function reacquireAction(Request $request, PreviouslyOwnedCamera $camera): RedirectResponse
{
return $this->itemReacquire($request, $camera, 'camera_index');
}
/**
* Moves a camera to the previouslyOwned table
*
* @throws LogicException
* @throws ORMInvalidArgumentException
*/
#[Route(path: '/{id}/reacquire', name: 'previously-owned-camera_reacquire', methods: ['POST'])]
public function reacquireAction(Request $request, PreviouslyOwnedCamera $camera): RedirectResponse
{
return $this->itemReacquire($request, $camera, 'camera_index');
}
/**
* Creates a form to move
*
* @param PreviouslyOwnedCamera $camera The camera entity
*/
private function createReacquireForm(PreviouslyOwnedCamera $camera): FormInterface
{
return $this->buildForm($camera, 'previously-owned-camera_reacquire', 'POST');
}
/**
* Creates a form to move
*
* @param PreviouslyOwnedCamera $camera The camera entity
*/
private function createReacquireForm(PreviouslyOwnedCamera $camera): FormInterface
{
return $this->buildForm($camera, 'previously-owned-camera_reacquire', 'POST');
}
}

View File

@ -4,7 +4,6 @@ namespace App\Controller;
use App\Entity\PreviouslyOwnedFlash;
use App\Form\PreviouslyOwnedFlashType;
use App\Controller\FormControllerBase;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\{RedirectResponse, Request, Response};
@ -14,52 +13,51 @@ use Symfony\Component\Routing\Annotation\Route;
* Previouslyownedflash controller.
*/
#[Route(path: 'previously-owned-flash')]
class PreviouslyOwnedFlashController extends AbstractController
{
use FormControllerBase;
class PreviouslyOwnedFlashController extends AbstractController {
use FormControllerBase;
protected const ENTITY = PreviouslyOwnedFlash::class;
protected const ROUTE_PREFIX = 'previously-owned-flash_';
protected const TEMPLATE_PATH = 'previouslyownedflash/';
protected const FORM = PreviouslyOwnedFlashType::class;
protected const ENTITY = PreviouslyOwnedFlash::class;
protected const ROUTE_PREFIX = 'previously-owned-flash_';
protected const TEMPLATE_PATH = 'previouslyownedflash/';
protected const FORM = PreviouslyOwnedFlashType::class;
public function __construct(private readonly EntityManagerInterface $entityManager)
{
}
public function __construct(private readonly EntityManagerInterface $entityManager)
{
}
/**
* Lists all previouslyOwnedFlash entities.
*/
#[Route(path: '/', name: 'previously-owned-flash_index', methods: ['GET'])]
public function indexAction(): Response
{
return $this->itemListView('previouslyOwnedFlashes');
}
/**
* Lists all previouslyOwnedFlash entities.
*/
#[Route(path: '/', name: 'previously-owned-flash_index', methods: ['GET'])]
public function indexAction(): Response
{
return $this->itemListView('previouslyOwnedFlashes');
}
/**
* Creates a new previouslyOwnedFlash entity.
*/
#[Route(path: '/new', name: 'previously-owned-flash_new', methods: ['GET', 'POST'])]
public function newAction(Request $request): RedirectResponse|Response
{
return $this->itemCreate($request, 'previouslyOwnedFlash');
}
/**
* Creates a new previouslyOwnedFlash entity.
*/
#[Route(path: '/new', name: 'previously-owned-flash_new', methods: ['GET', 'POST'])]
public function newAction(Request $request): RedirectResponse|Response
{
return $this->itemCreate($request, 'previouslyOwnedFlash');
}
/**
* Finds and displays a previouslyOwnedFlash entity.
*/
#[Route(path: '/{id}', name: 'previously-owned-flash_show', methods: ['GET'])]
public function showAction(PreviouslyOwnedFlash $previouslyOwnedFlash): Response
{
return $this->itemView($previouslyOwnedFlash, 'previouslyOwnedFlash');
}
/**
* Finds and displays a previouslyOwnedFlash entity.
*/
#[Route(path: '/{id}', name: 'previously-owned-flash_show', methods: ['GET'])]
public function showAction(PreviouslyOwnedFlash $previouslyOwnedFlash): Response
{
return $this->itemView($previouslyOwnedFlash, 'previouslyOwnedFlash');
}
/**
* Displays a form to edit an existing previouslyOwnedFlash entity.
*/
#[Route(path: '/{id}/edit', name: 'previously-owned-flash_edit', methods: ['GET', 'POST'])]
public function editAction(Request $request, PreviouslyOwnedFlash $previouslyOwnedFlash): RedirectResponse|Response
{
return $this->itemUpdate($request, $previouslyOwnedFlash, 'previouslyOwnedFlash');
}
/**
* Displays a form to edit an existing previouslyOwnedFlash entity.
*/
#[Route(path: '/{id}/edit', name: 'previously-owned-flash_edit', methods: ['GET', 'POST'])]
public function editAction(Request $request, PreviouslyOwnedFlash $previouslyOwnedFlash): RedirectResponse|Response
{
return $this->itemUpdate($request, $previouslyOwnedFlash, 'previouslyOwnedFlash');
}
}

View File

@ -4,56 +4,54 @@ namespace App\Controller;
use App\Entity\PreviouslyOwnedLenses;
use App\Form\PreviouslyOwnedLensesType;
use App\Controller\FormControllerBase;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\{RedirectResponse, Request, Response};
use Symfony\Component\Routing\Annotation\Route;
#[Route(path: 'previously-owned-lens')]
class PreviouslyOwnedLensesController extends AbstractController
{
use FormControllerBase;
class PreviouslyOwnedLensesController extends AbstractController {
use FormControllerBase;
protected const ENTITY = PreviouslyOwnedLenses::class;
protected const TEMPLATE_PATH = 'previouslyownedlenses/';
protected const ROUTE_PREFIX = 'previously-owned-lens_';
protected const FORM = PreviouslyOwnedLensesType::class;
protected const ENTITY = PreviouslyOwnedLenses::class;
protected const TEMPLATE_PATH = 'previouslyownedlenses/';
protected const ROUTE_PREFIX = 'previously-owned-lens_';
protected const FORM = PreviouslyOwnedLensesType::class;
public function __construct(private readonly EntityManagerInterface $entityManager)
{
}
public function __construct(private readonly EntityManagerInterface $entityManager)
{
}
/**
* Lists all previouslyOwnedLense entities.
*/
#[Route(path: '/', name: 'previously-owned-lens_index', methods: ['GET'])]
public function indexAction(): Response
{
return $this->itemListView('previouslyOwnedLenses', [
'brand' => 'ASC',
'productLine' => 'ASC',
'mount' => 'ASC',
'minFocalLength' => 'ASC',
'maxFStop' => 'ASC',
]);
}
/**
* Lists all previouslyOwnedLense entities.
*/
#[Route(path: '/', name: 'previously-owned-lens_index', methods: ['GET'])]
public function indexAction(): Response
{
return $this->itemListView('previouslyOwnedLenses', [
'brand' => 'ASC',
'productLine' => 'ASC',
'mount' => 'ASC',
'minFocalLength' => 'ASC',
'maxFStop' => 'ASC',
]);
}
/**
* Finds and displays a previouslyOwnedLense entity.
*/
#[Route(path: '/{id}', name: 'previously-owned-lens_show', methods: ['GET'])]
public function showAction(PreviouslyOwnedLenses $previouslyOwnedLens): Response
{
return $this->itemView($previouslyOwnedLens, 'previouslyOwnedLense');
}
/**
* Finds and displays a previouslyOwnedLense entity.
*/
#[Route(path: '/{id}', name: 'previously-owned-lens_show', methods: ['GET'])]
public function showAction(PreviouslyOwnedLenses $previouslyOwnedLens): Response
{
return $this->itemView($previouslyOwnedLens, 'previouslyOwnedLense');
}
/**
* Displays a form to edit an existing previouslyOwnedLense entity.
*/
#[Route(path: '/{id}/edit', name: 'previously-owned-lens_edit', methods: ['GET', 'POST'])]
public function editAction(Request $request, PreviouslyOwnedLenses $previouslyOwnedLens): RedirectResponse|Response
{
return $this->itemUpdate($request, $previouslyOwnedLens, 'previouslyOwnedLense');
}
/**
* Displays a form to edit an existing previouslyOwnedLense entity.
*/
#[Route(path: '/{id}/edit', name: 'previously-owned-lens_edit', methods: ['GET', 'POST'])]
public function editAction(Request $request, PreviouslyOwnedLenses $previouslyOwnedLens): RedirectResponse|Response
{
return $this->itemUpdate($request, $previouslyOwnedLens, 'previouslyOwnedLense');
}
}

View File

@ -1,17 +1,15 @@
<?php
<?php declare(strict_types=1);
namespace App\Controller;
use App\Entity\Socket;
use App\Form\SocketTypeForm;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\{Request, Response};
use Symfony\Component\Routing\Annotation\Route;
#[Route('/socket')]
class SocketController extends AbstractController
{
class SocketController extends AbstractController {
use FormControllerBase;
protected const ENTITY = Socket::class;
@ -19,33 +17,33 @@ class SocketController extends AbstractController
protected const TEMPLATE_PATH = 'socket/';
protected const FORM = SocketTypeForm::class;
#[Route('/', name: 'socket_index', methods: ['GET'])]
public function index(): Response
{
#[Route('/', name: 'socket_index', methods: ['GET'])]
public function index(): Response
{
return $this->itemListView('sockets');
}
}
#[Route('/new', name: 'socket_new', methods: ['GET', 'POST'])]
public function new(Request $request): Response
{
#[Route('/new', name: 'socket_new', methods: ['GET', 'POST'])]
public function new(Request $request): Response
{
return $this->itemCreate($request, 'sockets');
}
}
#[Route('/{id}', name: 'socket_show', methods: ['GET'])]
public function show(Socket $socket): Response
{
#[Route('/{id}', name: 'socket_show', methods: ['GET'])]
public function show(Socket $socket): Response
{
return $this->itemView($socket, 'socket');
}
}
#[Route('/{id}/edit', name: 'socket_edit', methods: ['GET', 'POST'])]
public function edit(Request $request, Socket $socket): Response
{
#[Route('/{id}/edit', name: 'socket_edit', methods: ['GET', 'POST'])]
public function edit(Request $request, Socket $socket): Response
{
return $this->itemUpdate($request, $socket, 'socket');
}
}
#[Route('/{id}', name: 'socket_delete', methods: ['POST'])]
public function delete(Request $request, Socket $socket): Response
{
#[Route('/{id}', name: 'socket_delete', methods: ['POST'])]
public function delete(Request $request, Socket $socket): Response
{
return $this->deleteCSRF($request, $socket);
}
}
}

View File

@ -2,13 +2,12 @@
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\{ArrayCollection, Collection};
use Doctrine\ORM\Mapping as ORM;
#[ORM\Table(name: 'brand', schema: 'collection')]
#[ORM\Entity]
#[ORM\UniqueConstraint(name: 'brand_unq', columns: ["name"])]
#[ORM\UniqueConstraint(name: 'brand_unq', columns: ['name'])]
class Brand {
use GetSet;

View File

@ -10,19 +10,18 @@ use Doctrine\ORM\Mapping as ORM;
*/
#[ORM\Table(name: 'camera', schema: 'collection')]
#[ORM\Entity(repositoryClass: CameraRepository::class)]
class Camera
{
class Camera {
use GetSet;
use CameraBase;
use CameraBase;
#[ORM\Column(name: 'id', type: 'integer', nullable: FALSE)]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
#[ORM\SequenceGenerator(sequenceName: 'camera__id_seq', allocationSize: 1, initialValue: 1)]
private int $id;
#[ORM\Column(name: 'id', type: 'integer', nullable: FALSE)]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
#[ORM\SequenceGenerator(sequenceName: 'camera__id_seq', allocationSize: 1, initialValue: 1)]
private int $id;
public function getId(): ?int
{
return $this->id;
}
public function getId(): ?int
{
return $this->id;
}
}

View File

@ -9,47 +9,46 @@ use Doctrine\ORM\Mapping as ORM;
*
* Shared columns for camera, and previously_owned_camera tables
*/
trait CameraBase
{
use PurchasePrice;
trait CameraBase {
use PurchasePrice;
#[ORM\ManyToOne(targetEntity: 'CameraType')]
#[ORM\JoinColumn(name: 'type_id', referencedColumnName: 'id', nullable: FALSE)]
private CameraType $type;
#[ORM\ManyToOne(targetEntity: 'CameraType')]
#[ORM\JoinColumn(name: 'type_id', referencedColumnName: 'id', nullable: FALSE)]
private CameraType $type;
#[ORM\Column(name: 'brand', type: 'string', length: 64, nullable: FALSE)]
private string $brand;
#[ORM\Column(name: 'brand', type: 'string', length: 64, nullable: FALSE)]
private string $brand;
#[ORM\Column(name: 'mount', type: 'string', length: 32, nullable: FALSE)]
private string $mount;
#[ORM\Column(name: 'mount', type: 'string', length: 32, nullable: FALSE)]
private string $mount;
#[ORM\Column(name: 'model', type: 'string', length: 255, nullable: FALSE)]
private string $model;
#[ORM\Column(name: 'model', type: 'string', length: 255, nullable: FALSE)]
private string $model;
#[ORM\Column(name: 'is_digital', type: 'boolean', nullable: FALSE)]
private bool $isDigital;
#[ORM\Column(name: 'is_digital', type: 'boolean', nullable: FALSE)]
private bool $isDigital;
#[ORM\Column(name: 'crop_factor', type: 'decimal', precision: 10, scale: 0, nullable: FALSE)]
private string $cropFactor = '1.0';
#[ORM\Column(name: 'crop_factor', type: 'decimal', precision: 10, scale: 0, nullable: FALSE)]
private string $cropFactor = '1.0';
#[ORM\Column(name: 'is_working', type: 'boolean', nullable: FALSE)]
private bool $isWorking;
#[ORM\Column(name: 'is_working', type: 'boolean', nullable: FALSE)]
private bool $isWorking;
#[ORM\Column(name: 'notes', type: 'text', nullable: TRUE)]
private ?string $notes = null;
#[ORM\Column(name: 'notes', type: 'text', nullable: TRUE)]
private ?string $notes = NULL;
#[ORM\Column(name: 'serial', type: 'string', length: 20, nullable: FALSE)]
private string $serial;
#[ORM\Column(name: 'serial', type: 'string', length: 20, nullable: FALSE)]
private string $serial;
#[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: FALSE)]
private bool $formerlyOwned = FALSE;
#[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: FALSE)]
private bool $formerlyOwned = FALSE;
#[ORM\Column(name: 'battery_type', type: 'string', nullable: TRUE)]
private ?string $batteryType;
#[ORM\Column(name: 'battery_type', type: 'string', nullable: TRUE)]
private ?string $batteryType;
#[ORM\Column(name: 'film_format', type: 'string', nullable: TRUE)]
private ?string $filmFormat = '135';
#[ORM\Column(name: 'film_format', type: 'string', nullable: TRUE)]
private ?string $filmFormat = '135';
#[ORM\Column(name: 'received', type: 'boolean', nullable: TRUE)]
private ?bool $received = FALSE;
#[ORM\Column(name: 'received', type: 'boolean', nullable: TRUE)]
private ?bool $received = FALSE;
}

View File

@ -10,29 +10,28 @@ use Stringable;
*/
#[ORM\Table(name: 'camera_type', schema: 'collection')]
#[ORM\Entity]
class CameraType implements Stringable
{
class CameraType implements Stringable {
use GetSet;
#[ORM\Column(name: 'id', type: 'integer', nullable: FALSE)]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
#[ORM\SequenceGenerator(sequenceName: 'camera.camera_type_id_seq', allocationSize: 1, initialValue: 1)]
private int $id;
#[ORM\Column(name: 'id', type: 'integer', nullable: FALSE)]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
#[ORM\SequenceGenerator(sequenceName: 'camera.camera_type_id_seq', allocationSize: 1, initialValue: 1)]
private int $id;
#[ORM\Column(name: 'type', type: 'string', length: 255, nullable: FALSE)]
private string $type;
#[ORM\Column(name: 'type', type: 'string', length: 255, nullable: FALSE)]
private string $type;
#[ORM\Column(name: 'description', type: 'text', nullable: TRUE)]
private ?string $description = NULL;
#[ORM\Column(name: 'description', type: 'text', nullable: TRUE)]
private ?string $description = NULL;
// ------------------------------------------------------------------------
/**
* Value for serialization
*/
public function __toString(): string
{
return $this->type;
}
/**
* Value for serialization
*/
public function __toString(): string
{
return $this->type;
}
}

View File

@ -2,8 +2,8 @@
namespace App\Entity;
use Doctrine\Common\Collections\{ArrayCollection, Collection};
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\{Collection, ArrayCollection};
#[ORM\Table(name: 'chipset', schema: 'collection')]
#[ORM\Entity]

View File

@ -3,7 +3,7 @@
namespace App\Entity;
use App\Enum\CpuArchitecture;
use Doctrine\Common\Collections\{Collection, ArrayCollection};
use Doctrine\Common\Collections\{ArrayCollection, Collection};
use Doctrine\ORM\Mapping as ORM;
#[ORM\Table('cpu', schema: 'collection')]
@ -43,9 +43,9 @@ class Cpu {
#[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'
))]
#[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)]
@ -54,14 +54,14 @@ class Cpu {
#[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'
))]
#[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: array(
'comment' => 'The max boost speed of the cpu in MHz, if applicable'
))]
#[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')]
@ -70,15 +70,15 @@ class Cpu {
#[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'
))]
#[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)]
#[ORM\Column('voltage', type: 'float', nullable: TRUE)]
private ?float $voltage;
#[ORM\Column('tdp', type: 'integer', nullable: true)]
#[ORM\Column('tdp', type: 'integer', nullable: TRUE)]
private ?int $tdp;
#[ORM\Column('process_node', type: 'integer', nullable: TRUE)]
@ -87,89 +87,89 @@ class Cpu {
#[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('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: array(
'comment' => "Whether I have the chip in my possession (instead of in shipping)"
))]
private bool $received = 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)]
#[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_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: array(
'comment' => 'The size of each Level 1 data cache in KB'
))]
private ?int $L1dSize = 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_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_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: array(
'comment' => 'The size of each Level 1 instruction cache in KB'
))]
private ?int $L1cSize = 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_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_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: array(
'comment' => 'The size of each Level 1 unified cache in KB'
))]
private ?int $L1uSize = 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('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'
))]
#[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: array(
'comment' => 'The size of each Level 2 cache in KB'
))]
#[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)]
#[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'
))]
#[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: array(
'comment' => 'The size of each Level 3 cache in KB'
))]
#[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)]
#[ORM\Column('l3_way', type: 'integer', nullable: TRUE)]
private ?int $L3Way;
// ------------------------------------------------------------------------

View File

@ -2,7 +2,6 @@
namespace App\Entity;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
/**
@ -10,51 +9,50 @@ use Doctrine\ORM\Mapping as ORM;
*/
#[ORM\Table(name: 'film', schema: 'collection')]
#[ORM\Entity]
class Film
{
class Film {
use GetSet;
#[ORM\Id]
#[ORM\Column(name: 'id', type: 'integer', nullable: FALSE)]
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
private int $id;
#[ORM\Id]
#[ORM\Column(name: 'id', type: 'integer', nullable: FALSE)]
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
private int $id;
#[ORM\Column(name: 'brand', type: 'string', nullable: FALSE)]
private string $brand;
#[ORM\Column(name: 'brand', type: 'string', nullable: FALSE)]
private string $brand;
#[ORM\Column(name: 'product_line', type: 'string', nullable: TRUE)]
private ?string $productLine = NULL;
#[ORM\Column(name: 'product_line', type: 'string', nullable: TRUE)]
private ?string $productLine = NULL;
#[ORM\Column(name: 'film_name', type: 'string', nullable: FALSE)]
private string $filmName;
#[ORM\Column(name: 'film_name', type: 'string', nullable: FALSE)]
private string $filmName;
#[ORM\Column(name: 'film_alias', type: 'string', nullable: TRUE)]
private ?string $filmAlias = NULL;
#[ORM\Column(name: 'film_alias', type: 'string', nullable: TRUE)]
private ?string $filmAlias = NULL;
#[ORM\Column(name: 'film_speed_asa', type: 'integer', nullable: FALSE)]
private int $filmSpeedAsa;
#[ORM\Column(name: 'film_speed_asa', type: 'integer', nullable: FALSE)]
private int $filmSpeedAsa;
#[ORM\Column(name: 'film_speed_din', type: 'integer', nullable: FALSE)]
private int $filmSpeedDin;
#[ORM\Column(name: 'film_speed_din', type: 'integer', nullable: FALSE)]
private int $filmSpeedDin;
#[ORM\Column(name: 'film_format', type: 'string', nullable: FALSE)]
private string $filmFormat;
#[ORM\Column(name: 'film_format', type: 'string', nullable: FALSE)]
private string $filmFormat;
#[ORM\Column(name: 'film_base', type: 'string', nullable: FALSE, options: ['default' => 'Cellulose Triacetate'])]
private string $filmBase = 'Cellulose Triacetate';
#[ORM\Column(name: 'film_base', type: 'string', nullable: FALSE, options: ['default' => 'Cellulose Triacetate'])]
private string $filmBase = 'Cellulose Triacetate';
#[ORM\Column(name: 'unused_rolls', type: 'integer', nullable: FALSE, options: ['default' => 0])]
private int $unusedRolls = 0;
#[ORM\Column(name: 'unused_rolls', type: 'integer', nullable: FALSE, options: ['default' => 0])]
private int $unusedRolls = 0;
#[ORM\Column(name: 'rolls_in_camera', type: 'integer', nullable: FALSE, options: ['default' => 0])]
private int $rollsInCamera = 0;
#[ORM\Column(name: 'rolls_in_camera', type: 'integer', nullable: FALSE, options: ['default' => 0])]
private int $rollsInCamera = 0;
#[ORM\Column(name: 'developed_rolls', type: 'integer', nullable: FALSE, options: ['default' => 0])]
private int $developedRolls = 0;
#[ORM\Column(name: 'developed_rolls', type: 'integer', nullable: FALSE, options: ['default' => 0])]
private int $developedRolls = 0;
#[ORM\Column(name: 'chemistry', type: 'string', nullable: FALSE, options: ['default' => 'C-41'])]
private string $chemistry = 'C-41';
#[ORM\Column(name: 'chemistry', type: 'string', nullable: FALSE, options: ['default' => 'C-41'])]
private string $chemistry = 'C-41';
#[ORM\Column(name: 'notes', type: 'text', nullable: TRUE)]
private ?string $notes = NULL;
#[ORM\Column(name: 'notes', type: 'text', nullable: TRUE)]
private ?string $notes = NULL;
}

View File

@ -6,18 +6,17 @@ use Doctrine\ORM\Mapping as ORM;
#[ORM\Table(name: 'film_format', schema: 'collection')]
#[ORM\Entity]
class FilmFormat
{
class FilmFormat {
use GetSet;
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private int $id;
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private int $id;
#[ORM\Column(name: 'number_id', type: 'integer')]
private int $numberId;
#[ORM\Column(name: 'number_id', type: 'integer')]
private int $numberId;
#[ORM\Column(name: 'name', type: 'string')]
private string $name;
#[ORM\Column(name: 'name', type: 'string')]
private string $name;
}

View File

@ -9,20 +9,19 @@ use Doctrine\ORM\Mapping as ORM;
*/
#[ORM\Table(name: 'flash', schema: 'collection')]
#[ORM\Entity]
class Flash
{
class Flash {
use GetSet;
use FlashBase;
use FlashBase;
#[ORM\Column(name: 'id', type: 'integer', nullable: FALSE)]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
#[ORM\SequenceGenerator(sequenceName: 'camera.flash_id_seq', allocationSize: 1, initialValue: 1)]
private int $id;
#[ORM\Column(name: 'id', type: 'integer', nullable: FALSE)]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
#[ORM\SequenceGenerator(sequenceName: 'camera.flash_id_seq', allocationSize: 1, initialValue: 1)]
private int $id;
#[ORM\Column(name: 'received', type: 'boolean', nullable: FALSE, options: ['default' => FALSE])]
private bool $received = FALSE;
#[ORM\Column(name: 'received', type: 'boolean', nullable: FALSE, options: ['default' => FALSE])]
private bool $received = FALSE;
#[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: FALSE, options: ['default' => FALSE])]
private bool $formerlyOwned = FALSE;
#[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: FALSE, options: ['default' => FALSE])]
private bool $formerlyOwned = FALSE;
}

View File

@ -4,40 +4,39 @@ namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
trait FlashBase
{
use PurchasePrice;
trait FlashBase {
use PurchasePrice;
#[ORM\Column(name: 'brand', type: 'string', nullable: FALSE)]
private readonly string $brand;
#[ORM\Column(name: 'brand', type: 'string', nullable: FALSE)]
private readonly string $brand;
#[ORM\Column(name: 'model', type: 'string', nullable: FALSE)]
private readonly string $model;
#[ORM\Column(name: 'model', type: 'string', nullable: FALSE)]
private readonly string $model;
#[ORM\Column(name: 'is_auto_flash', type: 'boolean', nullable: FALSE)]
private bool $isAutoFlash = FALSE;
#[ORM\Column(name: 'is_auto_flash', type: 'boolean', nullable: FALSE)]
private bool $isAutoFlash = FALSE;
#[ORM\Column(name: 'is_ttl', type: 'boolean', nullable: FALSE)]
private bool $isTtl = FALSE;
#[ORM\Column(name: 'is_ttl', type: 'boolean', nullable: FALSE)]
private bool $isTtl = FALSE;
#[ORM\Column(name: 'ttl_type', type: 'string', nullable: FALSE)]
private string $ttlType = 'N / A';
#[ORM\Column(name: 'ttl_type', type: 'string', nullable: FALSE)]
private string $ttlType = 'N / A';
#[ORM\Column(name: 'is_p_ttl', type: 'boolean', nullable: FALSE)]
private bool $isPTtl = FALSE;
#[ORM\Column(name: 'is_p_ttl', type: 'boolean', nullable: FALSE)]
private bool $isPTtl = FALSE;
#[ORM\Column(name: 'p_ttl_type', type: 'string', nullable: FALSE)]
private string $pTtlType = 'N / A';
#[ORM\Column(name: 'p_ttl_type', type: 'string', nullable: FALSE)]
private string $pTtlType = 'N / A';
#[ORM\Column(name: 'guide_number', type: 'string', nullable: TRUE)]
private ?string $guideNumber = '';
#[ORM\Column(name: 'guide_number', type: 'string', nullable: TRUE)]
private ?string $guideNumber = '';
#[ORM\Column(name: 'batteries', type: 'string', nullable: FALSE)]
private string $batteries = '4x AA';
#[ORM\Column(name: 'batteries', type: 'string', nullable: FALSE)]
private string $batteries = '4x AA';
#[ORM\Column(name: 'notes', type: 'text', nullable: TRUE)]
private readonly ?string $notes;
#[ORM\Column(name: 'notes', type: 'text', nullable: TRUE)]
private readonly ?string $notes;
#[ORM\Column(name: 'serial', type: 'string', nullable: TRUE)]
private readonly ?string $serial;
#[ORM\Column(name: 'serial', type: 'string', nullable: TRUE)]
private readonly ?string $serial;
}

View File

@ -33,7 +33,7 @@ class Fpu {
#[ORM\Column(name: 'clock_speed', type: 'integer')]
private int $clockSpeed = 33;
#[ORM\Column(name: 'count', nullable: FALSE, options: array('default' => 1))]
#[ORM\Column(name: 'count', nullable: FALSE, options: ['default' => 1])]
private int $count = 1;
#[ORM\Column(name: 'notes', type: 'text', nullable: TRUE)]

View File

@ -2,8 +2,7 @@
namespace App\Entity;
use App\Enum\CardBus;
use App\Enum\SlotKey;
use App\Enum\{CardBus, SlotKey};
use Doctrine\ORM\Mapping as ORM;
#[ORM\Table(name: 'gpu', schema: 'collection')]
@ -41,10 +40,10 @@ class Gpu {
name: 'card_key',
type: 'string',
enumType: SlotKey::class,
options: array(
'comment' => "The shape of the card connector",
'default' => "PCIe x16"
)
options: [
'comment' => 'The shape of the card connector',
'default' => 'PCIe x16',
]
)]
private SlotKey $cardKey = SlotKey::PCIE_X16;
@ -53,67 +52,67 @@ class Gpu {
type: 'string',
nullable: TRUE,
enumType: CardBus::class,
options: array('comment' => "The type of electrical bus this card uses")
options: ['comment' => 'The type of electrical bus this card uses']
)]
private ?CardBus $busInterface;
#[ORM\Column(
name: 'slot_span',
options: array(
'comment' => "How many expansion slots the card occupies",
options: [
'comment' => 'How many expansion slots the card occupies',
'default' => 1,
),
],
)]
private int $slotSpan = 1;
#[ORM\Column(name: 'molex_power', options: array('default' => 0))]
#[ORM\Column(name: 'molex_power', options: ['default' => 0])]
private int $molexPower = 0;
#[ORM\Column(name: 'pcie_6_pin', options: array('default' => 0))]
#[ORM\Column(name: 'pcie_6_pin', options: ['default' => 0])]
private int $pcie6power = 0;
#[ORM\Column(name: 'pcie_8_pin', options: array('default' => 0))]
#[ORM\Column(name: 'pcie_8_pin', options: ['default' => 0])]
private int $pcie8power = 0;
#[ORM\Column(
name: 'tdp',
nullable: TRUE,
options: array('comment' => "Thermal Design Power (in Watts)")
options: ['comment' => 'Thermal Design Power (in Watts)']
)]
private ?int $tdp = 0;
#[ORM\Column(
name: 'base_clock',
nullable: TRUE,
options: array('comment' => "Base speed of the gpu core, in MHz")
options: ['comment' => 'Base speed of the gpu core, in MHz']
)]
private ?int $baseClock;
#[ORM\Column(
name: 'boost_clock',
nullable: TRUE,
options: array('comment' => "GPU core boost clock, in MHz")
options: ['comment' => 'GPU core boost clock, in MHz']
)]
private ?int $boostClock;
#[ORM\Column(
name: 'memory_clock',
nullable: TRUE,
options: array('comment' => "Clock speed of the VRAM, in MHz")
options: ['comment' => 'Clock speed of the VRAM, in MHz']
)]
private ?int $memoryClock;
#[ORM\Column(
name: 'memory_size',
nullable: TRUE,
options: array('comment' => 'VRAM size, in MiB')
options: ['comment' => 'VRAM size, in MiB']
)]
private ?int $memorySize;
#[ORM\Column(
name: 'memory_bus',
nullable: TRUE,
options: array("comment" => 'The width of the memory bus in bits')
options: ['comment' => 'The width of the memory bus in bits']
)]
private ?int $memoryBus;
@ -156,10 +155,10 @@ class Gpu {
#[ORM\Column(name: 'link', nullable: TRUE)]
private ?string $link;
#[ORM\Column(name: 'count', nullable: FALSE, options: array('default' => 1))]
#[ORM\Column(name: 'count', nullable: FALSE, options: ['default' => 1])]
private int $count = 1;
#[ORM\Column(name: 'acquired', nullable: FALSE, options: array('default' => TRUE))]
#[ORM\Column(name: 'acquired', nullable: FALSE, options: ['default' => TRUE])]
private bool $acquired;
#[ORM\Column(name: 'notes', type: 'text', nullable: TRUE)]

View File

@ -4,61 +4,60 @@ namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
trait LensTrait
{
use PurchasePrice;
trait LensTrait {
use PurchasePrice;
#[ORM\Column(name: 'brand', type: 'string', length: 64, nullable: TRUE)]
private readonly ?string $brand;
#[ORM\Column(name: 'brand', type: 'string', length: 64, nullable: TRUE)]
private readonly ?string $brand;
#[ORM\Column(name: 'coatings', type: 'string', length: 64, nullable: TRUE)]
private readonly ?string $coatings;
#[ORM\Column(name: 'coatings', type: 'string', length: 64, nullable: TRUE)]
private readonly ?string $coatings;
#[ORM\Column(name: 'product_line', type: 'string', length: 64, nullable: TRUE)]
private readonly ?string $productLine;
#[ORM\Column(name: 'product_line', type: 'string', length: 64, nullable: TRUE)]
private readonly ?string $productLine;
#[ORM\Column(name: 'model', type: 'string', length: 64, nullable: TRUE)]
private readonly ?string $model;
#[ORM\Column(name: 'model', type: 'string', length: 64, nullable: TRUE)]
private readonly ?string $model;
#[ORM\Column(name: 'min_f_stop', type: 'string', length: 10, nullable: TRUE)]
private readonly ?string $minFStop;
#[ORM\Column(name: 'min_f_stop', type: 'string', length: 10, nullable: TRUE)]
private readonly ?string $minFStop;
#[ORM\Column(name: 'max_f_stop', type: 'float', precision: 10, scale: 0, nullable: TRUE)]
private readonly ?float $maxFStop;
#[ORM\Column(name: 'max_f_stop', type: 'float', precision: 10, scale: 0, nullable: TRUE)]
private readonly ?float $maxFStop;
#[ORM\Column(name: 'min_focal_length', type: 'integer', nullable: TRUE)]
private readonly ?int $minFocalLength;
#[ORM\Column(name: 'min_focal_length', type: 'integer', nullable: TRUE)]
private readonly ?int $minFocalLength;
#[ORM\Column(name: 'max_focal_length', type: 'integer', nullable: TRUE)]
private readonly ?int $maxFocalLength;
#[ORM\Column(name: 'max_focal_length', type: 'integer', nullable: TRUE)]
private readonly ?int $maxFocalLength;
#[ORM\Column(name: 'serial', type: 'string', length: 10, nullable: TRUE)]
private readonly ?string $serial;
#[ORM\Column(name: 'serial', type: 'string', length: 10, nullable: TRUE)]
private readonly ?string $serial;
#[ORM\Column(name: 'notes', type: 'text', nullable: TRUE)]
private readonly ?string $notes;
#[ORM\Column(name: 'notes', type: 'text', nullable: TRUE)]
private readonly ?string $notes;
#[ORM\Column(name: 'image_size', type: 'string', nullable: FALSE, options: ['default' => '35mm'])]
private string $imageSize = '35mm';
#[ORM\Column(name: 'image_size', type: 'string', nullable: FALSE, options: ['default' => '35mm'])]
private string $imageSize = '35mm';
#[ORM\Column(name: 'mount', type: 'string', length: 40, nullable: TRUE)]
private readonly ?string $mount;
#[ORM\Column(name: 'mount', type: 'string', length: 40, nullable: TRUE)]
private readonly ?string $mount;
#[ORM\Column(name: 'front_filter_size', type: 'decimal', precision: 10, scale: 0, nullable: TRUE)]
private readonly ?string $frontFilterSize;
#[ORM\Column(name: 'front_filter_size', type: 'decimal', precision: 10, scale: 0, nullable: TRUE)]
private readonly ?string $frontFilterSize;
#[ORM\Column(name: 'rear_filter_size', type: 'decimal', precision: 10, scale: 0, nullable: TRUE)]
private readonly ?string $rearFilterSize;
#[ORM\Column(name: 'rear_filter_size', type: 'decimal', precision: 10, scale: 0, nullable: TRUE)]
private readonly ?string $rearFilterSize;
#[ORM\Column(name: 'is_teleconverter', type: 'boolean', nullable: FALSE)]
private bool $isTeleconverter = FALSE;
#[ORM\Column(name: 'is_teleconverter', type: 'boolean', nullable: FALSE)]
private bool $isTeleconverter = FALSE;
#[ORM\Column(name: 'design_elements', type: 'smallint', nullable: TRUE)]
private readonly ?int $designElements;
#[ORM\Column(name: 'design_elements', type: 'smallint', nullable: TRUE)]
private readonly ?int $designElements;
#[ORM\Column(name: 'design_groups', type: 'smallint', nullable: TRUE)]
private readonly ?int $designGroups;
#[ORM\Column(name: 'design_groups', type: 'smallint', nullable: TRUE)]
private readonly ?int $designGroups;
#[ORM\Column(name: 'aperture_blades', type: 'smallint', nullable: TRUE)]
private readonly ?int $apertureBlades;
#[ORM\Column(name: 'aperture_blades', type: 'smallint', nullable: TRUE)]
private readonly ?int $apertureBlades;
}

View File

@ -10,20 +10,19 @@ use Doctrine\ORM\Mapping as ORM;
*/
#[ORM\Table(name: 'lenses', schema: 'collection')]
#[ORM\Entity(repositoryClass: LensesRepository::class)]
class Lenses
{
class Lenses {
use GetSet;
use LensTrait;
use LensTrait;
#[ORM\Column(name: 'id', type: 'integer', nullable: FALSE)]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
#[ORM\SequenceGenerator(sequenceName: 'camera.lenses_id_seq', allocationSize: 1, initialValue: 1)]
private int $id;
#[ORM\Column(name: 'id', type: 'integer', nullable: FALSE)]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
#[ORM\SequenceGenerator(sequenceName: 'camera.lenses_id_seq', allocationSize: 1, initialValue: 1)]
private int $id;
#[ORM\Column(name: 'received', type: 'boolean', nullable: FALSE)]
private bool $received = FALSE;
#[ORM\Column(name: 'received', type: 'boolean', nullable: FALSE)]
private bool $received = FALSE;
#[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: FALSE)]
private bool $formerlyOwned = FALSE;
#[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: FALSE)]
private bool $formerlyOwned = FALSE;
}

View File

@ -2,8 +2,8 @@
namespace App\Entity;
use Doctrine\Common\Collections\{ArrayCollection, Collection};
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\{Collection, ArrayCollection};
#[ORM\Table(name: 'motherboard', schema: 'collection')]
#[ORM\Entity]
@ -41,7 +41,7 @@ class Motherboard {
#[ORM\Column('link', type: 'string')]
private string $link;
#[ORM\Column('notes', type: 'text', nullable: true)]
#[ORM\Column('notes', type: 'text', nullable: TRUE)]
private ?string $notes = '';
// ------------------------------------------------------------------------

View File

@ -10,14 +10,13 @@ use Doctrine\ORM\Mapping as ORM;
*/
#[ORM\Table(name: 'previously_owned_camera', schema: 'collection')]
#[ORM\Entity(repositoryClass: CameraRepository::class)]
class PreviouslyOwnedCamera
{
class PreviouslyOwnedCamera {
use GetSet;
use CameraBase;
use CameraBase;
#[ORM\Column(name: 'id', type: 'integer', nullable: FALSE)]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
#[ORM\SequenceGenerator(sequenceName: 'prevously_owned_camera_id_seq', allocationSize: 1, initialValue: 1)]
private int $id;
#[ORM\Column(name: 'id', type: 'integer', nullable: FALSE)]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
#[ORM\SequenceGenerator(sequenceName: 'prevously_owned_camera_id_seq', allocationSize: 1, initialValue: 1)]
private int $id;
}

View File

@ -9,19 +9,18 @@ use Doctrine\ORM\Mapping as ORM;
*/
#[ORM\Table(name: 'previously_owned_flash', schema: 'collection')]
#[ORM\Entity]
class PreviouslyOwnedFlash
{
class PreviouslyOwnedFlash {
use GetSet;
use FlashBase;
use FlashBase;
#[ORM\Column(name: 'id', type: 'integer', nullable: FALSE)]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
private int $id;
#[ORM\Column(name: 'id', type: 'integer', nullable: FALSE)]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
private int $id;
#[ORM\Column(name: 'received', type: 'boolean', nullable: FALSE, options: ['default' => TRUE])]
private bool $received = TRUE;
#[ORM\Column(name: 'received', type: 'boolean', nullable: FALSE, options: ['default' => TRUE])]
private bool $received = TRUE;
#[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: FALSE, options: ['default' => TRUE])]
private bool $formerlyOwned = TRUE;
#[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: FALSE, options: ['default' => TRUE])]
private bool $formerlyOwned = TRUE;
}

View File

@ -10,19 +10,18 @@ use Doctrine\ORM\Mapping as ORM;
*/
#[ORM\Table(name: 'previously_owned_lenses', schema: 'collection')]
#[ORM\Entity(repositoryClass: LensesRepository::class)]
class PreviouslyOwnedLenses
{
class PreviouslyOwnedLenses {
use GetSet;
use LensTrait;
use LensTrait;
#[ORM\Column(name: 'id', type: 'integer', nullable: FALSE)]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
private int $id;
#[ORM\Column(name: 'id', type: 'integer', nullable: FALSE)]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
private int $id;
#[ORM\Column(name: 'received', type: 'boolean', nullable: FALSE)]
private bool $received = TRUE;
#[ORM\Column(name: 'received', type: 'boolean', nullable: FALSE)]
private bool $received = TRUE;
#[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: FALSE)]
private bool $formerlyOwned = TRUE;
#[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: FALSE)]
private bool $formerlyOwned = TRUE;
}

View File

@ -4,24 +4,24 @@ namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
trait PurchasePrice
{
#[ORM\Column(name: 'purchase_price', type: 'money', nullable: TRUE)]
private ?string $purchasePrice = NULL;
trait PurchasePrice {
#[ORM\Column(name: 'purchase_price', type: 'money', nullable: TRUE)]
private ?string $purchasePrice = NULL;
public function setPurchasePrice(?string $purchasePrice): self
{
$this->purchasePrice = $purchasePrice;
public function setPurchasePrice(?string $purchasePrice): self
{
$this->purchasePrice = $purchasePrice;
return $this;
}
return $this;
}
public function getPurchasePrice(): string
{
if (empty($this->purchasePrice)) {
return '0';
}
public function getPurchasePrice(): string
{
if (empty($this->purchasePrice))
{
return '0';
}
return $this->purchasePrice;
}
return $this->purchasePrice;
}
}

View File

@ -26,18 +26,18 @@ enum CardBus: string {
public static function getGroups(): array
{
$filter = static fn (string $starts_with) =>
array_filter(self::cases(), fn (CardBus $case) =>
str_starts_with($case->name, $starts_with)
);
$filter = static fn (string $starts_with) => array_filter(
self::cases(),
static fn (CardBus $case) => str_starts_with($case->name, $starts_with)
);
$pcie = $filter('PCIE_');
$agp = $filter('AGP_');
$pci = $filter('PCI_');
$isa = $filter('ISA_');
$pcie16 = array_filter($pcie, fn (CardBus $case) => str_ends_with($case->name, '_16'));
$pcieOther = array_udiff($pcie, $pcie16, fn ($a, $b) => $a->name <=> $b->name);
$pcie16 = array_filter($pcie, static fn (CardBus $case) => str_ends_with($case->name, '_16'));
$pcieOther = array_udiff($pcie, $pcie16, static fn ($a, $b) => $a->name <=> $b->name);
return [
'PCI Express x16' => $pcie16,

View File

@ -30,20 +30,22 @@ enum SlotKey: string {
public static function getCases(): array
{
$cases = self::cases();
return array_map(static fn(UnitEnum $case) => $case->name, $cases);
return array_map(static fn (UnitEnum $case) => $case->name, $cases);
}
public static function getValues(): array
{
$cases = self::cases();
return array_map(static fn(UnitEnum $case) => $case->value, $cases);
return array_map(static fn (UnitEnum $case) => $case->value, $cases);
}
public static function getGroups(): array
{
$filter = static fn (string $starts_with) =>
array_filter(self::cases(), fn (SlotKey $case) =>
str_starts_with($case->name, $starts_with)
$filter = static fn (string $starts_with) => array_filter(
self::cases(),
static fn (SlotKey $case) => str_starts_with($case->name, $starts_with)
);
return [
@ -68,7 +70,7 @@ enum SlotKey: string {
self::ISA_16,
self::ISA_8,
self::ISA_VLB,
]
],
];
}
}

View File

@ -2,17 +2,15 @@
namespace App\Form;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\QueryBuilder;
use Doctrine\ORM\{EntityRepository, QueryBuilder};
trait BrandCategoryTrait {
public static function filterBrands(string $filter): callable
{
return static fn(EntityRepository $e) =>
$e->createQueryBuilder('b')
->join('b.categories', 'bc')
->where('bc.name=:name')
->orderBy('b.name', 'ASC')
->setParameter('name', $filter);
return static fn (EntityRepository $e) => $e->createQueryBuilder('b')
->join('b.categories', 'bc')
->where('bc.name=:name')
->orderBy('b.name', 'ASC')
->setParameter('name', $filter);
}
}

View File

@ -1,25 +1,22 @@
<?php
<?php declare(strict_types=1);
namespace App\Form;
use App\Entity\BrandCategory;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\{AbstractType, FormBuilderInterface};
use Symfony\Component\OptionsResolver\OptionsResolver;
class BrandCategoryType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('name')
;
}
class BrandCategoryType extends AbstractType {
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('name');
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => BrandCategory::class,
]);
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => BrandCategory::class,
]);
}
}

View File

@ -2,26 +2,22 @@
namespace App\Form;
use App\Entity\Brand;
use App\Entity\{Brand, BrandCategory};
use Symfony\Component\Form\{AbstractType, FormBuilderInterface};
use App\Entity\BrandCategory;
use Doctrine\ORM\EntityRepository;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\OptionsResolver\OptionsResolver;
class BrandType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('name')
class BrandType extends AbstractType {
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('name')
->add('categories');
}
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Brand::class,
]);
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Brand::class,
]);
}
}

View File

@ -9,60 +9,59 @@ use Symfony\Component\OptionsResolver\Exception\AccessException;
use Symfony\Component\OptionsResolver\OptionsResolver;
class CameraType extends AbstractType
{
/**
* {@inheritDoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder->add('brand')
->add('type')
->add('isDigital')
->add('mount')
->add('model')
->add('filmFormat', ChoiceType::class, [
'choices' => [
'Small Format' => [
'35mm' => '135',
'110' => '110',
],
'Medium Format' => [
'120' => '120',
'127' => '127',
'620' => '620',
],
],
])
->add('cropFactor')
->add('serial')
->add('purchasePrice', MoneyType::class, [
'currency' => 'USD',
])
->add('batteryType')
->add('received')
->add('isWorking')
->add('formerlyOwned')
->add('notes');
}
class CameraType extends AbstractType {
/**
* {@inheritDoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder->add('brand')
->add('type')
->add('isDigital')
->add('mount')
->add('model')
->add('filmFormat', ChoiceType::class, [
'choices' => [
'Small Format' => [
'35mm' => '135',
'110' => '110',
],
'Medium Format' => [
'120' => '120',
'127' => '127',
'620' => '620',
],
],
])
->add('cropFactor')
->add('serial')
->add('purchasePrice', MoneyType::class, [
'currency' => 'USD',
])
->add('batteryType')
->add('received')
->add('isWorking')
->add('formerlyOwned')
->add('notes');
}
/**
* {@inheritDoc}
*
* @throws AccessException
*/
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Camera::class,
]);
}
/**
* {@inheritDoc}
*
* @throws AccessException
*/
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Camera::class,
]);
}
/**
* {@inheritDoc}
*/
public function getBlockPrefix(): string
{
return 'camerabundle_camera';
}
/**
* {@inheritDoc}
*/
public function getBlockPrefix(): string
{
return 'camerabundle_camera';
}
}

View File

@ -8,34 +8,33 @@ use Symfony\Component\OptionsResolver\Exception\AccessException;
use Symfony\Component\OptionsResolver\OptionsResolver;
class CameraTypeType extends AbstractType
{
/**
* {@inheritDoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder->add('type')
->add('description');
}
class CameraTypeType extends AbstractType {
/**
* {@inheritDoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder->add('type')
->add('description');
}
/**
* {@inheritDoc}
*
* @throws AccessException
*/
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => CameraType::class,
]);
}
/**
* {@inheritDoc}
*
* @throws AccessException
*/
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => CameraType::class,
]);
}
/**
* {@inheritDoc}
*/
public function getBlockPrefix(): string
{
return 'camerabundle_cameratype';
}
/**
* {@inheritDoc}
*/
public function getBlockPrefix(): string
{
return 'camerabundle_cameratype';
}
}

View File

@ -1,35 +1,31 @@
<?php
<?php declare(strict_types=1);
namespace App\Form;
use App\Entity\Brand;
use App\Entity\Chipset;
use App\Entity\{Brand, Chipset};
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\{AbstractType, FormBuilderInterface};
use Symfony\Component\OptionsResolver\OptionsResolver;
class ChipsetType extends AbstractType
{
class ChipsetType extends AbstractType {
use BrandCategoryTrait;
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('brand', EntityType::class, [
'class' => Brand::class,
'query_builder' => self::filterBrands('chipset'),
])
->add('name')
->add('parts')
->add('link')
;
}
->add('name')
->add('parts')
->add('link');
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Chipset::class,
]);
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Chipset::class,
]);
}
}

View File

@ -1,15 +1,12 @@
<?php
<?php declare(strict_types=1);
namespace App\Form;
use App\Entity\Brand;
use App\Entity\Cpu;
use App\Entity\{Brand, 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\Form\Extension\Core\Type\{EnumType, UrlType};
use Symfony\Component\Form\{AbstractType, FormBuilderInterface};
use Symfony\Component\OptionsResolver\OptionsResolver;
use UnitEnum;
@ -21,7 +18,7 @@ class CpuType extends AbstractType {
$builder
->add('architecture', EnumType::class, [
'class' => CpuArchitecture::class,
'choice_label' => fn(UnitEnum $choice): string => $choice->value,
'choice_label' => static fn (UnitEnum $choice): string => $choice->value,
'choices' => CpuArchitecture::getGroups(),
])
->add('brand', EntityType::class, [
@ -37,50 +34,50 @@ class CpuType extends AbstractType {
->add('codeName')
// Cache Stuff
->add('L1dCount', null, [
->add('L1dCount', NULL, [
'label' => 'L1 Data Cache(s)',
])
->add('L1dSize', null, [
'label' => 'L1 Data Size KB'
->add('L1dSize', NULL, [
'label' => 'L1 Data Size KB',
])
->add('L1dWay', null, [
'label' => 'L1 Data (x-way)'
->add('L1dWay', NULL, [
'label' => 'L1 Data (x-way)',
])
->add('L1cCount', null, [
->add('L1cCount', NULL, [
'label' => 'L1 Instruction Cache(s)',
])
->add('L1cSize', null, [
'label' => 'L1 Instruction Size KB'
->add('L1cSize', NULL, [
'label' => 'L1 Instruction Size KB',
])
->add('L1cWay', null, [
'label' => 'L1 Instruction (x-way)'
->add('L1cWay', NULL, [
'label' => 'L1 Instruction (x-way)',
])
->add('L1uCount', null, [
->add('L1uCount', NULL, [
'label' => 'L1 Unified Cache(s)',
])
->add('L1uSize', null, [
'label' => 'L1 Unified Cache Size: KB'
->add('L1uSize', NULL, [
'label' => 'L1 Unified Cache Size: KB',
])
->add('L1uWay', null, [
'label' => 'L1 Unified (x-way)'
->add('L1uWay', NULL, [
'label' => 'L1 Unified (x-way)',
])
->add('L2Count', null, [
'label' => 'L2 Cache(s)'
->add('L2Count', NULL, [
'label' => 'L2 Cache(s)',
])
->add('L2Size', null, [
'label' => 'L2 Cache Size KB (per unit)'
->add('L2Size', NULL, [
'label' => 'L2 Cache Size KB (per unit)',
])
->add('L2Way', null, [
'label' => 'L2 Cache (x-way)'
->add('L2Way', NULL, [
'label' => 'L2 Cache (x-way)',
])
->add('L3Count', null, [
'label' => 'L3 Cache(s)'
->add('L3Count', NULL, [
'label' => 'L3 Cache(s)',
])
->add('L3Size', null, [
'label' => 'L3 Cache Size KB (per unit)'
->add('L3Size', NULL, [
'label' => 'L3 Cache Size KB (per unit)',
])
->add('L3Way', null, [
'label' => 'L3 Cache (x-way)'
->add('L3Way', NULL, [
'label' => 'L3 Cache (x-way)',
])
->add('baseSpeed')
@ -95,8 +92,7 @@ class CpuType extends AbstractType {
->add('usable')
->add('received')
->add('link', UrlType::class)
->add('notes')
;
->add('notes');
}
public function configureOptions(OptionsResolver $resolver): void

View File

@ -7,68 +7,67 @@ use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\{AbstractType, FormBuilderInterface};
use Symfony\Component\OptionsResolver\OptionsResolver;
class FilmType extends AbstractType
{
/**
* {@inheritDoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder->add('brand')
->add('productLine')
->add('filmName')
->add('filmAlias')
->add('filmSpeedAsa')
->add('filmSpeedDin')
->add('filmFormat', ChoiceType::class, [
'choices' => [
'Small Format' => [
'35mm' => '135',
'110' => '110',
],
'Medium Format' => [
'120' => '120',
'127' => '127',
'620' => '620',
],
],
])
->add('filmBase', ChoiceType::class, [
'choices' => [
'Cellulose Triacetate' => 'Cellulose Triacetate',
'Polyester' => 'Polyester',
'Polyethylene Naphtalate' => 'Polyethylene Naphtalate',
],
])
->add('unusedRolls')
->add('rollsInCamera')
->add('developedRolls')
->add('chemistry', ChoiceType::class, [
'choices' => [
'B & W' => 'B & W',
'C-41' => 'C-41',
'E-6' => 'E-6',
'Other' => 'Other',
],
])
->add('notes');
}
class FilmType extends AbstractType {
/**
* {@inheritDoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder->add('brand')
->add('productLine')
->add('filmName')
->add('filmAlias')
->add('filmSpeedAsa')
->add('filmSpeedDin')
->add('filmFormat', ChoiceType::class, [
'choices' => [
'Small Format' => [
'35mm' => '135',
'110' => '110',
],
'Medium Format' => [
'120' => '120',
'127' => '127',
'620' => '620',
],
],
])
->add('filmBase', ChoiceType::class, [
'choices' => [
'Cellulose Triacetate' => 'Cellulose Triacetate',
'Polyester' => 'Polyester',
'Polyethylene Naphtalate' => 'Polyethylene Naphtalate',
],
])
->add('unusedRolls')
->add('rollsInCamera')
->add('developedRolls')
->add('chemistry', ChoiceType::class, [
'choices' => [
'B & W' => 'B & W',
'C-41' => 'C-41',
'E-6' => 'E-6',
'Other' => 'Other',
],
])
->add('notes');
}
/**
* {@inheritDoc}
*/
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Film::class,
]);
}
/**
* {@inheritDoc}
*/
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Film::class,
]);
}
/**
* {@inheritDoc}
*/
public function getBlockPrefix(): string
{
return 'camerabundle_film';
}
/**
* {@inheritDoc}
*/
public function getBlockPrefix(): string
{
return 'camerabundle_film';
}
}

View File

@ -8,46 +8,45 @@ use Symfony\Component\OptionsResolver\Exception\AccessException;
use Symfony\Component\OptionsResolver\OptionsResolver;
class FlashType extends AbstractType
{
/**
* {@inheritDoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder->add('brand')
->add('model')
->add('isAutoFlash')
->add('isTtl')
->add('ttlType')
->add('isPTtl')
->add('pTtlType')
->add('guideNumber')
->add('purchasePrice')
->add('batteries')
->add('notes')
->add('serial')
->add('received')
->add('formerlyOwned');
}
class FlashType extends AbstractType {
/**
* {@inheritDoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder->add('brand')
->add('model')
->add('isAutoFlash')
->add('isTtl')
->add('ttlType')
->add('isPTtl')
->add('pTtlType')
->add('guideNumber')
->add('purchasePrice')
->add('batteries')
->add('notes')
->add('serial')
->add('received')
->add('formerlyOwned');
}
/**
* {@inheritDoc}
*
* @throws AccessException
*/
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Flash::class,
]);
}
/**
* {@inheritDoc}
*
* @throws AccessException
*/
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Flash::class,
]);
}
/**
* {@inheritDoc}
*/
public function getBlockPrefix(): string
{
return 'camerabundle_flash';
}
/**
* {@inheritDoc}
*/
public function getBlockPrefix(): string
{
return 'camerabundle_flash';
}
}

View File

@ -1,43 +1,38 @@
<?php
<?php declare(strict_types=1);
namespace App\Form;
use App\Entity\Brand;
use App\Entity\Fpu;
use App\Entity\Socket;
use App\Entity\{Brand, Fpu, Socket};
use Doctrine\ORM\EntityRepository;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\{AbstractType, FormBuilderInterface};
use Symfony\Component\OptionsResolver\OptionsResolver;
class FpuType extends AbstractType
{
class FpuType extends AbstractType {
use BrandCategoryTrait;
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('socket', EntityType::class, [
'class' => Socket::class,
'query_builder' => static fn(EntityRepository $e) => $e->createQueryBuilder('s')->orderBy('s.name', 'ASC'),
'query_builder' => static fn (EntityRepository $e) => $e->createQueryBuilder('s')->orderBy('s.name', 'ASC'),
])
->add('brand', EntityType::class, [
'class' => Brand::class,
'query_builder' => self::filterBrands('fpu'),
])
->add('series')
->add('model')
->add('clockSpeed')
->add('count')
->add('notes')
;
}
->add('model')
->add('clockSpeed')
->add('count')
->add('notes');
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Fpu::class,
]);
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Fpu::class,
]);
}
}

View File

@ -3,36 +3,33 @@
namespace App\Form;
use App\Entity\{Brand, GpuCore};
use Doctrine\ORM\EntityRepository;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\{AbstractType, FormBuilderInterface};
use Symfony\Component\OptionsResolver\OptionsResolver;
class GPUCoreType extends AbstractType
{
class GPUCoreType extends AbstractType {
use BrandCategoryTrait;
public function buildForm(FormBuilderInterface $builder, array $options): void
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('brand', EntityType::class, [
'class' => Brand::class,
'query_builder' => self::filterBrands('gpu_core'),
])
->add('name')
->add('variant')
->add('architecture')
->add('architectureLink')
->add('generationName')
->add('generationLink')
->add('processNode');
}
$builder
->add('brand', EntityType::class, [
'class' => Brand::class,
'query_builder' => self::filterBrands('gpu_core'),
])
->add('name')
->add('variant')
->add('architecture')
->add('architectureLink')
->add('generationName')
->add('generationLink')
->add('processNode');
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => GpuCore::class,
]);
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => GpuCore::class,
]);
}
}

View File

@ -2,8 +2,8 @@
namespace App\Form;
use App\Enum\{CardBus, SlotKey};
use App\Entity\{Brand, Gpu, GpuCore};
use App\Enum\{CardBus, SlotKey};
use Doctrine\ORM\EntityRepository;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\
@ -24,7 +24,7 @@ class GpuType extends AbstractType {
->add('modelName')
->add('gpuCore', EntityType::class, [
'class' => GpuCore::class,
'query_builder' => static fn(EntityRepository $e) => $e->createQueryBuilder('gc')->orderBy('gc.brand', 'ASC')->orderBy('gc.name', 'ASC'),
'query_builder' => static fn (EntityRepository $e) => $e->createQueryBuilder('gc')->orderBy('gc.brand', 'ASC')->orderBy('gc.name', 'ASC'),
'placeholder' => 'Unknown',
'empty_data' => NULL,
'required' => FALSE,
@ -40,12 +40,12 @@ class GpuType extends AbstractType {
->add('cardKey', EnumType::class, [
'class' => SlotKey::class,
'choices' => SlotKey::getGroups(),
'choice_label' => fn(UnitEnum $choice): string => $choice->value,
'choice_label' => static fn (UnitEnum $choice): string => $choice->value,
])
->add('busInterface', EnumType::class, [
'class' => CardBus::class,
'choices' => CardBus::getGroups(),
'choice_label' => fn(UnitEnum $choice): string => $choice->value,
'choice_label' => static fn (UnitEnum $choice): string => $choice->value,
])
->add('slotSpan')
->add('molexPower', NULL, ['label' => 'Molex Power Connectors'])

View File

@ -9,66 +9,65 @@ use Symfony\Component\OptionsResolver\Exception\AccessException;
use Symfony\Component\OptionsResolver\OptionsResolver;
class LensesType extends AbstractType
{
/**
* {@inheritDoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder->add('brand')
->add('coatings')
->add('productLine')
->add('model')
->add('mount')
->add('imageSize', ChoiceType::class, [
'choices' => [
'Small Format' => [
'35mm' => '35mm',
'APS-C' => 'APS-C',
'Micro 4/3' => 'Micro 4/3',
],
'Medium Format' => [
'6x6' => '6x6cm',
'6x4.5' => '6x4.5cm',
'4x4' => '4x4cm',
],
],
])
->add('minFStop')
->add('maxFStop')
->add('minFocalLength')
->add('maxFocalLength')
->add('serial')
->add('purchasePrice')
->add('notes')
->add('received')
->add('formerlyOwned')
->add('frontFilterSize')
->add('rearFilterSize')
->add('isTeleconverter')
->add('designElements')
->add('designGroups')
->add('apertureBlades');
}
class LensesType extends AbstractType {
/**
* {@inheritDoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder->add('brand')
->add('coatings')
->add('productLine')
->add('model')
->add('mount')
->add('imageSize', ChoiceType::class, [
'choices' => [
'Small Format' => [
'35mm' => '35mm',
'APS-C' => 'APS-C',
'Micro 4/3' => 'Micro 4/3',
],
'Medium Format' => [
'6x6' => '6x6cm',
'6x4.5' => '6x4.5cm',
'4x4' => '4x4cm',
],
],
])
->add('minFStop')
->add('maxFStop')
->add('minFocalLength')
->add('maxFocalLength')
->add('serial')
->add('purchasePrice')
->add('notes')
->add('received')
->add('formerlyOwned')
->add('frontFilterSize')
->add('rearFilterSize')
->add('isTeleconverter')
->add('designElements')
->add('designGroups')
->add('apertureBlades');
}
/**
* {@inheritDoc}
*
* @throws AccessException
*/
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Lenses::class,
]);
}
/**
* {@inheritDoc}
*
* @throws AccessException
*/
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Lenses::class,
]);
}
/**
* {@inheritDoc}
*/
public function getBlockPrefix(): string
{
return 'camerabundle_lenses';
}
/**
* {@inheritDoc}
*/
public function getBlockPrefix(): string
{
return 'camerabundle_lenses';
}
}

View File

@ -8,46 +8,45 @@ use Symfony\Component\OptionsResolver\Exception\AccessException;
use Symfony\Component\OptionsResolver\OptionsResolver;
class PreviouslyOwnedCameraType extends AbstractType
{
/**
* {@inheritDoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder->add('brand')
->add('mount')
->add('model')
->add('isDigital')
->add('cropFactor')
->add('isWorking')
->add('notes')
->add('serial')
->add('formerlyOwned')
->add('purchasePrice')
->add('batteryType')
->add('filmFormat')
->add('received')
->add('type');
}
class PreviouslyOwnedCameraType extends AbstractType {
/**
* {@inheritDoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder->add('brand')
->add('mount')
->add('model')
->add('isDigital')
->add('cropFactor')
->add('isWorking')
->add('notes')
->add('serial')
->add('formerlyOwned')
->add('purchasePrice')
->add('batteryType')
->add('filmFormat')
->add('received')
->add('type');
}
/**
* {@inheritDoc}
*
* @throws AccessException
*/
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => PreviouslyOwnedCamera::class,
]);
}
/**
* {@inheritDoc}
*
* @throws AccessException
*/
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => PreviouslyOwnedCamera::class,
]);
}
/**
* {@inheritDoc}
*/
public function getBlockPrefix(): string
{
return 'camerabundle_previouslyownedcamera';
}
/**
* {@inheritDoc}
*/
public function getBlockPrefix(): string
{
return 'camerabundle_previouslyownedcamera';
}
}

View File

@ -8,47 +8,46 @@ use Symfony\Component\OptionsResolver\Exception\AccessException;
use Symfony\Component\OptionsResolver\OptionsResolver;
class PreviouslyOwnedFlashType extends AbstractType
{
/**
* {@inheritDoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('brand')
->add('model')
->add('isAutoFlash')
->add('isTtl')
->add('ttlType')
->add('isPTtl')
->add('pTtlType')
->add('guideNumber')
->add('purchasePrice')
->add('batteries')
->add('notes')
->add('serial')
->add('received')
->add('formerlyOwned');
}
class PreviouslyOwnedFlashType extends AbstractType {
/**
* {@inheritDoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('brand')
->add('model')
->add('isAutoFlash')
->add('isTtl')
->add('ttlType')
->add('isPTtl')
->add('pTtlType')
->add('guideNumber')
->add('purchasePrice')
->add('batteries')
->add('notes')
->add('serial')
->add('received')
->add('formerlyOwned');
}
/**
* {@inheritDoc}
*
* @throws AccessException
*/
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => PreviouslyOwnedFlash::class,
]);
}
/**
* {@inheritDoc}
*
* @throws AccessException
*/
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => PreviouslyOwnedFlash::class,
]);
}
/**
* {@inheritDoc}
*/
public function getBlockPrefix(): string
{
return 'camerabundle_previouslyownedflash';
}
/**
* {@inheritDoc}
*/
public function getBlockPrefix(): string
{
return 'camerabundle_previouslyownedflash';
}
}

View File

@ -8,53 +8,52 @@ use Symfony\Component\OptionsResolver\Exception\AccessException;
use Symfony\Component\OptionsResolver\OptionsResolver;
class PreviouslyOwnedLensesType extends AbstractType
{
/**
* {@inheritDoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder->add('brand')
->add('coatings')
->add('productLine')
->add('model')
->add('minFStop')
->add('maxFStop')
->add('minFocalLength')
->add('maxFocalLength')
->add('serial')
->add('purchasePrice')
->add('notes')
->add('mount')
->add('imageSize')
->add('received')
->add('formerlyOwned')
->add('frontFilterSize')
->add('rearFilterSize')
->add('isTeleconverter')
->add('designElements')
->add('designGroups')
->add('apertureBlades');
}
class PreviouslyOwnedLensesType extends AbstractType {
/**
* {@inheritDoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder->add('brand')
->add('coatings')
->add('productLine')
->add('model')
->add('minFStop')
->add('maxFStop')
->add('minFocalLength')
->add('maxFocalLength')
->add('serial')
->add('purchasePrice')
->add('notes')
->add('mount')
->add('imageSize')
->add('received')
->add('formerlyOwned')
->add('frontFilterSize')
->add('rearFilterSize')
->add('isTeleconverter')
->add('designElements')
->add('designGroups')
->add('apertureBlades');
}
/**
* {@inheritDoc}
*
* @throws AccessException
*/
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => PreviouslyOwnedLenses::class,
]);
}
/**
* {@inheritDoc}
*
* @throws AccessException
*/
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => PreviouslyOwnedLenses::class,
]);
}
/**
* {@inheritDoc}
*/
public function getBlockPrefix(): string
{
return 'camerabundle_previouslyownedlenses';
}
/**
* {@inheritDoc}
*/
public function getBlockPrefix(): string
{
return 'camerabundle_previouslyownedlenses';
}
}

View File

@ -1,32 +1,29 @@
<?php
<?php declare(strict_types=1);
namespace App\Form;
use App\Entity\Socket;
use App\Enum\SocketType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\EnumType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\{AbstractType, FormBuilderInterface};
use Symfony\Component\OptionsResolver\OptionsResolver;
class SocketTypeForm extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('name')
->add('otherName')
->add('pinCount')
->add('type', EnumType::class,[
class SocketTypeForm extends AbstractType {
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('name')
->add('otherName')
->add('pinCount')
->add('type', EnumType::class, [
'class' => SocketType::class,
])
;
}
]);
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Socket::class,
]);
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Socket::class,
]);
}
}

View File

@ -18,32 +18,30 @@ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigura
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
class Kernel extends BaseKernel
{
use MicroKernelTrait;
class Kernel extends BaseKernel {
use MicroKernelTrait;
protected function configureContainer(
protected function configureContainer(
ContainerConfigurator $container,
LoaderInterface $loader,
ContainerBuilder $builder
): void
{
): void {
$configDir = $this->getConfigDir();
$container->import('../config/{packages}/*.yaml');
$container->import('../config/{packages}/' . $this->environment . '/*.yaml');
$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');
}
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

@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of the Symfony MakerBundle package.
@ -12,32 +12,23 @@
namespace App\Maker;
use Doctrine\Bundle\DoctrineBundle\DoctrineBundle;
use Doctrine\Inflector\Inflector;
use Doctrine\Inflector\InflectorFactory;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
use Doctrine\Inflector\{Inflector, InflectorFactory};
use Doctrine\ORM\{EntityManagerInterface, EntityRepository};
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Bundle\MakerBundle\ConsoleStyle;
use Symfony\Bundle\MakerBundle\DependencyBuilder;
use Symfony\Bundle\MakerBundle\Doctrine\DoctrineHelper;
use Symfony\Bundle\MakerBundle\Generator;
use Symfony\Bundle\MakerBundle\InputConfiguration;
use Symfony\Bundle\MakerBundle\Maker\AbstractMaker;
use Symfony\Bundle\MakerBundle\Renderer\FormTypeRenderer;
use Symfony\Bundle\MakerBundle\Str;
use Symfony\Bundle\MakerBundle\Util\UseStatementGenerator;
use Symfony\Bundle\MakerBundle\Validator;
use Symfony\Bundle\MakerBundle\{ConsoleStyle, DependencyBuilder, Generator, InputConfiguration, Str, Validator};
use Symfony\Bundle\TwigBundle\TwigBundle;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\{InputArgument, InputInterface};
use Symfony\Component\Console\Question\Question;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\{Request, Response};
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Csrf\CsrfTokenManager;
use Symfony\Component\Validator\Validation;
@ -45,17 +36,16 @@ use Symfony\Component\Validator\Validation;
/**
* @author Sadicov Vladimir <sadikoff@gmail.com>
*/
final class MakeCollectionCrud extends AbstractMaker
{
final class MakeCollectionCrud extends AbstractMaker {
private Inflector $inflector;
private string $controllerClassName;
private bool $generateTests = false;
private bool $generateTests = FALSE;
public function __construct(private DoctrineHelper $doctrineHelper, private FormTypeRenderer $formTypeRenderer)
{
$this->inflector = InflectorFactory::create()->build();
define('CRUD_TEMPLATE_PREFIX', __DIR__.'/../Resources/crud');
define('CRUD_TEMPLATE_PREFIX', __DIR__ . '/../Resources/crud');
}
public static function getCommandName(): string
@ -72,15 +62,15 @@ final class MakeCollectionCrud extends AbstractMaker
{
$command
->addArgument('entity-class', InputArgument::OPTIONAL, sprintf('The class name of the entity to create CRUD (e.g. <fg=yellow>%s</>)', Str::asClassName(Str::getRandomTerm())))
->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeCrud.txt'))
;
->setHelp(file_get_contents(__DIR__ . '/../Resources/help/MakeCrud.txt'));
$inputConfig->setArgumentAsNonInteractive('entity-class');
}
public function interact(InputInterface $input, ConsoleStyle $io, Command $command): void
{
if (null === $input->getArgument('entity-class')) {
if (NULL === $input->getArgument('entity-class'))
{
$argument = $command->getDefinition()->getArgument('entity-class');
$entities = $this->doctrineHelper->getEntitiesForAutocomplete();
@ -100,7 +90,7 @@ final class MakeCollectionCrud extends AbstractMaker
$defaultControllerClass
);
$this->generateTests = $io->confirm('Do you want to generate tests for the controller?. [Experimental]', false);
$this->generateTests = $io->confirm('Do you want to generate tests for the controller?. [Experimental]', FALSE);
}
public function generate(InputInterface $input, ConsoleStyle $io, Generator $generator): void
@ -115,9 +105,10 @@ final class MakeCollectionCrud extends AbstractMaker
$repositoryVars = [];
$repositoryClassName = EntityManagerInterface::class;
if (null !== $entityDoctrineDetails->getRepositoryClass()) {
if (NULL !== $entityDoctrineDetails->getRepositoryClass())
{
$repositoryClassDetails = $generator->createClassNameDetails(
'\\'.$entityDoctrineDetails->getRepositoryClass(),
'\\' . $entityDoctrineDetails->getRepositoryClass(),
'Repository\\',
'Repository'
);
@ -138,14 +129,17 @@ final class MakeCollectionCrud extends AbstractMaker
);
$iter = 0;
do {
do
{
$formClassDetails = $generator->createClassNameDetails(
$entityClassDetails->getRelativeNameWithoutSuffix().($iter ?: '').'Type',
$entityClassDetails->getRelativeNameWithoutSuffix() . ($iter ?: '') . 'Type',
'Form\\',
'Type'
);
++$iter;
} while (class_exists($formClassDetails->getFullName()));
$iter++;
}
while (class_exists($formClassDetails->getFullName()));
$entityVarPlural = lcfirst($this->inflector->pluralize($entityClassDetails->getShortName()));
$entityVarSingular = lcfirst($this->inflector->singularize($entityClassDetails->getShortName()));
@ -169,20 +163,21 @@ final class MakeCollectionCrud extends AbstractMaker
$generator->generateController(
$controllerClassDetails->getFullName(),
CRUD_TEMPLATE_PREFIX . '/controller/Controller.tpl.php',
array_merge([
'use_statements' => $useStatements,
'entity_class_name' => $entityClassDetails->getShortName(),
'form_class_name' => $formClassDetails->getShortName(),
'route_path' => Str::asRoutePath($controllerClassDetails->getRelativeNameWithoutSuffix()),
'route_name' => $routeName,
'templates_path' => $templatesPath,
'entity_var_plural' => $entityVarPlural,
'entity_twig_var_plural' => $entityTwigVarPlural,
'entity_var_singular' => $entityVarSingular,
'entity_twig_var_singular' => $entityTwigVarSingular,
'entity_identifier' => $entityDoctrineDetails->getIdentifier(),
'use_render_form' => method_exists(AbstractController::class, 'renderForm'),
],
array_merge(
[
'use_statements' => $useStatements,
'entity_class_name' => $entityClassDetails->getShortName(),
'form_class_name' => $formClassDetails->getShortName(),
'route_path' => Str::asRoutePath($controllerClassDetails->getRelativeNameWithoutSuffix()),
'route_name' => $routeName,
'templates_path' => $templatesPath,
'entity_var_plural' => $entityVarPlural,
'entity_twig_var_plural' => $entityTwigVarPlural,
'entity_var_singular' => $entityVarSingular,
'entity_twig_var_singular' => $entityTwigVarSingular,
'entity_identifier' => $entityDoctrineDetails->getIdentifier(),
'use_render_form' => method_exists(AbstractController::class, 'renderForm'),
],
$repositoryVars
)
);
@ -224,15 +219,17 @@ final class MakeCollectionCrud extends AbstractMaker
],
];
foreach ($templates as $template => $variables) {
foreach ($templates as $template => $variables)
{
$generator->generateTemplate(
$templatesPath.'/'.$template.'.html.twig',
CRUD_TEMPLATE_PREFIX . '/templates/'.$template.'.tpl.php',
$templatesPath . '/' . $template . '.html.twig',
CRUD_TEMPLATE_PREFIX . '/templates/' . $template . '.tpl.php',
$variables
);
}
if ($this->generateTests) {
if ($this->generateTests)
{
$testClassDetails = $generator->createClassNameDetails(
$entityClassDetails->getRelativeNameWithoutSuffix(),
'Test\\Controller\\',
@ -248,12 +245,13 @@ final class MakeCollectionCrud extends AbstractMaker
$usesEntityManager = EntityManagerInterface::class === $repositoryClassName;
if ($usesEntityManager) {
if ($usesEntityManager)
{
$useStatements->addUseStatement(EntityRepository::class);
}
$generator->generateFile(
'tests/Controller/'.$testClassDetails->getShortName().'.php',
'tests/Controller/' . $testClassDetails->getShortName() . '.php',
$usesEntityManager ? 'crud/test/Test.EntityManager.tpl.php' : 'crud/test/Test.tpl.php',
[
'use_statements' => $useStatements,
@ -270,7 +268,8 @@ final class MakeCollectionCrud extends AbstractMaker
]
);
if (!class_exists(WebTestCase::class)) {
if ( ! class_exists(WebTestCase::class))
{
$io->caution('You\'ll need to install the `symfony/test-pack` to execute the tests for your new controller.');
}
}

View File

@ -10,46 +10,45 @@ use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20221117193508 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
final class Version20221117193508 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('DROP SEQUENCE collection.battery_type_id_seq CASCADE');
$this->addSql('CREATE TABLE collection.chipset (id SERIAL NOT NULL, brand_id INT NOT NULL, name VARCHAR(255) NOT NULL, parts VARCHAR(255) NOT NULL, link VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_110BAE8044F5D008 ON collection.chipset (brand_id)');
$this->addSql('CREATE TABLE collection.motherboard (id SERIAL NOT NULL, brand_id INT NOT NULL, chipset_id INT DEFAULT NULL, model VARCHAR(255) NOT NULL, link VARCHAR(255) NOT NULL, notes TEXT DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_5C3F5E3144F5D008 ON collection.motherboard (brand_id)');
$this->addSql('CREATE INDEX IDX_5C3F5E31BC1433B9 ON collection.motherboard (chipset_id)');
$this->addSql('CREATE TABLE collection.motherboard_socket_link (motherboard_id INT NOT NULL, socket_id INT NOT NULL, PRIMARY KEY(motherboard_id, socket_id))');
$this->addSql('CREATE INDEX IDX_D635BC6D6511E8A3 ON collection.motherboard_socket_link (motherboard_id)');
$this->addSql('CREATE INDEX IDX_D635BC6DD20E239C ON collection.motherboard_socket_link (socket_id)');
$this->addSql('ALTER TABLE collection.chipset ADD CONSTRAINT FK_110BAE8044F5D008 FOREIGN KEY (brand_id) REFERENCES collection.brand (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE collection.motherboard ADD CONSTRAINT FK_5C3F5E3144F5D008 FOREIGN KEY (brand_id) REFERENCES collection.brand (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE collection.motherboard ADD CONSTRAINT FK_5C3F5E31BC1433B9 FOREIGN KEY (chipset_id) REFERENCES collection.chipset (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE collection.motherboard_socket_link ADD CONSTRAINT FK_D635BC6D6511E8A3 FOREIGN KEY (motherboard_id) REFERENCES collection.motherboard (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE collection.motherboard_socket_link ADD CONSTRAINT FK_D635BC6DD20E239C FOREIGN KEY (socket_id) REFERENCES collection.socket (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('DROP TABLE collection.battery_type');
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('DROP SEQUENCE collection.battery_type_id_seq CASCADE');
$this->addSql('CREATE TABLE collection.chipset (id SERIAL NOT NULL, brand_id INT NOT NULL, name VARCHAR(255) NOT NULL, parts VARCHAR(255) NOT NULL, link VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_110BAE8044F5D008 ON collection.chipset (brand_id)');
$this->addSql('CREATE TABLE collection.motherboard (id SERIAL NOT NULL, brand_id INT NOT NULL, chipset_id INT DEFAULT NULL, model VARCHAR(255) NOT NULL, link VARCHAR(255) NOT NULL, notes TEXT DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_5C3F5E3144F5D008 ON collection.motherboard (brand_id)');
$this->addSql('CREATE INDEX IDX_5C3F5E31BC1433B9 ON collection.motherboard (chipset_id)');
$this->addSql('CREATE TABLE collection.motherboard_socket_link (motherboard_id INT NOT NULL, socket_id INT NOT NULL, PRIMARY KEY(motherboard_id, socket_id))');
$this->addSql('CREATE INDEX IDX_D635BC6D6511E8A3 ON collection.motherboard_socket_link (motherboard_id)');
$this->addSql('CREATE INDEX IDX_D635BC6DD20E239C ON collection.motherboard_socket_link (socket_id)');
$this->addSql('ALTER TABLE collection.chipset ADD CONSTRAINT FK_110BAE8044F5D008 FOREIGN KEY (brand_id) REFERENCES collection.brand (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE collection.motherboard ADD CONSTRAINT FK_5C3F5E3144F5D008 FOREIGN KEY (brand_id) REFERENCES collection.brand (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE collection.motherboard ADD CONSTRAINT FK_5C3F5E31BC1433B9 FOREIGN KEY (chipset_id) REFERENCES collection.chipset (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE collection.motherboard_socket_link ADD CONSTRAINT FK_D635BC6D6511E8A3 FOREIGN KEY (motherboard_id) REFERENCES collection.motherboard (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE collection.motherboard_socket_link ADD CONSTRAINT FK_D635BC6DD20E239C FOREIGN KEY (socket_id) REFERENCES collection.socket (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('DROP TABLE collection.battery_type');
}
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('CREATE SEQUENCE collection.battery_type_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE TABLE collection.battery_type (id SERIAL NOT NULL, PRIMARY KEY(id))');
$this->addSql('ALTER TABLE collection.chipset DROP CONSTRAINT FK_110BAE8044F5D008');
$this->addSql('ALTER TABLE collection.motherboard DROP CONSTRAINT FK_5C3F5E3144F5D008');
$this->addSql('ALTER TABLE collection.motherboard DROP CONSTRAINT FK_5C3F5E31BC1433B9');
$this->addSql('ALTER TABLE collection.motherboard_socket_link DROP CONSTRAINT FK_D635BC6D6511E8A3');
$this->addSql('ALTER TABLE collection.motherboard_socket_link DROP CONSTRAINT FK_D635BC6DD20E239C');
$this->addSql('DROP TABLE collection.chipset');
$this->addSql('DROP TABLE collection.motherboard');
$this->addSql('DROP TABLE collection.motherboard_socket_link');
}
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('CREATE SEQUENCE collection.battery_type_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE TABLE collection.battery_type (id SERIAL NOT NULL, PRIMARY KEY(id))');
$this->addSql('ALTER TABLE collection.chipset DROP CONSTRAINT FK_110BAE8044F5D008');
$this->addSql('ALTER TABLE collection.motherboard DROP CONSTRAINT FK_5C3F5E3144F5D008');
$this->addSql('ALTER TABLE collection.motherboard DROP CONSTRAINT FK_5C3F5E31BC1433B9');
$this->addSql('ALTER TABLE collection.motherboard_socket_link DROP CONSTRAINT FK_D635BC6D6511E8A3');
$this->addSql('ALTER TABLE collection.motherboard_socket_link DROP CONSTRAINT FK_D635BC6DD20E239C');
$this->addSql('DROP TABLE collection.chipset');
$this->addSql('DROP TABLE collection.motherboard');
$this->addSql('DROP TABLE collection.motherboard_socket_link');
}
}

View File

@ -7,39 +7,43 @@ use Doctrine\ORM\{EntityRepository};
use ReflectionObject;
use Throwable;
abstract class AcquireRepository extends EntityRepository
{
abstract public function reacquire(mixed $currentRecord): void;
abstract class AcquireRepository extends EntityRepository {
abstract public function reacquire(mixed $currentRecord): void;
abstract public function deacquire(mixed $currentRecord): void;
abstract public function deacquire(mixed $currentRecord): void;
/**
* Move a record from the table represented by $currentRecord
* into the table represented by $newRecord
*/
protected function moveRecord(mixed $currentRecord, mixed $newRecord): void
{
$em = $this->getEntityManager();
/**
* Move a record from the table represented by $currentRecord
* into the table represented by $newRecord
*/
protected function moveRecord(mixed $currentRecord, mixed $newRecord): void
{
$em = $this->getEntityManager();
$old = new ReflectionObject($currentRecord);
$new = new ReflectionObject($newRecord);
$old = new ReflectionObject($currentRecord);
$new = new ReflectionObject($newRecord);
foreach ($old->getProperties() as $property) {
$propertyName = $property->getName();
if ($new->hasProperty($propertyName)) {
$newProperty = $new->getProperty($propertyName);
$newProperty->setAccessible(TRUE);
$property->setAccessible(TRUE);
$newProperty->setValue($newRecord, $property->getValue($currentRecord));
}
}
foreach ($old->getProperties() as $property)
{
$propertyName = $property->getName();
if ($new->hasProperty($propertyName))
{
$newProperty = $new->getProperty($propertyName);
$newProperty->setAccessible(TRUE);
$property->setAccessible(TRUE);
$newProperty->setValue($newRecord, $property->getValue($currentRecord));
}
}
try {
$em->persist($newRecord);
$em->remove($currentRecord);
$em->flush();
} catch (Throwable) {
dump($newRecord);
}
}
try
{
$em->persist($newRecord);
$em->remove($currentRecord);
$em->flush();
}
catch (Throwable)
{
dump($newRecord);
}
}
}

View File

@ -5,26 +5,25 @@ namespace App\Repository;
use App\Entity\{Camera, PreviouslyOwnedCamera};
use Doctrine\ORM\{ORMInvalidArgumentException};
class CameraRepository extends AcquireRepository
{
/**
* @throws ORMInvalidArgumentException
*/
public function deacquire(mixed $currentRecord): void
{
$currentRecord->setFormerlyOwned(TRUE)
->setReceived(TRUE);
class CameraRepository extends AcquireRepository {
/**
* @throws ORMInvalidArgumentException
*/
public function deacquire(mixed $currentRecord): void
{
$currentRecord->setFormerlyOwned(TRUE)
->setReceived(TRUE);
$this->moveRecord($currentRecord, new PreviouslyOwnedCamera());
}
$this->moveRecord($currentRecord, new PreviouslyOwnedCamera());
}
/**
* @throws ORMInvalidArgumentException
*/
public function reacquire(mixed $currentRecord): void
{
$currentRecord->setFormerlyOwned(FALSE);
/**
* @throws ORMInvalidArgumentException
*/
public function reacquire(mixed $currentRecord): void
{
$currentRecord->setFormerlyOwned(FALSE);
$this->moveRecord($currentRecord, new Camera());
}
$this->moveRecord($currentRecord, new Camera());
}
}

View File

@ -5,26 +5,25 @@ namespace App\Repository;
use App\Entity\{Flash, PreviouslyOwnedFlash};
use Doctrine\ORM\{ORMInvalidArgumentException};
class FlashRepository extends AcquireRepository
{
/**
* @throws ORMInvalidArgumentException
*/
public function deacquire(mixed $currentRecord): void
{
$currentRecord->setFormerlyOwned(TRUE)
->setReceived(TRUE);
class FlashRepository extends AcquireRepository {
/**
* @throws ORMInvalidArgumentException
*/
public function deacquire(mixed $currentRecord): void
{
$currentRecord->setFormerlyOwned(TRUE)
->setReceived(TRUE);
$this->moveRecord($currentRecord, new PreviouslyOwnedFlash());
}
$this->moveRecord($currentRecord, new PreviouslyOwnedFlash());
}
/**
* @throws ORMInvalidArgumentException
*/
public function reacquire(mixed $currentRecord): void
{
$currentRecord->setFormerlyOwned(FALSE);
/**
* @throws ORMInvalidArgumentException
*/
public function reacquire(mixed $currentRecord): void
{
$currentRecord->setFormerlyOwned(FALSE);
$this->moveRecord($currentRecord, new Flash());
}
$this->moveRecord($currentRecord, new Flash());
}
}

View File

@ -4,20 +4,19 @@ namespace App\Repository;
use App\Entity\{Lenses, PreviouslyOwnedLenses};
class LensesRepository extends AcquireRepository
{
public function deacquire(mixed $currentRecord): void
{
$currentRecord->setFormerlyOwned(TRUE)
->setReceived(TRUE);
class LensesRepository extends AcquireRepository {
public function deacquire(mixed $currentRecord): void
{
$currentRecord->setFormerlyOwned(TRUE)
->setReceived(TRUE);
$this->moveRecord($currentRecord, new PreviouslyOwnedLenses());
}
$this->moveRecord($currentRecord, new PreviouslyOwnedLenses());
}
public function reacquire(mixed $currentRecord): void
{
$currentRecord->setFormerlyOwned(FALSE);
public function reacquire(mixed $currentRecord): void
{
$currentRecord->setFormerlyOwned(FALSE);
$this->moveRecord($currentRecord, new Lenses());
}
$this->moveRecord($currentRecord, new Lenses());
}
}

View File

@ -32,9 +32,12 @@ 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) && $generator->repositoryHasSaveAndRemoveMethods($repository_full_class_name))
{ ?>
public function new(Request $request, <?= $repository_class_name ?> $<?= $repository_var ?>): Response
<?php } else { ?>
<?php }
else
{ ?>
public function new(Request $request): Response
<?php } ?>
{
@ -48,9 +51,12 @@ 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) && $generator->repositoryHasSaveAndRemoveMethods($repository_full_class_name))
{ ?>
public function edit(Request $request, <?= $entity_class_name ?> $<?= $entity_var_singular ?>, <?= $repository_class_name ?> $<?= $repository_var ?>): Response
<?php } else { ?>
<?php }
else
{ ?>
public function edit(Request $request, <?= $entity_class_name ?> $<?= $entity_var_singular ?>): Response
<?php } ?>
{
@ -58,9 +64,12 @@ 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) && $generator->repositoryHasSaveAndRemoveMethods($repository_full_class_name))
{ ?>
public function delete(Request $request, <?= $entity_class_name ?> $<?= $entity_var_singular ?>, <?= $repository_class_name ?> $<?= $repository_var ?>): Response
<?php } else { ?>
<?php }
else
{ ?>
public function delete(Request $request, <?= $entity_class_name ?> $<?= $entity_var_singular ?>): Response
<?php } ?>
{

View File

@ -7,25 +7,24 @@ use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Types\Type;
class MoneyType extends Type
{
public function getSQLDeclaration(array $column, AbstractPlatform $platform): string
{
return 'MONEY';
}
class MoneyType extends Type {
public function getSQLDeclaration(array $column, AbstractPlatform $platform): string
{
return 'MONEY';
}
public function convertToPHPValue($value, AbstractPlatform $platform): float
{
return (float) (string) new Money($value);
}
public function convertToPHPValue($value, AbstractPlatform $platform): float
{
return (float) (string) new Money($value);
}
public function getName(): string
{
return 'money';
}
public function getName(): string
{
return 'money';
}
public function requiresSQLCommentHint(AbstractPlatform $platform): bool
{
return TRUE;
}
public function requiresSQLCommentHint(AbstractPlatform $platform): bool
{
return TRUE;
}
}

View File

@ -4,22 +4,21 @@ namespace App\ValueObject;
use Stringable;
class Money implements Stringable
{
private readonly float $value;
class Money implements Stringable {
private readonly float $value;
public function __construct(mixed $value)
{
$this->value = (float) str_replace(['$', ','], '', (string) $value);
}
public function __construct(mixed $value)
{
$this->value = (float) str_replace(['$', ','], '', (string) $value);
}
public function getValue(): float
{
return (float) str_replace(['$', ','], '', (string) $this->value);
}
public function __toString(): string
{
return (string) $this->getValue();
}
public function __toString(): string
{
return (string) $this->getValue();
}
public function getValue(): float
{
return (float) str_replace(['$', ','], '', (string) $this->value);
}
}

View File

@ -4,8 +4,11 @@ use Symfony\Component\Dotenv\Dotenv;
require dirname(__DIR__) . '/vendor/autoload.php';
if (file_exists(dirname(__DIR__) . '/config/bootstrap.php')) {
require dirname(__DIR__) . '/config/bootstrap.php';
} elseif (method_exists(Dotenv::class, 'bootEnv')) {
(new Dotenv())->bootEnv(dirname(__DIR__) . '/.env');
if (file_exists(dirname(__DIR__) . '/config/bootstrap.php'))
{
require dirname(__DIR__) . '/config/bootstrap.php';
}
elseif (method_exists(Dotenv::class, 'bootEnv'))
{
(new Dotenv())->bootEnv(dirname(__DIR__) . '/.env');
}

View File

@ -2,7 +2,8 @@
function walk_array(callable $method, array $items): void
{
foreach ($items as $item) {
$method($item);
}
foreach ($items as $item)
{
$method($item);
}
}

View File

@ -1,92 +1,92 @@
<?php declare(strict_types=1);
return [
'' => '',
'4x4' => '4x4cm',
'5V 32-bit PCI' => '5V 32-bit PCI',
'5V 64-bit PCI' => '5V 64-bit PCI',
'6x6' => '6x6cm',
'6x4.5' => '6x4.5cm',
'8-bit ISA' => '8-bit ISA',
'16-bit ISA' => '16-bit ISA',
'35mm' => '35mm',
'1.5V AGP' => '1.5V AGP',
'110' => '110',
'120' => '120',
'127' => '127',
'3.3V 32-bit PCI' => '3.3V 32-bit PCI',
'3.3V 64-bit PCI' => '3.3V 64-bit PCI',
'3.3V AGP' => '3.3V AGP',
'3.3V PCI 33' => '3.3V PCI 33',
'620' => '620',
'Acquired' => 'Acquired',
'AGP 1x' => 'AGP 1x',
'AGP 2x' => 'AGP 2x',
'AGP 4x' => 'AGP 4x',
'AGP 8x' => 'AGP 8x',
'AGP' => 'AGP',
'Alternate model name' => 'Alternate Model Name',
'Aperture blades' => '# of Aperture Blades',
'APS-C' => 'APS-C',
'Architecture link' => 'Architecture Link',
'Architecture' => 'Architecture',
'arm' => 'arm',
'arm64' => 'arm64',
'B & W' => 'B & W',
'Base speed' => 'Base Speed',
'Batteries' => 'Batteries',
'Battery type' => 'Battery Type',
'Board brand' => 'GPU Board Brand',
'Boost speed' => 'Boost Speed',
'Brand' => 'Brand',
'Bus interface' => 'Bus Interface',
'C-41' => 'C-41',
'Card key' => 'Card Interface Keying',
'Categories' => 'Categories',
'Cellulose Triacetate' => 'Cellulose Triacetate',
'Chemistry' => 'Film Chemistry',
'Clock speed' => 'Clock Speed (MHz)',
'Coatings' => 'Coatings',
'Code name' => 'Codename',
'Common' => 'Common',
'Compute units' => 'Compute Units/Cores',
'Cores' => 'Cores',
'Count' => 'Count',
'Crop factor' => 'Crop Factor',
'Description' => 'Description',
'Design elements' => '# of Design Elements',
'Design groups' => '# of Design Groups',
'Developed rolls' => '# of Developed Rolls',
'DirectX Support' => 'DirectX Support',
'DUAL_INLINE_PACKAGE' => 'DIP',
'E-6' => 'E-6',
'Film alias' => 'Film Alias',
'Film base' => 'Film Base',
'Film format' => 'Film Format',
'Film name' => 'Film Name',
'Film speed asa' => 'Film Speed (ASA)',
'Film speed din' => 'Film Speed (DIN)',
'Formerly owned' => 'Formerly Owned',
'Front filter size' => 'Front filter size (mm)',
'' => '',
'4x4' => '4x4cm',
'5V 32-bit PCI' => '5V 32-bit PCI',
'5V 64-bit PCI' => '5V 64-bit PCI',
'6x6' => '6x6cm',
'6x4.5' => '6x4.5cm',
'8-bit ISA' => '8-bit ISA',
'16-bit ISA' => '16-bit ISA',
'35mm' => '35mm',
'1.5V AGP' => '1.5V AGP',
'110' => '110',
'120' => '120',
'127' => '127',
'3.3V 32-bit PCI' => '3.3V 32-bit PCI',
'3.3V 64-bit PCI' => '3.3V 64-bit PCI',
'3.3V AGP' => '3.3V AGP',
'3.3V PCI 33' => '3.3V PCI 33',
'620' => '620',
'Acquired' => 'Acquired',
'AGP 1x' => 'AGP 1x',
'AGP 2x' => 'AGP 2x',
'AGP 4x' => 'AGP 4x',
'AGP 8x' => 'AGP 8x',
'AGP' => 'AGP',
'Alternate model name' => 'Alternate Model Name',
'Aperture blades' => '# of Aperture Blades',
'APS-C' => 'APS-C',
'Architecture link' => 'Architecture Link',
'Architecture' => 'Architecture',
'arm' => 'arm',
'arm64' => 'arm64',
'B & W' => 'B & W',
'Base speed' => 'Base Speed',
'Batteries' => 'Batteries',
'Battery type' => 'Battery Type',
'Board brand' => 'GPU Board Brand',
'Boost speed' => 'Boost Speed',
'Brand' => 'Brand',
'Bus interface' => 'Bus Interface',
'C-41' => 'C-41',
'Card key' => 'Card Interface Keying',
'Categories' => 'Categories',
'Cellulose Triacetate' => 'Cellulose Triacetate',
'Chemistry' => 'Film Chemistry',
'Clock speed' => 'Clock Speed (MHz)',
'Coatings' => 'Coatings',
'Code name' => 'Codename',
'Common' => 'Common',
'Compute units' => 'Compute Units/Cores',
'Cores' => 'Cores',
'Count' => 'Count',
'Crop factor' => 'Crop Factor',
'Description' => 'Description',
'Design elements' => '# of Design Elements',
'Design groups' => '# of Design Groups',
'Developed rolls' => '# of Developed Rolls',
'DirectX Support' => 'DirectX Support',
'DUAL_INLINE_PACKAGE' => 'DIP',
'E-6' => 'E-6',
'Film alias' => 'Film Alias',
'Film base' => 'Film Base',
'Film format' => 'Film Format',
'Film name' => 'Film Name',
'Film speed asa' => 'Film Speed (ASA)',
'Film speed din' => 'Film Speed (DIN)',
'Formerly owned' => 'Formerly Owned',
'Front filter size' => 'Front filter size (mm)',
'Generation link' => 'Generation Link',
'Generation name' => 'Generation Name',
'GPU Base Clock (MHz)' => 'GPU Base Clock (MHz)',
'GPU Boost Clock (MHz)' => 'GPU Boost Clock (MHz)',
'Gpu brand' => 'GPU Brand',
'Gpu core' => 'GPU Core',
'Guide number' => 'Guide Number',
'Guide number' => 'Guide Number',
'Historical' => 'Historical',
'IBM POWER' => 'IBM POWER',
'Igp' => 'IGP',
'Image size' => 'Image Size',
'Image size' => 'Image Size',
'Intel 8088' => 'Intel 8088',
'Intel 80186' => 'Intel 80186',
'Is auto flash' => 'Is auto flash',
'Is digital' => 'Is Digital',
'Is p ttl' => 'Is P-TTL',
'Is teleconverter' => 'Is teleconverter',
'Is ttl' => 'Is TTL',
'Is working' => 'Is Working',
'Is auto flash' => 'Is auto flash',
'Is digital' => 'Is Digital',
'Is p ttl' => 'Is P-TTL',
'Is teleconverter' => 'Is teleconverter',
'Is ttl' => 'Is TTL',
'Is working' => 'Is Working',
'ISA' => 'ISA',
'L1 Cache' => 'Level 1 Cache',
'L1 Data (x-way)' => 'L1 Data (x-way)',
@ -109,32 +109,32 @@ return [
'LEAD_LESS_CHIP_CARRIER' => 'Leadless Chip Carrier',
'Link' => 'Link',
'Lot number' => 'Lot Number',
'Max f stop' => 'Max aperture (smallest f number)',
'Max focal length' => 'Max focal length (mm)',
'Medium Format' => 'Medium Format',
'Max f stop' => 'Max aperture (smallest f number)',
'Max focal length' => 'Max focal length (mm)',
'Medium Format' => 'Medium Format',
'Memory Bus Size (bits)' => 'Memory Bus Size (bits)',
'Memory Size (MB)' => 'Memory Size (MB)',
'Memory Speed (MHz)' => 'Memory Speed (MHz)',
'Memory type' => 'Memory Type',
'Micro 4/3' => 'μ 4/3',
'Micro 4/3' => 'μ 4/3',
'Micro architecture' => 'μArchitecture',
'Min f stop' => 'Min aperture (largest f number)',
'Min focal length' => 'Min focal length (mm)',
'Min f stop' => 'Min aperture (largest f number)',
'Min focal length' => 'Min focal length (mm)',
'MIPS' => 'MIPS',
'Model name' => 'Model Name',
'Model' => 'Model',
'Model' => 'Model',
'Molex Power Connectors' => 'Molex Power Connectors',
'MOS 6502' => 'MOS 6502',
'Motorola 68k' => 'Motorola 68k',
'Mount' => 'Mount',
'Mount' => 'Mount',
'Name' => 'Name',
'Notes' => 'Notes',
'Notes' => 'Notes',
'OpenCL Support' => 'OpenCL Support',
'OpenGL Support' => 'OpenGL Support',
'Other name' => 'Other Name',
'Other' => 'Other',
'Other' => 'Other',
'Others' => 'Others',
'P ttl type' => 'P-TTL Type',
'P ttl type' => 'P-TTL Type',
'Parts' => 'Parts',
'Part number' => 'Part Number',
'PCI 32-bit' => 'PCI 32-bit',
@ -163,37 +163,37 @@ return [
'Pin count' => 'Pin Count',
'PIN_GRID_ARRAY' => 'PGA',
'PLASTIC_LEADED_CHIP_CARRIER' => 'Plastic Leaded Chip Carrier',
'Polyester' => 'Polyester',
'Polyester' => 'Polyester',
'Polyethylene Naphtalate' => 'Polyethylene Naphtalate',
'PowerPC' => 'PowerPC',
'Process node' => 'Process Node',
'Product line' => 'Product Line',
'Purchase price' => 'Purchase Price',
'Rear filter size' => 'Rear filter size (mm)',
'Received' => 'Received',
'Product line' => 'Product Line',
'Purchase price' => 'Purchase Price',
'Rear filter size' => 'Rear filter size (mm)',
'Received' => 'Received',
'RISC V' => 'RISC V',
'Rolls in camera' => '# of Rolls in a Camera',
'Rolls in camera' => '# of Rolls in a Camera',
'ROPs' => 'ROPs',
'Serial' => 'Serial',
'Serial' => 'Serial',
'Series' => 'Series',
'Shader model' => 'Shader Model',
'Shading units' => 'Shading Units',
'Slot span' => 'Slot Span',
'SLOT' => 'Slot',
'Small Format' => 'Small Format',
'Small Format' => 'Small Format',
'Socket' => 'Socket',
'Sockets' => 'Sockets',
'TDP (Watts)' => 'TDP (Watts)',
'Tdp' => 'TDP',
'Threads' => 'Threads',
'TMUs' => 'TMUs',
'Ttl type' => 'TTL Type',
'Type' => 'Type',
'Ttl type' => 'TTL Type',
'Type' => 'Type',
'Universal 32-bit PCI' => 'Universal 32-bit PCI',
'Universal 64-bit PCI' => 'Universal 64-bit PCI',
'Universal AGP' => 'Universal AGP',
'Unknown' => 'Unknown',
'Unused rolls' => '# of Unused Rolls',
'Unused rolls' => '# of Unused Rolls',
'Usable' => 'Usable',
'Variant' => 'Variant',
'VESA Local Bus' => 'VESA Local Bus',

Some files were not shown because too many files have changed in this diff Show More