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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,15 +2,14 @@
declare(strict_types=1); declare(strict_types=1);
use Symfony\Config\FrameworkConfig;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symfony\Config\FrameworkConfig;
return static function (ContainerConfigurator $containerConfigurator, FrameworkConfig $config): void { return static function (ContainerConfigurator $containerConfigurator, FrameworkConfig $config): void {
$config->session(['handler_id' => null]); $config->session(['handler_id' => NULL]);
$config->secret('%env(APP_SECRET)%') $config->secret('%env(APP_SECRET)%')
->defaultLocale('en') ->defaultLocale('en')
->httpMethodOverride(true) ->httpMethodOverride(TRUE)
->phpErrors(['log' => 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; use function Symfony\Component\DependencyInjection\Loader\Configurator\service;
return static function (ContainerConfigurator $containerConfigurator): void { return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->extension('doctrine', [ $containerConfigurator->extension('doctrine', [
'orm' => [ 'orm' => [
'metadata_cache_driver' => [ 'metadata_cache_driver' => [
'type' => 'service', 'type' => 'service',
'id' => 'doctrine.system_cache_provider' 'id' => 'doctrine.system_cache_provider',
], ],
'query_cache_driver' => [ 'query_cache_driver' => [
'type' => 'service', 'type' => 'service',
'id' => 'doctrine.system_cache_provider' 'id' => 'doctrine.system_cache_provider',
], ],
'result_cache_driver' => [ 'result_cache_driver' => [
'type' => 'service', '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') $services->set('doctrine.result_cache_provider', 'Symfony\Component\Cache\DoctrineProvider')
->private() ->private()
->args([service('doctrine.result_cache_pool')]); ->args([service('doctrine.result_cache_pool')]);
$services->set('doctrine.system_cache_provider', 'Symfony\Component\Cache\DoctrineProvider') $services->set('doctrine.system_cache_provider', 'Symfony\Component\Cache\DoctrineProvider')
->private() ->private()
->args([service('doctrine.system_cache_pool')]); ->args([service('doctrine.system_cache_pool')]);
$containerConfigurator->extension('framework', [ $containerConfigurator->extension('framework', [
'cache' => [ 'cache' => [
'pools' => [ 'pools' => [
'doctrine.result_cache_pool' => [ 'doctrine.result_cache_pool' => [
'adapter' => 'cache.app' 'adapter' => 'cache.app',
], ],
'doctrine.system_cache_pool' => [ 'doctrine.system_cache_pool' => [
'adapter' => 'cache.system' 'adapter' => 'cache.system',
] ],
] ],
] ],
]); ]);
}; };

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -5,5 +5,5 @@ declare(strict_types=1);
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void { 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; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void { 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; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void { 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; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void { 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; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void { 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; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void { return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->extension('framework', [ $containerConfigurator->extension('framework', [
'default_locale' => 'en', 'default_locale' => 'en',
'translator' => [ 'translator' => [
'default_path' => '%kernel.project_dir%/translations', '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']) $config->formThemes(['form_custom_layout.html.twig'])
->defaultPath('%kernel.project_dir%/templates') ->defaultPath('%kernel.project_dir%/templates')
->debug('%kernel.debug%') ->debug('%kernel.debug%')
->strictVariables('%kernel.debug%') ->strictVariables('%kernel.debug%');
;
}; };

View File

@ -3,5 +3,5 @@
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void { 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); <?php declare(strict_types=1);
if (file_exists(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'; {
require dirname(__DIR__) . '/var/cache/prod/App_KernelProdContainer.preload.php';
} }

View File

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

View File

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

View File

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

View File

@ -11,18 +11,21 @@ require dirname(__DIR__) . '/vendor/autoload.php';
(new Dotenv())->bootEnv(dirname(__DIR__) . '/.env'); (new Dotenv())->bootEnv(dirname(__DIR__) . '/.env');
if ($_SERVER['APP_DEBUG']) { if ($_SERVER['APP_DEBUG'])
umask(0000); {
umask(0000);
Debug::enable(); Debug::enable();
} }
if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? FALSE) { if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? FALSE)
Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST); {
Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST);
} }
if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? FALSE) { if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? FALSE)
Request::setTrustedHosts([$trustedHosts]); {
Request::setTrustedHosts([$trustedHosts]);
} }
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']); $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; namespace App\Controller;
@ -6,13 +6,11 @@ use App\Entity\BrandCategory;
use App\Form\BrandCategoryType; use App\Form\BrandCategoryType;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\{Request, Response};
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
#[Route('/brand/category')] #[Route('/brand/category')]
class BrandCategoryController extends AbstractController class BrandCategoryController extends AbstractController {
{
use FormControllerBase; use FormControllerBase;
protected const ENTITY = BrandCategory::class; protected const ENTITY = BrandCategory::class;
@ -24,33 +22,33 @@ class BrandCategoryController extends AbstractController
{ {
} }
#[Route('/', name: 'brand-category_index', methods: ['GET'])] #[Route('/', name: 'brand-category_index', methods: ['GET'])]
public function index(): Response public function index(): Response
{ {
return $this->indexView('brand_categories'); return $this->indexView('brand_categories');
} }
#[Route('/new', name: 'brand-category_new', methods: ['GET', 'POST'])] #[Route('/new', name: 'brand-category_new', methods: ['GET', 'POST'])]
public function new(Request $request, EntityManagerInterface $entityManager): Response public function new(Request $request, EntityManagerInterface $entityManager): Response
{ {
return $this->itemCreate($request, 'brand_category'); return $this->itemCreate($request, 'brand_category');
} }
#[Route('/{name}', name: 'brand-category_show', methods: ['GET'])] #[Route('/{name}', name: 'brand-category_show', methods: ['GET'])]
public function show(BrandCategory $brandCategory): Response public function show(BrandCategory $brandCategory): Response
{ {
return $this->itemView($brandCategory, 'brand_category'); return $this->itemView($brandCategory, 'brand_category');
} }
#[Route('/{name}/edit', name: 'brand-category_edit', methods: ['GET', 'POST'])] #[Route('/{name}/edit', name: 'brand-category_edit', methods: ['GET', 'POST'])]
public function edit(Request $request, BrandCategory $brandCategory): Response public function edit(Request $request, BrandCategory $brandCategory): Response
{ {
return $this->itemUpdate($request, $brandCategory, 'brand_category'); return $this->itemUpdate($request, $brandCategory, 'brand_category');
} }
#[Route('/{name}', name: 'brand-category_delete', methods: ['POST'])] #[Route('/{name}', name: 'brand-category_delete', methods: ['POST'])]
public function delete(Request $request, BrandCategory $brandCategory): Response public function delete(Request $request, BrandCategory $brandCategory): Response
{ {
return $this->deleteCSRF($request, $brandCategory); return $this->deleteCSRF($request, $brandCategory);
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -6,185 +6,191 @@ use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\{RedirectResponse, Request, Response}; use Symfony\Component\HttpFoundation\{RedirectResponse, Request, Response};
trait FormControllerBase trait FormControllerBase {
{
public function __construct(private readonly EntityManagerInterface $entityManager) public function __construct(private readonly EntityManagerInterface $entityManager)
{ {
} }
/** /**
* Create a form generator * Create a form generator
*/ */
protected function buildForm(mixed $item, string $actionRoute, string $method = 'POST'): FormInterface protected function buildForm(mixed $item, string $actionRoute, string $method = 'POST'): FormInterface
{ {
return $this->createFormBuilder() return $this->createFormBuilder()
->setAction($this->generateUrl($actionRoute, ['id' => $item->getId()])) ->setAction($this->generateUrl($actionRoute, ['id' => $item->getId()]))
->setMethod($method) ->setMethod($method)
->getForm(); ->getForm();
} }
/** /**
* Show create form / create an item * Show create form / create an item
*/ */
protected function itemCreate(Request $request, string $templateKey): RedirectResponse|Response protected function itemCreate(Request $request, string $templateKey): RedirectResponse|Response
{ {
$template = self::TEMPLATE_PATH . 'new.html.twig'; $template = self::TEMPLATE_PATH . 'new.html.twig';
$redirectRoute = self::ROUTE_PREFIX . 'show'; $redirectRoute = self::ROUTE_PREFIX . 'show';
$Entity = self::ENTITY; $Entity = self::ENTITY;
$item = new $Entity(); $item = new $Entity();
$form = $this->createForm(self::FORM, $item); $form = $this->createForm(self::FORM, $item);
$form->handleRequest($request); $form->handleRequest($request);
// If creating the item // If creating the item
if ($form->isSubmitted() && $form->isValid()) { if ($form->isSubmitted() && $form->isValid())
$this->entityManager->persist($item); {
$this->entityManager->flush(); $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 // If showing the form
return $this->render($template, [ return $this->render($template, [
$templateKey => $item, $templateKey => $item,
'form' => $form->createView(), 'form' => $form->createView(),
]); ]);
} }
protected function indexView(string $templateKey, array $sort = []): Response protected function indexView(string $templateKey, array $sort = []): Response
{ {
return $this->itemListView($templateKey, $sort); return $this->itemListView($templateKey, $sort);
} }
/** /**
* List view for the data type * List view for the data type
*/ */
protected function itemListView(string $templateKey, array $sort = []): Response protected function itemListView(string $templateKey, array $sort = []): Response
{ {
$template = self::TEMPLATE_PATH . 'index.html.twig'; $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, [ return $this->render($template, [
$templateKey => $items, $templateKey => $items,
]); ]);
} }
/** /**
* View details for a specific item * View details for a specific item
*/ */
protected function itemView(mixed $item, string $templateKey): Response protected function itemView(mixed $item, string $templateKey): Response
{ {
$template = self::TEMPLATE_PATH . 'show.html.twig'; $template = self::TEMPLATE_PATH . 'show.html.twig';
$templateData = [ $templateData = [
$templateKey => $item, $templateKey => $item,
]; ];
if (method_exists($this, 'createDeleteForm')) { if (method_exists($this, 'createDeleteForm'))
$deleteForm = $this->createDeleteForm($item); {
$templateData['delete_form'] = $deleteForm->createView(); $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 * Show edit form / update an item
*/ */
protected function itemUpdate(Request $request, mixed $item, string $templateKey): RedirectResponse|Response protected function itemUpdate(Request $request, mixed $item, string $templateKey): RedirectResponse|Response
{ {
$template = self::TEMPLATE_PATH . 'edit.html.twig'; $template = self::TEMPLATE_PATH . 'edit.html.twig';
$redirectRoute = self::ROUTE_PREFIX . 'show'; $redirectRoute = self::ROUTE_PREFIX . 'show';
$editForm = $this->createForm(self::FORM, $item); $editForm = $this->createForm(self::FORM, $item);
$editForm->handleRequest($request); $editForm->handleRequest($request);
// If updating the item // If updating the item
if ($editForm->isSubmitted() && $editForm->isValid()) { if ($editForm->isSubmitted() && $editForm->isValid())
$this->entityManager->persist($item); {
$this->entityManager->flush(); $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 // If showing the edit form
$templateData = [ $templateData = [
$templateKey => $item, $templateKey => $item,
'form' => $editForm->createView(), 'form' => $editForm->createView(),
]; ];
if (method_exists($this, 'createDeleteForm')) { if (method_exists($this, 'createDeleteForm'))
$deleteForm = $this->createDeleteForm($item); {
$templateData['delete_form'] = $deleteForm->createView(); $deleteForm = $this->createDeleteForm($item);
} $templateData['delete_form'] = $deleteForm->createView();
}
if (method_exists($this, 'createDeacquireForm')) { if (method_exists($this, 'createDeacquireForm'))
$deacquireForm = $this->createDeacquireForm($item); {
$templateData['deacquire_form'] = $deacquireForm->createView(); $deacquireForm = $this->createDeacquireForm($item);
} $templateData['deacquire_form'] = $deacquireForm->createView();
}
if (method_exists($this, 'createReacquireForm')) { if (method_exists($this, 'createReacquireForm'))
$reacquireForm = $this->createReacquireForm($item); {
$templateData['reacquire_form'] = $reacquireForm->createView(); $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 * Move an item to a previously_owned table
*/ */
protected function itemDeacquire(Request $request, mixed $item, string $redirectRoute): RedirectResponse protected function itemDeacquire(Request $request, mixed $item, string $redirectRoute): RedirectResponse
{ {
$form = $this->createDeacquireForm($item); $form = $this->createDeacquireForm($item);
$form->handleRequest($request); $form->handleRequest($request);
$repository = $this->entityManager->getRepository(self::ENTITY); $repository = $this->entityManager->getRepository(self::ENTITY);
$repository->deacquire($item); $repository->deacquire($item);
return $this->redirectToRoute($redirectRoute); return $this->redirectToRoute($redirectRoute);
} }
/** /**
* Move an item from a previously_owned table back to the original table * Move an item from a previously_owned table back to the original table
*/ */
protected function itemReacquire(Request $request, mixed $item, string $redirectRoute): RedirectResponse protected function itemReacquire(Request $request, mixed $item, string $redirectRoute): RedirectResponse
{ {
$form = $this->createReacquireForm($item); $form = $this->createReacquireForm($item);
$form->handleRequest($request); $form->handleRequest($request);
$repository = $this->entityManager->getRepository(self::ENTITY); $repository = $this->entityManager->getRepository(self::ENTITY);
$repository->reacquire($item); $repository->reacquire($item);
return $this->redirectToRoute($redirectRoute); return $this->redirectToRoute($redirectRoute);
} }
/** /**
* Actually delete an item * Actually delete an item
*/ */
protected function itemDelete(Request $request, mixed $item): RedirectResponse protected function itemDelete(Request $request, mixed $item): RedirectResponse
{ {
$redirectRoute = self::ROUTE_PREFIX . 'index'; $redirectRoute = self::ROUTE_PREFIX . 'index';
$form = $this->createDeleteForm($item); $form = $this->createDeleteForm($item);
$form->handleRequest($request); $form->handleRequest($request);
// if ($this->isCsrfTokenValid((string)$item->getId(), $request->request->get('_token'))) { // if ($this->isCsrfTokenValid((string)$item->getId(), $request->request->get('_token'))) {
$this->entityManager->remove($item); $this->entityManager->remove($item);
$this->entityManager->flush(); $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 protected function deleteCSRF(Request $request, mixed $item): RedirectResponse
{ {
if ($this->isCsrfTokenValid('delete' . $item->getId(), $request->request->get('_token'))) { if ($this->isCsrfTokenValid('delete' . $item->getId(), $request->request->get('_token')))
$this->entityManager->remove($item); {
$this->entityManager->flush(); $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; namespace App\Controller;
@ -6,13 +6,11 @@ use App\Entity\Fpu;
use App\Form\FpuType; use App\Form\FpuType;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\{Request, Response};
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
#[Route('/fpu')] #[Route('/fpu')]
class FpuController extends AbstractController class FpuController extends AbstractController {
{
use FormControllerBase; use FormControllerBase;
protected const ENTITY = Fpu::class; protected const ENTITY = Fpu::class;
@ -24,33 +22,33 @@ class FpuController extends AbstractController
{ {
} }
#[Route('/', name: 'fpu_index', methods: ['GET'])] #[Route('/', name: 'fpu_index', methods: ['GET'])]
public function index(): Response public function index(): Response
{ {
return $this->indexView('fpus', []); return $this->indexView('fpus', []);
} }
#[Route('/new', name: 'fpu_new', methods: ['GET', 'POST'])] #[Route('/new', name: 'fpu_new', methods: ['GET', 'POST'])]
public function new(Request $request): Response public function new(Request $request): Response
{ {
return $this->itemCreate($request, 'fpu'); return $this->itemCreate($request, 'fpu');
} }
#[Route('/{id}', name: 'fpu_show', methods: ['GET'])] #[Route('/{id}', name: 'fpu_show', methods: ['GET'])]
public function show(Fpu $fpu): Response public function show(Fpu $fpu): Response
{ {
return $this->itemView($fpu, 'fpu'); return $this->itemView($fpu, 'fpu');
} }
#[Route('/{id}/edit', name: 'fpu_edit', methods: ['GET', 'POST'])] #[Route('/{id}/edit', name: 'fpu_edit', methods: ['GET', 'POST'])]
public function edit(Request $request, Fpu $fpu): Response public function edit(Request $request, Fpu $fpu): Response
{ {
return $this->itemUpdate($request, $fpu, 'fpu'); return $this->itemUpdate($request, $fpu, 'fpu');
} }
#[Route('/{id}', name: 'fpu_delete', methods: ['POST'])] #[Route('/{id}', name: 'fpu_delete', methods: ['POST'])]
public function delete(Request $request, Fpu $fpu): Response public function delete(Request $request, Fpu $fpu): Response
{ {
return $this->deleteCSRF($request, $fpu); return $this->deleteCSRF($request, $fpu);
} }
} }

View File

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

View File

@ -10,58 +10,58 @@ use Symfony\Component\HttpFoundation\{Request, Response};
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
#[Route('/gpu-core')] #[Route('/gpu-core')]
class GpuCoreController extends AbstractController class GpuCoreController extends AbstractController {
{ use FormControllerBase;
use FormControllerBase;
protected const ENTITY = GpuCore::class; protected const ENTITY = GpuCore::class;
protected const TEMPLATE_PATH = 'gpu_core/'; protected const TEMPLATE_PATH = 'gpu_core/';
protected const ROUTE_PREFIX = 'gpu-core_'; protected const ROUTE_PREFIX = 'gpu-core_';
protected const FORM = GPUCoreType::class; 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'])] #[Route('/', name: 'gpu-core_index', methods: ['GET'])]
public function index(): Response public function index(): Response
{ {
return $this->indexView('gpu_cores', [ return $this->indexView('gpu_cores', [
'brand' => 'asc', 'brand' => 'asc',
'processNode' => 'desc', 'processNode' => 'desc',
'generationName' => 'asc', 'generationName' => 'asc',
'architecture' => 'asc', 'architecture' => 'asc',
'name' => 'asc', 'name' => 'asc',
'variant' => 'asc', 'variant' => 'asc',
]); ]);
} }
#[Route('/new', name: 'gpu-core_new', methods: ['GET', 'POST'])] #[Route('/new', name: 'gpu-core_new', methods: ['GET', 'POST'])]
public function new(Request $request): Response public function new(Request $request): Response
{ {
return $this->itemCreate($request, 'gpu_core'); return $this->itemCreate($request, 'gpu_core');
} }
#[Route('/{id}', name: 'gpu-core_show', methods: ['GET'])] #[Route('/{id}', name: 'gpu-core_show', methods: ['GET'])]
public function show(GpuCore $gPUCore): Response public function show(GpuCore $gPUCore): Response
{ {
return $this->itemView($gPUCore, 'gpu_core'); return $this->itemView($gPUCore, 'gpu_core');
} }
#[Route('/{id}/edit', name: 'gpu-core_edit', methods: ['GET', 'POST'])] #[Route('/{id}/edit', name: 'gpu-core_edit', methods: ['GET', 'POST'])]
public function edit(Request $request, GpuCore $gPUCore): Response public function edit(Request $request, GpuCore $gPUCore): Response
{ {
return $this->itemUpdate($request, $gPUCore, 'gpu_core'); return $this->itemUpdate($request, $gPUCore, 'gpu_core');
} }
#[Route('/{id}', name: 'gpu-core_delete', methods: ['POST'])] #[Route('/{id}', name: 'gpu-core_delete', methods: ['POST'])]
public function delete(Request $request, GpuCore $gPUCore, EntityManagerInterface $entityManager): Response public function delete(Request $request, GpuCore $gPUCore, EntityManagerInterface $entityManager): Response
{ {
if ($this->isCsrfTokenValid('delete' . $gPUCore->getId(), $request->request->get('_token'))) { if ($this->isCsrfTokenValid('delete' . $gPUCore->getId(), $request->request->get('_token')))
$entityManager->remove($gPUCore); {
$entityManager->flush(); $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; namespace App\Controller;
use App\Entity\Lenses;
use App\Form\LensesType;
use App\Controller\ use App\Controller\
{DeleteFormTrait}; {DeleteFormTrait};
use App\Entity\Lenses;
use App\Form\LensesType;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\FormInterface;
@ -16,107 +16,102 @@ use Symfony\Component\Routing\Annotation\Route;
* Lens controller. * Lens controller.
*/ */
#[Route(path: 'lens')] #[Route(path: 'lens')]
class LensesController extends AbstractController class LensesController extends AbstractController {
{ use FormControllerBase;
use FormControllerBase; use DeleteFormTrait;
use DeleteFormTrait;
protected const ENTITY = Lenses::class; protected const ENTITY = Lenses::class;
protected const TEMPLATE_PATH = 'lenses/'; protected const TEMPLATE_PATH = 'lenses/';
protected const ROUTE_PREFIX = 'lens_'; protected const ROUTE_PREFIX = 'lens_';
protected const FORM = LensesType::class; protected const FORM = LensesType::class;
public function __construct(private readonly EntityManagerInterface $entityManager) public function __construct(private readonly EntityManagerInterface $entityManager)
{ {
} }
/** /**
* Lists all lens entities. * Lists all lens entities.
*/ */
#[Route(path: '/', name: 'lens_index', methods: ['GET'])] #[Route(path: '/', name: 'lens_index', methods: ['GET'])]
public function indexAction(): Response public function indexAction(): Response
{ {
$receivedItems = $this->entityManager->getRepository(self::ENTITY)->findBy([ $receivedItems = $this->entityManager->getRepository(self::ENTITY)->findBy([
'received' => TRUE, 'received' => TRUE,
], [ ], [
'brand' => 'ASC', 'brand' => 'ASC',
'productLine' => 'ASC', 'productLine' => 'ASC',
'mount' => 'ASC', 'mount' => 'ASC',
'minFocalLength' => 'ASC', 'minFocalLength' => 'ASC',
'maxFStop' => 'ASC', 'maxFStop' => 'ASC',
]); ]);
$newItems = $this->entityManager->getRepository(self::ENTITY)->findBy([ $newItems = $this->entityManager->getRepository(self::ENTITY)->findBy([
'received' => FALSE, 'received' => FALSE,
], [ ], [
'brand' => 'ASC', 'brand' => 'ASC',
'productLine' => 'ASC', 'productLine' => 'ASC',
'mount' => 'ASC', 'mount' => 'ASC',
'minFocalLength' => 'ASC', 'minFocalLength' => 'ASC',
'maxFStop' => 'ASC', 'maxFStop' => 'ASC',
]); ]);
return $this->render('lenses/index.html.twig', [ return $this->render('lenses/index.html.twig', [
'not_received' => $newItems, 'not_received' => $newItems,
'lenses' => $receivedItems, 'lenses' => $receivedItems,
]); ]);
} }
/** /**
* Creates a new lens entity. * Creates a new lens entity.
*/ */
#[Route(path: '/new', name: 'lens_new', methods: ['GET', 'POST'])] #[Route(path: '/new', name: 'lens_new', methods: ['GET', 'POST'])]
public function newAction(Request $request): RedirectResponse|Response public function newAction(Request $request): RedirectResponse|Response
{ {
return $this->itemCreate($request, 'lense'); return $this->itemCreate($request, 'lense');
} }
/** /**
* Finds and displays a lens entity. * Finds and displays a lens entity.
*/ */
#[Route(path: '/{id}', name: 'lens_show', methods: ['GET'])] #[Route(path: '/{id}', name: 'lens_show', methods: ['GET'])]
public function showAction(Lenses $lens): Response public function showAction(Lenses $lens): Response
{ {
return $this->itemView($lens, 'lense'); return $this->itemView($lens, 'lense');
} }
/** /**
* Displays a form to edit an existing lens entity. * Displays a form to edit an existing lens entity.
*/ */
#[Route(path: '/{id}/edit', name: 'lens_edit', methods: ['GET', 'POST'])] #[Route(path: '/{id}/edit', name: 'lens_edit', methods: ['GET', 'POST'])]
public function editAction(Request $request, Lenses $lens): RedirectResponse|Response public function editAction(Request $request, Lenses $lens): RedirectResponse|Response
{ {
return $this->itemUpdate($request, $lens, 'lense'); return $this->itemUpdate($request, $lens, 'lense');
} }
/** /**
* Moves a camera to the previouslyOwned table * Moves a camera to the previouslyOwned table
* */
* @param Request $request #[Route(path: '/{id}/deacquire', name: 'lens_deacquire', methods: ['POST'])]
* public function deacquireAction(Request $request, Lenses $lens): RedirectResponse
* @return RedirectResponse {
*/ return $this->itemDeacquire($request, $lens, 'previously-owned-lens_index');
#[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. * Deletes a lens entity.
*/ */
#[Route(path: '/{id}', name: 'lens_delete', methods: ['POST', 'DELETE'])] #[Route(path: '/{id}', name: 'lens_delete', methods: ['POST', 'DELETE'])]
public function deleteAction(Request $request, Lenses $lens): RedirectResponse public function deleteAction(Request $request, Lenses $lens): RedirectResponse
{ {
return $this->itemDelete($request, $lens); return $this->itemDelete($request, $lens);
} }
/** /**
* Creates a form to move * Creates a form to move
* *
* @param Lenses $lens The lens entity * @param Lenses $lens The lens entity
*/ */
private function createDeacquireForm(Lenses $lens): FormInterface private function createDeacquireForm(Lenses $lens): FormInterface
{ {
return $this->buildForm($lens, 'lens_deacquire'); return $this->buildForm($lens, 'lens_deacquire');
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -3,7 +3,7 @@
namespace App\Entity; namespace App\Entity;
use App\Enum\CpuArchitecture; use App\Enum\CpuArchitecture;
use Doctrine\Common\Collections\{Collection, ArrayCollection}; use Doctrine\Common\Collections\{ArrayCollection, Collection};
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
#[ORM\Table('cpu', schema: 'collection')] #[ORM\Table('cpu', schema: 'collection')]
@ -43,9 +43,9 @@ class Cpu {
#[ORM\Column('part_number', type: 'string')] #[ORM\Column('part_number', type: 'string')]
private string $partNumber; private string $partNumber;
#[ORM\Column('lot_number', type: 'string', nullable: TRUE, options: array( #[ORM\Column('lot_number', type: 'string', nullable: TRUE, options: [
'comment' => 'The CPU lot number, such as s-spec for Intel CPUs' 'comment' => 'The CPU lot number, such as s-spec for Intel CPUs',
))] ])]
private ?string $lotNumber; private ?string $lotNumber;
#[ORM\Column('micro_architecture', type: 'string', nullable: TRUE)] #[ORM\Column('micro_architecture', type: 'string', nullable: TRUE)]
@ -54,14 +54,14 @@ class Cpu {
#[ORM\Column('codename', type: 'string', nullable: TRUE)] #[ORM\Column('codename', type: 'string', nullable: TRUE)]
private ?string $codeName = ''; private ?string $codeName = '';
#[ORM\Column('base_speed', type: 'integer', options: array( #[ORM\Column('base_speed', type: 'integer', options: [
'comment' => 'The stock speed of the cpu in MHz' 'comment' => 'The stock speed of the cpu in MHz',
))] ])]
private int $baseSpeed; private int $baseSpeed;
#[ORM\Column('boost_speed', type: 'integer', nullable: true, options: array( #[ORM\Column('boost_speed', type: 'integer', nullable: TRUE, options: [
'comment' => 'The max boost speed of the cpu in MHz, if applicable' 'comment' => 'The max boost speed of the cpu in MHz, if applicable',
))] ])]
private ?int $boostSpeed; private ?int $boostSpeed;
#[ORM\Column('cores', type: 'integer')] #[ORM\Column('cores', type: 'integer')]
@ -70,15 +70,15 @@ class Cpu {
#[ORM\Column('threads', type: 'integer')] #[ORM\Column('threads', type: 'integer')]
private int $threads = 1; private int $threads = 1;
#[ORM\Column('igp', type: 'string', nullable: true, options: array( #[ORM\Column('igp', type: 'string', nullable: TRUE, options: [
'comment' => 'The name of the integrated graphics processor' 'comment' => 'The name of the integrated graphics processor',
))] ])]
private ?string $igp; private ?string $igp;
#[ORM\Column('voltage', type: 'float', nullable: true)] #[ORM\Column('voltage', type: 'float', nullable: TRUE)]
private ?float $voltage; private ?float $voltage;
#[ORM\Column('tdp', type: 'integer', nullable: true)] #[ORM\Column('tdp', type: 'integer', nullable: TRUE)]
private ?int $tdp; private ?int $tdp;
#[ORM\Column('process_node', type: 'integer', nullable: TRUE)] #[ORM\Column('process_node', type: 'integer', nullable: TRUE)]
@ -87,89 +87,89 @@ class Cpu {
#[ORM\Column('count', type: 'integer')] #[ORM\Column('count', type: 'integer')]
private int $count = 1; private int $count = 1;
#[ORM\Column('usable', type: 'boolean', options: array( #[ORM\Column('usable', type: 'boolean', options: [
'comment' => 'Whether the chip is working, and can be used with other hardware I have' 'comment' => 'Whether the chip is working, and can be used with other hardware I have',
))] ])]
private bool $usable = true; private bool $usable = TRUE;
#[ORM\Column('received', type: 'boolean', options: array( #[ORM\Column('received', type: 'boolean', options: [
'comment' => "Whether I have the chip in my possession (instead of in shipping)" 'comment' => 'Whether I have the chip in my possession (instead of in shipping)',
))] ])]
private bool $received = true; private bool $received = TRUE;
#[ORM\Column('link', type: 'string')] #[ORM\Column('link', type: 'string')]
private string $link; private string $link;
#[ORM\Column('notes', type: 'text', nullable: true)] #[ORM\Column('notes', type: 'text', nullable: TRUE)]
private ?string $notes = ''; private ?string $notes = '';
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
// CPU Cache // CPU Cache
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
#[ORM\Column('l1_data_count', type:'integer', nullable: true, options: array( #[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' 'comment' => 'The number of L1 data caches on the package, usually the same as the number of cores',
))] ])]
private ?int $L1dCount = null; private ?int $L1dCount = NULL;
#[ORM\Column('l1_data_size', type: 'integer', nullable: true, options: array( #[ORM\Column('l1_data_size', type: 'integer', nullable: TRUE, options: [
'comment' => 'The size of each Level 1 data cache in KB' 'comment' => 'The size of each Level 1 data cache in KB',
))] ])]
private ?int $L1dSize = null; private ?int $L1dSize = NULL;
#[ORM\Column('l1_data_way', type: 'integer', nullable: true)] #[ORM\Column('l1_data_way', type: 'integer', nullable: TRUE)]
private ?int $L1dWay = null; private ?int $L1dWay = NULL;
#[ORM\Column('l1_code_count', type:'integer', nullable: true, options: array( #[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' 'comment' => 'The number of L1 instruction caches on the package, usually the same as the number of cores',
))] ])]
private ?int $L1cCount = null; private ?int $L1cCount = NULL;
#[ORM\Column('l1_code_size', type: 'integer', nullable: true, options: array( #[ORM\Column('l1_code_size', type: 'integer', nullable: TRUE, options: [
'comment' => 'The size of each Level 1 instruction cache in KB' 'comment' => 'The size of each Level 1 instruction cache in KB',
))] ])]
private ?int $L1cSize = null; private ?int $L1cSize = NULL;
#[ORM\Column('l1_code_way', type: 'integer', nullable: true)] #[ORM\Column('l1_code_way', type: 'integer', nullable: TRUE)]
private ?int $L1cWay = null; private ?int $L1cWay = NULL;
#[ORM\Column('l1_unified_count', type:'integer', nullable: true, options: array( #[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' 'comment' => 'The number of L1 caches on the package, usually the same as the number of cores',
))] ])]
private ?int $L1uCount = null; private ?int $L1uCount = NULL;
#[ORM\Column('l1_unified_size', type: 'integer', nullable: true, options: array( #[ORM\Column('l1_unified_size', type: 'integer', nullable: TRUE, options: [
'comment' => 'The size of each Level 1 unified cache in KB' 'comment' => 'The size of each Level 1 unified cache in KB',
))] ])]
private ?int $L1uSize = null; private ?int $L1uSize = NULL;
#[ORM\Column('l1_unified_way', type: 'integer', nullable: true)] #[ORM\Column('l1_unified_way', type: 'integer', nullable: TRUE)]
private ?int $L1uWay = null; private ?int $L1uWay = NULL;
#[ORM\Column('l2_count', type: 'integer', options: array( #[ORM\Column('l2_count', type: 'integer', options: [
'comment' => 'The number of L2 caches on the package, usually the same as the number of cores' 'comment' => 'The number of L2 caches on the package, usually the same as the number of cores',
))] ])]
private int $L2Count = 1; private int $L2Count = 1;
#[ORM\Column('l2_size', type: 'integer', nullable: true, options: array( #[ORM\Column('l2_size', type: 'integer', nullable: TRUE, options: [
'comment' => 'The size of each Level 2 cache in KB' 'comment' => 'The size of each Level 2 cache in KB',
))] ])]
private ?int $L2Size; private ?int $L2Size;
#[ORM\Column('l2_way', type: 'integer', nullable: true)] #[ORM\Column('l2_way', type: 'integer', nullable: TRUE)]
private ?int $L2Way; private ?int $L2Way;
#[ORM\Column('l3_count', type: 'integer', options: array( #[ORM\Column('l3_count', type: 'integer', options: [
'comment' => 'The number of L3 caches on the package' 'comment' => 'The number of L3 caches on the package',
))] ])]
private int $L3Count = 0; private int $L3Count = 0;
#[ORM\Column('l3_size', type: 'integer', nullable: true, options: array( #[ORM\Column('l3_size', type: 'integer', nullable: TRUE, options: [
'comment' => 'The size of each Level 3 cache in KB' 'comment' => 'The size of each Level 3 cache in KB',
))] ])]
private ?int $L3Size; private ?int $L3Size;
#[ORM\Column('l3_way', type: 'integer', nullable: true)] #[ORM\Column('l3_way', type: 'integer', nullable: TRUE)]
private ?int $L3Way; private ?int $L3Way;
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,15 +1,12 @@
<?php <?php declare(strict_types=1);
namespace App\Form; namespace App\Form;
use App\Entity\Brand; use App\Entity\{Brand, Cpu};
use App\Entity\Cpu;
use App\Enum\CpuArchitecture; use App\Enum\CpuArchitecture;
use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\{EnumType, UrlType};
use Symfony\Component\Form\Extension\Core\Type\EnumType; use Symfony\Component\Form\{AbstractType, FormBuilderInterface};
use Symfony\Component\Form\Extension\Core\Type\UrlType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\OptionsResolver\OptionsResolver;
use UnitEnum; use UnitEnum;
@ -21,7 +18,7 @@ class CpuType extends AbstractType {
$builder $builder
->add('architecture', EnumType::class, [ ->add('architecture', EnumType::class, [
'class' => CpuArchitecture::class, 'class' => CpuArchitecture::class,
'choice_label' => fn(UnitEnum $choice): string => $choice->value, 'choice_label' => static fn (UnitEnum $choice): string => $choice->value,
'choices' => CpuArchitecture::getGroups(), 'choices' => CpuArchitecture::getGroups(),
]) ])
->add('brand', EntityType::class, [ ->add('brand', EntityType::class, [
@ -37,50 +34,50 @@ class CpuType extends AbstractType {
->add('codeName') ->add('codeName')
// Cache Stuff // Cache Stuff
->add('L1dCount', null, [ ->add('L1dCount', NULL, [
'label' => 'L1 Data Cache(s)', 'label' => 'L1 Data Cache(s)',
]) ])
->add('L1dSize', null, [ ->add('L1dSize', NULL, [
'label' => 'L1 Data Size KB' 'label' => 'L1 Data Size KB',
]) ])
->add('L1dWay', null, [ ->add('L1dWay', NULL, [
'label' => 'L1 Data (x-way)' 'label' => 'L1 Data (x-way)',
]) ])
->add('L1cCount', null, [ ->add('L1cCount', NULL, [
'label' => 'L1 Instruction Cache(s)', 'label' => 'L1 Instruction Cache(s)',
]) ])
->add('L1cSize', null, [ ->add('L1cSize', NULL, [
'label' => 'L1 Instruction Size KB' 'label' => 'L1 Instruction Size KB',
]) ])
->add('L1cWay', null, [ ->add('L1cWay', NULL, [
'label' => 'L1 Instruction (x-way)' 'label' => 'L1 Instruction (x-way)',
]) ])
->add('L1uCount', null, [ ->add('L1uCount', NULL, [
'label' => 'L1 Unified Cache(s)', 'label' => 'L1 Unified Cache(s)',
]) ])
->add('L1uSize', null, [ ->add('L1uSize', NULL, [
'label' => 'L1 Unified Cache Size: KB' 'label' => 'L1 Unified Cache Size: KB',
]) ])
->add('L1uWay', null, [ ->add('L1uWay', NULL, [
'label' => 'L1 Unified (x-way)' 'label' => 'L1 Unified (x-way)',
]) ])
->add('L2Count', null, [ ->add('L2Count', NULL, [
'label' => 'L2 Cache(s)' 'label' => 'L2 Cache(s)',
]) ])
->add('L2Size', null, [ ->add('L2Size', NULL, [
'label' => 'L2 Cache Size KB (per unit)' 'label' => 'L2 Cache Size KB (per unit)',
]) ])
->add('L2Way', null, [ ->add('L2Way', NULL, [
'label' => 'L2 Cache (x-way)' 'label' => 'L2 Cache (x-way)',
]) ])
->add('L3Count', null, [ ->add('L3Count', NULL, [
'label' => 'L3 Cache(s)' 'label' => 'L3 Cache(s)',
]) ])
->add('L3Size', null, [ ->add('L3Size', NULL, [
'label' => 'L3 Cache Size KB (per unit)' 'label' => 'L3 Cache Size KB (per unit)',
]) ])
->add('L3Way', null, [ ->add('L3Way', NULL, [
'label' => 'L3 Cache (x-way)' 'label' => 'L3 Cache (x-way)',
]) ])
->add('baseSpeed') ->add('baseSpeed')
@ -95,8 +92,7 @@ class CpuType extends AbstractType {
->add('usable') ->add('usable')
->add('received') ->add('received')
->add('link', UrlType::class) ->add('link', UrlType::class)
->add('notes') ->add('notes');
;
} }
public function configureOptions(OptionsResolver $resolver): void 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\Form\{AbstractType, FormBuilderInterface};
use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\OptionsResolver\OptionsResolver;
class FilmType extends AbstractType class FilmType extends AbstractType {
{ /**
/** * {@inheritDoc}
* {@inheritDoc} */
*/ public function buildForm(FormBuilderInterface $builder, array $options): void
public function buildForm(FormBuilderInterface $builder, array $options): void {
{ $builder->add('brand')
$builder->add('brand') ->add('productLine')
->add('productLine') ->add('filmName')
->add('filmName') ->add('filmAlias')
->add('filmAlias') ->add('filmSpeedAsa')
->add('filmSpeedAsa') ->add('filmSpeedDin')
->add('filmSpeedDin') ->add('filmFormat', ChoiceType::class, [
->add('filmFormat', ChoiceType::class, [ 'choices' => [
'choices' => [ 'Small Format' => [
'Small Format' => [ '35mm' => '135',
'35mm' => '135', '110' => '110',
'110' => '110', ],
], 'Medium Format' => [
'Medium Format' => [ '120' => '120',
'120' => '120', '127' => '127',
'127' => '127', '620' => '620',
'620' => '620', ],
], ],
], ])
]) ->add('filmBase', ChoiceType::class, [
->add('filmBase', ChoiceType::class, [ 'choices' => [
'choices' => [ 'Cellulose Triacetate' => 'Cellulose Triacetate',
'Cellulose Triacetate' => 'Cellulose Triacetate', 'Polyester' => 'Polyester',
'Polyester' => 'Polyester', 'Polyethylene Naphtalate' => 'Polyethylene Naphtalate',
'Polyethylene Naphtalate' => 'Polyethylene Naphtalate', ],
], ])
]) ->add('unusedRolls')
->add('unusedRolls') ->add('rollsInCamera')
->add('rollsInCamera') ->add('developedRolls')
->add('developedRolls') ->add('chemistry', ChoiceType::class, [
->add('chemistry', ChoiceType::class, [ 'choices' => [
'choices' => [ 'B & W' => 'B & W',
'B & W' => 'B & W', 'C-41' => 'C-41',
'C-41' => 'C-41', 'E-6' => 'E-6',
'E-6' => 'E-6', 'Other' => 'Other',
'Other' => 'Other', ],
], ])
]) ->add('notes');
->add('notes'); }
}
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function configureOptions(OptionsResolver $resolver): void public function configureOptions(OptionsResolver $resolver): void
{ {
$resolver->setDefaults([ $resolver->setDefaults([
'data_class' => Film::class, 'data_class' => Film::class,
]); ]);
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getBlockPrefix(): string public function getBlockPrefix(): string
{ {
return 'camerabundle_film'; return 'camerabundle_film';
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,32 +1,29 @@
<?php <?php declare(strict_types=1);
namespace App\Form; namespace App\Form;
use App\Entity\Socket; use App\Entity\Socket;
use App\Enum\SocketType; use App\Enum\SocketType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\EnumType; use Symfony\Component\Form\Extension\Core\Type\EnumType;
use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\{AbstractType, FormBuilderInterface};
use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\OptionsResolver\OptionsResolver;
class SocketTypeForm extends AbstractType class SocketTypeForm extends AbstractType {
{ public function buildForm(FormBuilderInterface $builder, array $options): void
public function buildForm(FormBuilderInterface $builder, array $options): void {
{ $builder
$builder ->add('name')
->add('name') ->add('otherName')
->add('otherName') ->add('pinCount')
->add('pinCount') ->add('type', EnumType::class, [
->add('type', EnumType::class,[
'class' => SocketType::class, 'class' => SocketType::class,
]) ]);
; }
}
public function configureOptions(OptionsResolver $resolver): void public function configureOptions(OptionsResolver $resolver): void
{ {
$resolver->setDefaults([ $resolver->setDefaults([
'data_class' => Socket::class, '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\HttpKernel\Kernel as BaseKernel;
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator; use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
class Kernel extends BaseKernel class Kernel extends BaseKernel {
{ use MicroKernelTrait;
use MicroKernelTrait;
protected function configureContainer( protected function configureContainer(
ContainerConfigurator $container, ContainerConfigurator $container,
LoaderInterface $loader, LoaderInterface $loader,
ContainerBuilder $builder ContainerBuilder $builder
): void ): void {
{
$configDir = $this->getConfigDir(); $configDir = $this->getConfigDir();
$container->import('../config/{packages}/*.yaml'); $container->import('../config/{packages}/*.yaml');
$container->import('../config/{packages}/' . $this->environment . '/*.yaml'); $container->import('../config/{packages}/' . $this->environment . '/*.yaml');
$container->import('../config/{packages}/*.php'); $container->import('../config/{packages}/*.php');
$container->import('../config/{packages}/' . $this->environment . '/*.php'); $container->import('../config/{packages}/' . $this->environment . '/*.php');
$container->import('../config/{services}.php'); $container->import('../config/{services}.php');
$container->import('../config/{services}_' . $this->environment . '.php'); $container->import('../config/{services}_' . $this->environment . '.php');
} }
protected function configureRoutes(RoutingConfigurator $routes): void protected function configureRoutes(RoutingConfigurator $routes): void
{ {
$routes->import('../config/{routes}/' . $this->environment . '/*.php'); $routes->import('../config/{routes}/' . $this->environment . '/*.php');
$routes->import('../config/{routes}/*.php'); $routes->import('../config/{routes}/*.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. * This file is part of the Symfony MakerBundle package.
@ -12,32 +12,23 @@
namespace App\Maker; namespace App\Maker;
use Doctrine\Bundle\DoctrineBundle\DoctrineBundle; use Doctrine\Bundle\DoctrineBundle\DoctrineBundle;
use Doctrine\Inflector\Inflector; use Doctrine\Inflector\{Inflector, InflectorFactory};
use Doctrine\Inflector\InflectorFactory; use Doctrine\ORM\{EntityManagerInterface, EntityRepository};
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Bundle\FrameworkBundle\KernelBrowser; use Symfony\Bundle\FrameworkBundle\KernelBrowser;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; 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\Doctrine\DoctrineHelper;
use Symfony\Bundle\MakerBundle\Generator;
use Symfony\Bundle\MakerBundle\InputConfiguration;
use Symfony\Bundle\MakerBundle\Maker\AbstractMaker; use Symfony\Bundle\MakerBundle\Maker\AbstractMaker;
use Symfony\Bundle\MakerBundle\Renderer\FormTypeRenderer; use Symfony\Bundle\MakerBundle\Renderer\FormTypeRenderer;
use Symfony\Bundle\MakerBundle\Str;
use Symfony\Bundle\MakerBundle\Util\UseStatementGenerator; 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\Bundle\TwigBundle\TwigBundle;
use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\{InputArgument, InputInterface};
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Question\Question; use Symfony\Component\Console\Question\Question;
use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\AbstractType;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\{Request, Response};
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Csrf\CsrfTokenManager; use Symfony\Component\Security\Csrf\CsrfTokenManager;
use Symfony\Component\Validator\Validation; use Symfony\Component\Validator\Validation;
@ -45,17 +36,16 @@ use Symfony\Component\Validator\Validation;
/** /**
* @author Sadicov Vladimir <sadikoff@gmail.com> * @author Sadicov Vladimir <sadikoff@gmail.com>
*/ */
final class MakeCollectionCrud extends AbstractMaker final class MakeCollectionCrud extends AbstractMaker {
{
private Inflector $inflector; private Inflector $inflector;
private string $controllerClassName; private string $controllerClassName;
private bool $generateTests = false; private bool $generateTests = FALSE;
public function __construct(private DoctrineHelper $doctrineHelper, private FormTypeRenderer $formTypeRenderer) public function __construct(private DoctrineHelper $doctrineHelper, private FormTypeRenderer $formTypeRenderer)
{ {
$this->inflector = InflectorFactory::create()->build(); $this->inflector = InflectorFactory::create()->build();
define('CRUD_TEMPLATE_PREFIX', __DIR__.'/../Resources/crud'); define('CRUD_TEMPLATE_PREFIX', __DIR__ . '/../Resources/crud');
} }
public static function getCommandName(): string public static function getCommandName(): string
@ -72,15 +62,15 @@ final class MakeCollectionCrud extends AbstractMaker
{ {
$command $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()))) ->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'); $inputConfig->setArgumentAsNonInteractive('entity-class');
} }
public function interact(InputInterface $input, ConsoleStyle $io, Command $command): void 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'); $argument = $command->getDefinition()->getArgument('entity-class');
$entities = $this->doctrineHelper->getEntitiesForAutocomplete(); $entities = $this->doctrineHelper->getEntitiesForAutocomplete();
@ -100,7 +90,7 @@ final class MakeCollectionCrud extends AbstractMaker
$defaultControllerClass $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 public function generate(InputInterface $input, ConsoleStyle $io, Generator $generator): void
@ -115,9 +105,10 @@ final class MakeCollectionCrud extends AbstractMaker
$repositoryVars = []; $repositoryVars = [];
$repositoryClassName = EntityManagerInterface::class; $repositoryClassName = EntityManagerInterface::class;
if (null !== $entityDoctrineDetails->getRepositoryClass()) { if (NULL !== $entityDoctrineDetails->getRepositoryClass())
{
$repositoryClassDetails = $generator->createClassNameDetails( $repositoryClassDetails = $generator->createClassNameDetails(
'\\'.$entityDoctrineDetails->getRepositoryClass(), '\\' . $entityDoctrineDetails->getRepositoryClass(),
'Repository\\', 'Repository\\',
'Repository' 'Repository'
); );
@ -138,14 +129,17 @@ final class MakeCollectionCrud extends AbstractMaker
); );
$iter = 0; $iter = 0;
do {
do
{
$formClassDetails = $generator->createClassNameDetails( $formClassDetails = $generator->createClassNameDetails(
$entityClassDetails->getRelativeNameWithoutSuffix().($iter ?: '').'Type', $entityClassDetails->getRelativeNameWithoutSuffix() . ($iter ?: '') . 'Type',
'Form\\', 'Form\\',
'Type' 'Type'
); );
++$iter; $iter++;
} while (class_exists($formClassDetails->getFullName())); }
while (class_exists($formClassDetails->getFullName()));
$entityVarPlural = lcfirst($this->inflector->pluralize($entityClassDetails->getShortName())); $entityVarPlural = lcfirst($this->inflector->pluralize($entityClassDetails->getShortName()));
$entityVarSingular = lcfirst($this->inflector->singularize($entityClassDetails->getShortName())); $entityVarSingular = lcfirst($this->inflector->singularize($entityClassDetails->getShortName()));
@ -169,20 +163,21 @@ final class MakeCollectionCrud extends AbstractMaker
$generator->generateController( $generator->generateController(
$controllerClassDetails->getFullName(), $controllerClassDetails->getFullName(),
CRUD_TEMPLATE_PREFIX . '/controller/Controller.tpl.php', CRUD_TEMPLATE_PREFIX . '/controller/Controller.tpl.php',
array_merge([ array_merge(
'use_statements' => $useStatements, [
'entity_class_name' => $entityClassDetails->getShortName(), 'use_statements' => $useStatements,
'form_class_name' => $formClassDetails->getShortName(), 'entity_class_name' => $entityClassDetails->getShortName(),
'route_path' => Str::asRoutePath($controllerClassDetails->getRelativeNameWithoutSuffix()), 'form_class_name' => $formClassDetails->getShortName(),
'route_name' => $routeName, 'route_path' => Str::asRoutePath($controllerClassDetails->getRelativeNameWithoutSuffix()),
'templates_path' => $templatesPath, 'route_name' => $routeName,
'entity_var_plural' => $entityVarPlural, 'templates_path' => $templatesPath,
'entity_twig_var_plural' => $entityTwigVarPlural, 'entity_var_plural' => $entityVarPlural,
'entity_var_singular' => $entityVarSingular, 'entity_twig_var_plural' => $entityTwigVarPlural,
'entity_twig_var_singular' => $entityTwigVarSingular, 'entity_var_singular' => $entityVarSingular,
'entity_identifier' => $entityDoctrineDetails->getIdentifier(), 'entity_twig_var_singular' => $entityTwigVarSingular,
'use_render_form' => method_exists(AbstractController::class, 'renderForm'), 'entity_identifier' => $entityDoctrineDetails->getIdentifier(),
], 'use_render_form' => method_exists(AbstractController::class, 'renderForm'),
],
$repositoryVars $repositoryVars
) )
); );
@ -224,15 +219,17 @@ final class MakeCollectionCrud extends AbstractMaker
], ],
]; ];
foreach ($templates as $template => $variables) { foreach ($templates as $template => $variables)
{
$generator->generateTemplate( $generator->generateTemplate(
$templatesPath.'/'.$template.'.html.twig', $templatesPath . '/' . $template . '.html.twig',
CRUD_TEMPLATE_PREFIX . '/templates/'.$template.'.tpl.php', CRUD_TEMPLATE_PREFIX . '/templates/' . $template . '.tpl.php',
$variables $variables
); );
} }
if ($this->generateTests) { if ($this->generateTests)
{
$testClassDetails = $generator->createClassNameDetails( $testClassDetails = $generator->createClassNameDetails(
$entityClassDetails->getRelativeNameWithoutSuffix(), $entityClassDetails->getRelativeNameWithoutSuffix(),
'Test\\Controller\\', 'Test\\Controller\\',
@ -248,12 +245,13 @@ final class MakeCollectionCrud extends AbstractMaker
$usesEntityManager = EntityManagerInterface::class === $repositoryClassName; $usesEntityManager = EntityManagerInterface::class === $repositoryClassName;
if ($usesEntityManager) { if ($usesEntityManager)
{
$useStatements->addUseStatement(EntityRepository::class); $useStatements->addUseStatement(EntityRepository::class);
} }
$generator->generateFile( $generator->generateFile(
'tests/Controller/'.$testClassDetails->getShortName().'.php', 'tests/Controller/' . $testClassDetails->getShortName() . '.php',
$usesEntityManager ? 'crud/test/Test.EntityManager.tpl.php' : 'crud/test/Test.tpl.php', $usesEntityManager ? 'crud/test/Test.EntityManager.tpl.php' : 'crud/test/Test.tpl.php',
[ [
'use_statements' => $useStatements, '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.'); $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! * Auto-generated Migration: Please modify to your needs!
*/ */
final class Version20221117193508 extends AbstractMigration final class Version20221117193508 extends AbstractMigration {
{ public function getDescription(): string
public function getDescription(): string {
{ return '';
return ''; }
}
public function up(Schema $schema): void public function up(Schema $schema): void
{ {
// this up() migration is auto-generated, please modify it to your needs // this up() migration is auto-generated, please modify it to your needs
$this->addSql('DROP SEQUENCE collection.battery_type_id_seq CASCADE'); $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 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 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 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_5C3F5E3144F5D008 ON collection.motherboard (brand_id)');
$this->addSql('CREATE INDEX IDX_5C3F5E31BC1433B9 ON collection.motherboard (chipset_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 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_D635BC6D6511E8A3 ON collection.motherboard_socket_link (motherboard_id)');
$this->addSql('CREATE INDEX IDX_D635BC6DD20E239C ON collection.motherboard_socket_link (socket_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.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_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 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_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('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'); $this->addSql('DROP TABLE collection.battery_type');
} }
public function down(Schema $schema): void public function down(Schema $schema): void
{ {
// this down() migration is auto-generated, please modify it to your needs // this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA public'); $this->addSql('CREATE SCHEMA public');
$this->addSql('CREATE SEQUENCE collection.battery_type_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); $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('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.chipset DROP CONSTRAINT FK_110BAE8044F5D008');
$this->addSql('ALTER TABLE collection.motherboard DROP CONSTRAINT FK_5C3F5E3144F5D008'); $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 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_D635BC6D6511E8A3');
$this->addSql('ALTER TABLE collection.motherboard_socket_link DROP CONSTRAINT FK_D635BC6DD20E239C'); $this->addSql('ALTER TABLE collection.motherboard_socket_link DROP CONSTRAINT FK_D635BC6DD20E239C');
$this->addSql('DROP TABLE collection.chipset'); $this->addSql('DROP TABLE collection.chipset');
$this->addSql('DROP TABLE collection.motherboard'); $this->addSql('DROP TABLE collection.motherboard');
$this->addSql('DROP TABLE collection.motherboard_socket_link'); $this->addSql('DROP TABLE collection.motherboard_socket_link');
} }
} }

View File

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

View File

@ -5,26 +5,25 @@ namespace App\Repository;
use App\Entity\{Camera, PreviouslyOwnedCamera}; use App\Entity\{Camera, PreviouslyOwnedCamera};
use Doctrine\ORM\{ORMInvalidArgumentException}; use Doctrine\ORM\{ORMInvalidArgumentException};
class CameraRepository extends AcquireRepository class CameraRepository extends AcquireRepository {
{ /**
/** * @throws ORMInvalidArgumentException
* @throws ORMInvalidArgumentException */
*/ public function deacquire(mixed $currentRecord): void
public function deacquire(mixed $currentRecord): void {
{ $currentRecord->setFormerlyOwned(TRUE)
$currentRecord->setFormerlyOwned(TRUE) ->setReceived(TRUE);
->setReceived(TRUE);
$this->moveRecord($currentRecord, new PreviouslyOwnedCamera()); $this->moveRecord($currentRecord, new PreviouslyOwnedCamera());
} }
/** /**
* @throws ORMInvalidArgumentException * @throws ORMInvalidArgumentException
*/ */
public function reacquire(mixed $currentRecord): void public function reacquire(mixed $currentRecord): void
{ {
$currentRecord->setFormerlyOwned(FALSE); $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 App\Entity\{Flash, PreviouslyOwnedFlash};
use Doctrine\ORM\{ORMInvalidArgumentException}; use Doctrine\ORM\{ORMInvalidArgumentException};
class FlashRepository extends AcquireRepository class FlashRepository extends AcquireRepository {
{ /**
/** * @throws ORMInvalidArgumentException
* @throws ORMInvalidArgumentException */
*/ public function deacquire(mixed $currentRecord): void
public function deacquire(mixed $currentRecord): void {
{ $currentRecord->setFormerlyOwned(TRUE)
$currentRecord->setFormerlyOwned(TRUE) ->setReceived(TRUE);
->setReceived(TRUE);
$this->moveRecord($currentRecord, new PreviouslyOwnedFlash()); $this->moveRecord($currentRecord, new PreviouslyOwnedFlash());
} }
/** /**
* @throws ORMInvalidArgumentException * @throws ORMInvalidArgumentException
*/ */
public function reacquire(mixed $currentRecord): void public function reacquire(mixed $currentRecord): void
{ {
$currentRecord->setFormerlyOwned(FALSE); $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}; use App\Entity\{Lenses, PreviouslyOwnedLenses};
class LensesRepository extends AcquireRepository class LensesRepository extends AcquireRepository {
{ public function deacquire(mixed $currentRecord): void
public function deacquire(mixed $currentRecord): void {
{ $currentRecord->setFormerlyOwned(TRUE)
$currentRecord->setFormerlyOwned(TRUE) ->setReceived(TRUE);
->setReceived(TRUE);
$this->moveRecord($currentRecord, new PreviouslyOwnedLenses()); $this->moveRecord($currentRecord, new PreviouslyOwnedLenses());
} }
public function reacquire(mixed $currentRecord): void public function reacquire(mixed $currentRecord): void
{ {
$currentRecord->setFormerlyOwned(FALSE); $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 ?> <?php endif ?>
<?= $generator->generateRouteForControllerMethod('/new', sprintf('%s_new', $route_name), ['GET', 'POST']) ?> <?= $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 public function new(Request $request, <?= $repository_class_name ?> $<?= $repository_var ?>): Response
<?php } else { ?> <?php }
else
{ ?>
public function new(Request $request): Response public function new(Request $request): Response
<?php } ?> <?php } ?>
{ {
@ -48,9 +51,12 @@ class <?= $class_name ?> extends AbstractController {
} }
<?= $generator->generateRouteForControllerMethod(sprintf('/{%s}/edit', $entity_identifier), sprintf('%s_edit', $route_name), ['GET', 'POST']) ?> <?= $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 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 public function edit(Request $request, <?= $entity_class_name ?> $<?= $entity_var_singular ?>): Response
<?php } ?> <?php } ?>
{ {
@ -58,9 +64,12 @@ class <?= $class_name ?> extends AbstractController {
} }
<?= $generator->generateRouteForControllerMethod(sprintf('/{%s}', $entity_identifier), sprintf('%s_delete', $route_name), ['POST']) ?> <?= $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 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 public function delete(Request $request, <?= $entity_class_name ?> $<?= $entity_var_singular ?>): Response
<?php } ?> <?php } ?>
{ {

View File

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

View File

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

View File

@ -4,8 +4,11 @@ use Symfony\Component\Dotenv\Dotenv;
require dirname(__DIR__) . '/vendor/autoload.php'; require dirname(__DIR__) . '/vendor/autoload.php';
if (file_exists(dirname(__DIR__) . '/config/bootstrap.php')) { if (file_exists(dirname(__DIR__) . '/config/bootstrap.php'))
require dirname(__DIR__) . '/config/bootstrap.php'; {
} elseif (method_exists(Dotenv::class, 'bootEnv')) { require dirname(__DIR__) . '/config/bootstrap.php';
(new Dotenv())->bootEnv(dirname(__DIR__) . '/.env'); }
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 function walk_array(callable $method, array $items): void
{ {
foreach ($items as $item) { foreach ($items as $item)
$method($item); {
} $method($item);
}
} }

View File

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

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