Reformat files
This commit is contained in:
parent
80bb63fdd6
commit
0909a5e499
@ -11,6 +11,7 @@ $finder = Finder::create()
|
||||
return (new Config())
|
||||
->setRiskyAllowed(TRUE)
|
||||
->setFinder($finder)
|
||||
->setIndent(' ')
|
||||
->setRules([
|
||||
'align_multiline_comment' => false,
|
||||
'array_indentation' => true,
|
||||
@ -21,17 +22,15 @@ return (new Config())
|
||||
'binary_operator_spaces' => [
|
||||
'default' => 'single_space',
|
||||
'operators' => [
|
||||
'=' => 'align_single_space_minimal',
|
||||
'=>' => 'align_single_space_minimal',
|
||||
'||' => 'align_single_space_minimal',
|
||||
'.=' => 'align_single_space_minimal',
|
||||
],
|
||||
'=' => NULL,
|
||||
'&' => NULL,
|
||||
]
|
||||
],
|
||||
'blank_line_after_namespace' => true,
|
||||
'blank_line_after_opening_tag' => false,
|
||||
'blank_line_before_statement' => [
|
||||
'statements' => [
|
||||
'case',
|
||||
// 'case',
|
||||
'continue',
|
||||
'declare',
|
||||
'default',
|
||||
@ -49,12 +48,9 @@ return (new Config())
|
||||
'yield_from',
|
||||
],
|
||||
],
|
||||
'braces' => [
|
||||
'allow_single_line_anonymous_class_with_empty_body' => true,
|
||||
'allow_single_line_closure' => true,
|
||||
'position_after_anonymous_constructs' => 'same',
|
||||
'position_after_control_structures' => 'same',
|
||||
'position_after_functions_and_oop_constructs' => 'next',
|
||||
'blank_lines_before_namespace' => [
|
||||
'min_line_breaks' => 2,
|
||||
'max_line_breaks' => 2,
|
||||
],
|
||||
'cast_spaces' => ['space' => 'single'],
|
||||
'class_attributes_separation' => [
|
||||
@ -89,7 +85,16 @@ return (new Config())
|
||||
'compact_nullable_typehint' => true,
|
||||
'concat_space' => ['spacing' => 'one'],
|
||||
'constant_case' => ['case' => 'upper'],
|
||||
'control_structure_continuation_position' => ['position' => 'same_line'],
|
||||
'control_structure_braces' => true,
|
||||
'control_structure_continuation_position' => ['position' => 'next_line'],
|
||||
'curly_braces_position' => [
|
||||
'allow_single_line_anonymous_functions' => true,
|
||||
'allow_single_line_empty_anonymous_classes' => true,
|
||||
'anonymous_functions_opening_brace' => 'same_line',
|
||||
'classes_opening_brace' => 'same_line',
|
||||
'control_structures_opening_brace' => 'next_line_unless_newline_at_signature_end',
|
||||
'functions_opening_brace' => 'next_line_unless_newline_at_signature_end',
|
||||
],
|
||||
'date_time_immutable' => false,
|
||||
'declare_equal_normalize' => ['space' => 'none'],
|
||||
'declare_parentheses' => true,
|
||||
@ -108,23 +113,20 @@ return (new Config())
|
||||
'empty_loop_body' => ['style' => 'braces'],
|
||||
'empty_loop_condition' => ['style' => 'while'],
|
||||
'encoding' => true,
|
||||
'ereg_to_preg' => true,
|
||||
'error_suppression' => [
|
||||
'mute_deprecation_error' => true,
|
||||
'noise_remaining_usages' => false,
|
||||
'noise_remaining_usages_exclude' => [],
|
||||
],
|
||||
'escape_implicit_backslashes' => [
|
||||
'double_quoted' => true,
|
||||
'heredoc_syntax' => true,
|
||||
'double_quoted' => false,
|
||||
'heredoc_syntax' => false,
|
||||
'single_quoted' => false,
|
||||
],
|
||||
'explicit_indirect_variable' => true,
|
||||
'explicit_string_variable' => true,
|
||||
'explicit_indirect_variable' => false,
|
||||
'explicit_string_variable' => false,
|
||||
'final_class' => false,
|
||||
'final_internal_class' => [
|
||||
'annotation_exclude' => ['@no-final'],
|
||||
'annotation_include' => ['@internal'],
|
||||
'consider_absent_docblock_as_internal_class' => false,
|
||||
],
|
||||
'final_public_method_for_abstract_class' => false,
|
||||
@ -143,29 +145,16 @@ return (new Config())
|
||||
'pi',
|
||||
],
|
||||
],
|
||||
'function_typehint_space' => true,
|
||||
'general_phpdoc_annotation_remove' => [
|
||||
'annotations' => [
|
||||
'author',
|
||||
'package',
|
||||
'subpackage',
|
||||
],
|
||||
],
|
||||
'general_phpdoc_tag_rename' => [
|
||||
'case_sensitive' => false,
|
||||
'fix_annotation' => true,
|
||||
'fix_inline' => true,
|
||||
'replacements' => ['inheritDocs' => 'inheritDoc'],
|
||||
],
|
||||
'general_phpdoc_annotation_remove' => false,
|
||||
'general_phpdoc_tag_rename' => false,
|
||||
'get_class_to_class_keyword' => false,
|
||||
'global_namespace_import' => [
|
||||
'import_constants' => false,
|
||||
'import_functions' => false,
|
||||
'import_constants' => true,
|
||||
'import_functions' => true,
|
||||
'import_classes' => true,
|
||||
],
|
||||
'group_import' => true,
|
||||
'header_comment' => false, // false by default
|
||||
'heredoc_indentation' => ['indentation' => 'start_plus_one'],
|
||||
'heredoc_to_nowdoc' => true,
|
||||
'implode_call' => true,
|
||||
'include' => true,
|
||||
@ -205,7 +194,6 @@ return (new Config())
|
||||
'no_binary_string' => true,
|
||||
'no_blank_lines_after_class_opening' => true,
|
||||
'no_blank_lines_after_phpdoc' => true,
|
||||
'no_blank_lines_before_namespace' => false, // conflicts with `single_blank_line_before_namespace`
|
||||
'no_break_comment' => ['comment_text' => 'no break'],
|
||||
'no_closing_tag' => true,
|
||||
'no_empty_comment' => true,
|
||||
@ -218,7 +206,6 @@ return (new Config())
|
||||
'no_mixed_echo_print' => ['use' => 'echo'],
|
||||
'no_multiline_whitespace_around_double_arrow' => true,
|
||||
'no_null_property_initialization' => true,
|
||||
'no_php4_constructor' => true,
|
||||
'no_short_bool_cast' => true,
|
||||
'no_singleline_whitespace_before_semicolons' => true,
|
||||
'no_space_around_double_colon' => true,
|
||||
@ -231,8 +218,7 @@ return (new Config())
|
||||
'allow_unused_params' => true,
|
||||
'remove_inheritdoc' => false,
|
||||
],
|
||||
'no_trailing_comma_in_list_call' => true,
|
||||
'no_trailing_comma_in_singleline_array' => true,
|
||||
'no_trailing_comma_in_singleline' => true,
|
||||
'no_trailing_whitespace' => true,
|
||||
'no_trailing_whitespace_in_comment' => true,
|
||||
'no_trailing_whitespace_in_string' => true,
|
||||
@ -261,18 +247,24 @@ return (new Config())
|
||||
'no_whitespace_in_blank_line' => true,
|
||||
'non_printable_character' => ['use_escape_sequences_in_strings' => true],
|
||||
'normalize_index_brace' => true,
|
||||
'not_operator_with_space' => false,
|
||||
'not_operator_with_space' => true,
|
||||
'not_operator_with_successor_space' => true,
|
||||
'nullable_type_declaration_for_default_null_value' => ['use_nullable_type_declaration' => true],
|
||||
'object_operator_without_whitespace' => true,
|
||||
'octal_notation' => false, // requires 8.1+
|
||||
'operator_linebreak' => ['only_booleans' => true, 'position' => 'beginning'],
|
||||
'ordered_class_elements' => [
|
||||
'order' => [
|
||||
'use_trait',
|
||||
'constant',
|
||||
'property',
|
||||
'method',
|
||||
'case',
|
||||
'constant_public',
|
||||
'constant_protected',
|
||||
'constant_private',
|
||||
'property_public',
|
||||
'property_protected',
|
||||
'property_private',
|
||||
'construct',
|
||||
'destruct',
|
||||
'magic',
|
||||
],
|
||||
'sort_algorithm' => 'none',
|
||||
],
|
||||
@ -294,7 +286,7 @@ return (new Config())
|
||||
'php_unit_dedicate_assert_internal_type' => ['target' => 'newest'],
|
||||
'php_unit_expectation' => ['target' => 'newest'],
|
||||
'php_unit_fqcn_annotation' => true,
|
||||
'php_unit_internal_class' => ['types' => ['normal', 'final']],
|
||||
'php_unit_internal_class' => ['types' => ['final']],
|
||||
'php_unit_method_casing' => ['case' => 'camel_case'],
|
||||
'php_unit_mock' => ['target' => 'newest'],
|
||||
'php_unit_mock_short_will_return' => true,
|
||||
@ -305,14 +297,6 @@ return (new Config())
|
||||
],
|
||||
'php_unit_set_up_tear_down_visibility' => true,
|
||||
'php_unit_size_class' => false,
|
||||
'php_unit_strict' => [
|
||||
'assertions' => [
|
||||
'assertAttributeEquals',
|
||||
'assertAttributeNotEquals',
|
||||
'assertEquals',
|
||||
'assertNotEquals',
|
||||
],
|
||||
],
|
||||
'php_unit_test_annotation' => ['style' => 'prefix'],
|
||||
'php_unit_test_case_static_method_calls' => [
|
||||
'call_type' => 'this',
|
||||
@ -321,16 +305,7 @@ return (new Config())
|
||||
'php_unit_test_class_requires_covers' => false,
|
||||
'phpdoc_add_missing_param_annotation' => ['only_untyped' => true],
|
||||
'phpdoc_align' => [
|
||||
'align' => 'vertical',
|
||||
'tags' => [
|
||||
'method',
|
||||
'param',
|
||||
'property',
|
||||
'return',
|
||||
'throws',
|
||||
'type',
|
||||
'var',
|
||||
],
|
||||
'align' => 'left'
|
||||
],
|
||||
'phpdoc_annotation_without_dot' => false,
|
||||
'phpdoc_indent' => true,
|
||||
@ -353,16 +328,8 @@ return (new Config())
|
||||
'property' => 'multi',
|
||||
],
|
||||
'phpdoc_no_access' => true,
|
||||
'phpdoc_no_alias_tag' => [
|
||||
'replacements' => [
|
||||
'property-read' => 'property',
|
||||
'property-write' => 'property',
|
||||
'type' => 'var',
|
||||
'link' => 'see',
|
||||
],
|
||||
],
|
||||
'phpdoc_no_empty_return' => false,
|
||||
'phpdoc_no_package' => true,
|
||||
'phpdoc_no_package' => false,
|
||||
'phpdoc_no_useless_inheritdoc' => true,
|
||||
'phpdoc_order' => true,
|
||||
'phpdoc_order_by_value' => [
|
||||
@ -403,7 +370,7 @@ return (new Config())
|
||||
'str',
|
||||
],
|
||||
],
|
||||
'phpdoc_separation' => true,
|
||||
'phpdoc_separation' => false,
|
||||
'phpdoc_single_line_var_spacing' => true,
|
||||
'phpdoc_summary' => false,
|
||||
'phpdoc_tag_casing' => ['tags' => ['inheritDoc']],
|
||||
@ -443,15 +410,14 @@ return (new Config())
|
||||
'simplified_if_return' => true,
|
||||
'simplified_null_return' => false,
|
||||
'single_blank_line_at_eof' => true,
|
||||
'single_blank_line_before_namespace' => true,
|
||||
'single_class_element_per_statement' => ['elements' => ['const', 'property']],
|
||||
'single_import_per_statement' => false,
|
||||
'single_line_after_imports' => true,
|
||||
'single_line_comment_style' => ['comment_types' => ['asterisk', 'hash']],
|
||||
'single_line_throw' => false,
|
||||
'single_quote' => ['strings_containing_single_quote_chars' => false],
|
||||
'single_space_after_construct' => [
|
||||
'constructs' => [
|
||||
'single_space_around_construct' => [
|
||||
'constructs_followed_by_a_single_space' => [
|
||||
'abstract',
|
||||
'as',
|
||||
'attribute',
|
||||
@ -514,6 +480,7 @@ return (new Config())
|
||||
'space_after_semicolon' => ['remove_in_empty_for_expressions' => true],
|
||||
'standardize_increment' => true,
|
||||
'standardize_not_equals' => true,
|
||||
'statement_indentation' => true,
|
||||
'static_lambda' => true,
|
||||
'strict_comparison' => true,
|
||||
'strict_param' => true,
|
||||
@ -530,8 +497,9 @@ return (new Config())
|
||||
'elements' => ['arrays'],
|
||||
],
|
||||
'trim_array_spaces' => true,
|
||||
'type_declaration_spaces' => ['elements' => ['function', 'property']],
|
||||
'types_spaces' => ['space' => 'none'],
|
||||
'unary_operator_spaces' => true,
|
||||
'unary_operator_spaces' => false,
|
||||
'use_arrow_functions' => true,
|
||||
'visibility_required' => ['elements' => ['const', 'method', 'property']],
|
||||
'void_return' => false, // changes method signature
|
||||
|
@ -1,13 +1,13 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
return [
|
||||
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
|
||||
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
|
||||
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
|
||||
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
|
||||
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true],
|
||||
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
|
||||
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
|
||||
Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true],
|
||||
Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
|
||||
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => TRUE],
|
||||
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => TRUE],
|
||||
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => TRUE],
|
||||
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => TRUE],
|
||||
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => TRUE, 'test' => TRUE],
|
||||
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => TRUE],
|
||||
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => TRUE],
|
||||
Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => TRUE],
|
||||
Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => TRUE],
|
||||
];
|
||||
|
@ -3,5 +3,5 @@
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$containerConfigurator->extension('framework', ['cache' => null]);
|
||||
$containerConfigurator->extension('framework', ['cache' => NULL]);
|
||||
};
|
||||
|
@ -7,11 +7,11 @@ return static function (MonologConfig $config): void {
|
||||
'type' => 'stream',
|
||||
'path' => '%kernel.logs_dir%/%kernel.environment%.log',
|
||||
'level' => 'debug',
|
||||
'channels' => ['elements' => ['!event']]
|
||||
'channels' => ['elements' => ['!event']],
|
||||
]);
|
||||
$config->handler('console', [
|
||||
'type' => 'console',
|
||||
'process_psr_3_messages' => false,
|
||||
'channels' => ['elements' => ['!event', '!doctrine', '!console']]
|
||||
'process_psr_3_messages' => FALSE,
|
||||
'channels' => ['elements' => ['!event', '!doctrine', '!console']],
|
||||
]);
|
||||
};
|
||||
|
@ -5,5 +5,5 @@ declare(strict_types=1);
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$containerConfigurator->extension('framework', ['router' => ['strict_requirements' => true]]);
|
||||
$containerConfigurator->extension('framework', ['router' => ['strict_requirements' => TRUE]]);
|
||||
};
|
||||
|
@ -4,13 +4,13 @@ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigura
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$containerConfigurator->extension('web_profiler', [
|
||||
'toolbar' => true,
|
||||
'intercept_redirects' => false
|
||||
'toolbar' => TRUE,
|
||||
'intercept_redirects' => FALSE,
|
||||
]);
|
||||
|
||||
$containerConfigurator->extension('framework', [
|
||||
'profiler' => [
|
||||
'only_exceptions' => false
|
||||
]
|
||||
'only_exceptions' => FALSE,
|
||||
],
|
||||
]);
|
||||
};
|
||||
|
@ -15,7 +15,7 @@ return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
'types' => ['money' => MoneyType::class],
|
||||
'logging' => '%kernel.debug%',
|
||||
'mapping_types' => ['bit' => 'boolean', 'money' => 'money'],
|
||||
'url' => '%env(DATABASE_URL)%'
|
||||
'url' => '%env(DATABASE_URL)%',
|
||||
],
|
||||
'orm' => [
|
||||
'auto_generate_proxy_classes' => '%kernel.debug%',
|
||||
@ -27,8 +27,8 @@ return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
'type' => 'attribute',
|
||||
'dir' => '%kernel.project_dir%/src/Entity',
|
||||
'prefix' => 'App\Entity',
|
||||
'alias' => 'App']
|
||||
]
|
||||
]
|
||||
'alias' => 'App'],
|
||||
],
|
||||
],
|
||||
]);
|
||||
};
|
||||
|
@ -4,5 +4,5 @@ use Symfony\Config\DoctrineMigrationsConfig;
|
||||
|
||||
return static function (DoctrineMigrationsConfig $doctrineMigrations): void {
|
||||
$doctrineMigrations->migrationsPath('App\\Migrations', '%kernel.project_dir%/src/Migrations')
|
||||
->checkDatabasePlatform(true);
|
||||
->checkDatabasePlatform(TRUE);
|
||||
};
|
||||
|
@ -2,15 +2,14 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Symfony\Config\FrameworkConfig;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symfony\Config\FrameworkConfig;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator, FrameworkConfig $config): void {
|
||||
$config->session(['handler_id' => null]);
|
||||
$config->session(['handler_id' => NULL]);
|
||||
|
||||
$config->secret('%env(APP_SECRET)%')
|
||||
->defaultLocale('en')
|
||||
->httpMethodOverride(true)
|
||||
->phpErrors(['log' => true])
|
||||
;
|
||||
->httpMethodOverride(TRUE)
|
||||
->phpErrors(['log' => TRUE]);
|
||||
};
|
||||
|
@ -8,17 +8,17 @@ return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
'orm' => [
|
||||
'metadata_cache_driver' => [
|
||||
'type' => 'service',
|
||||
'id' => 'doctrine.system_cache_provider'
|
||||
'id' => 'doctrine.system_cache_provider',
|
||||
],
|
||||
'query_cache_driver' => [
|
||||
'type' => 'service',
|
||||
'id' => 'doctrine.system_cache_provider'
|
||||
'id' => 'doctrine.system_cache_provider',
|
||||
],
|
||||
'result_cache_driver' => [
|
||||
'type' => 'service',
|
||||
'id' => 'doctrine.result_cache_provider'
|
||||
]
|
||||
]
|
||||
'id' => 'doctrine.result_cache_provider',
|
||||
],
|
||||
],
|
||||
]);
|
||||
|
||||
$services = $containerConfigurator->services();
|
||||
@ -35,12 +35,12 @@ return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
'cache' => [
|
||||
'pools' => [
|
||||
'doctrine.result_cache_pool' => [
|
||||
'adapter' => 'cache.app'
|
||||
'adapter' => 'cache.app',
|
||||
],
|
||||
'doctrine.system_cache_pool' => [
|
||||
'adapter' => 'cache.system'
|
||||
]
|
||||
]
|
||||
]
|
||||
'adapter' => 'cache.system',
|
||||
],
|
||||
],
|
||||
],
|
||||
]);
|
||||
};
|
||||
|
@ -9,18 +9,18 @@ return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
'type' => 'fingers_crossed',
|
||||
'action_level' => 'error',
|
||||
'handler' => 'nested',
|
||||
'excluded_404s' => ['^/']
|
||||
'excluded_404s' => ['^/'],
|
||||
],
|
||||
'nested' => [
|
||||
'type' => 'stream',
|
||||
'path' => '%kernel.logs_dir%/%kernel.environment%.log',
|
||||
'level' => 'debug'
|
||||
'level' => 'debug',
|
||||
],
|
||||
'console' => [
|
||||
'type' => 'console',
|
||||
'process_psr_3_messages' => false,
|
||||
'channels' => ['!event', '!doctrine']
|
||||
]
|
||||
]
|
||||
'process_psr_3_messages' => FALSE,
|
||||
'channels' => ['!event', '!doctrine'],
|
||||
],
|
||||
],
|
||||
]);
|
||||
};
|
||||
|
@ -4,6 +4,6 @@ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigura
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$containerConfigurator->extension('framework', [
|
||||
'router' => ['strict_requirements' => null]
|
||||
'router' => ['strict_requirements' => NULL],
|
||||
]);
|
||||
};
|
||||
|
@ -5,8 +5,8 @@ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigura
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$containerConfigurator->extension('framework', [
|
||||
'router' => [
|
||||
'strict_requirements' => null,
|
||||
'utf8' => true
|
||||
]
|
||||
'strict_requirements' => NULL,
|
||||
'utf8' => TRUE,
|
||||
],
|
||||
]);
|
||||
};
|
||||
|
@ -1,36 +1,36 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
use Symfony\Config\SecurityConfig;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
|
||||
use Symfony\Config\SecurityConfig;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator, SecurityConfig $security): void {
|
||||
$security->passwordHasher(PasswordAuthenticatedUserInterface::class, 'auto')
|
||||
;
|
||||
$security->passwordHasher(PasswordAuthenticatedUserInterface::class, 'auto');
|
||||
|
||||
$containerConfigurator->extension('security', [
|
||||
'providers' => [
|
||||
'users_in_memory' => [
|
||||
'memory' => null]
|
||||
'memory' => NULL],
|
||||
],
|
||||
'firewalls' => [
|
||||
'dev' => [
|
||||
'pattern' => '^/(_(profiler|wdt)|css|images|js)/',
|
||||
'security' => false
|
||||
'security' => FALSE,
|
||||
],
|
||||
'main' => [
|
||||
'lazy' => true,
|
||||
'provider' => 'users_in_memory'
|
||||
]
|
||||
'lazy' => TRUE,
|
||||
'provider' => 'users_in_memory',
|
||||
],
|
||||
'access_control' => null
|
||||
],
|
||||
'access_control' => NULL,
|
||||
]);
|
||||
if ($containerConfigurator->env() === 'test') {
|
||||
if ($containerConfigurator->env() === 'test')
|
||||
{
|
||||
$security->passwordHasher(PasswordAuthenticatedUserInterface::class, [
|
||||
'algorithm' => 'auto',
|
||||
'cost' => 4,
|
||||
'time_cost' => 3,
|
||||
'memory_cost' => 10
|
||||
'memory_cost' => 10,
|
||||
]);
|
||||
}
|
||||
};
|
||||
|
@ -4,6 +4,6 @@ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigura
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$containerConfigurator->extension('sensio_framework_extra', [
|
||||
'router' => ['annotations' => false]
|
||||
'router' => ['annotations' => FALSE],
|
||||
]);
|
||||
};
|
||||
|
@ -5,5 +5,5 @@ declare(strict_types=1);
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$containerConfigurator->extension('framework', ['test' => null]);
|
||||
$containerConfigurator->extension('framework', ['test' => NULL]);
|
||||
};
|
||||
|
@ -5,5 +5,5 @@ declare(strict_types=1);
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$containerConfigurator->extension('twig', ['strict_variables' => true]);
|
||||
$containerConfigurator->extension('twig', ['strict_variables' => TRUE]);
|
||||
};
|
||||
|
@ -5,5 +5,5 @@ declare(strict_types=1);
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$containerConfigurator->extension('framework', ['validation' => ['not_compromised_password' => false]]);
|
||||
$containerConfigurator->extension('framework', ['validation' => ['not_compromised_password' => FALSE]]);
|
||||
};
|
||||
|
@ -5,7 +5,7 @@ declare(strict_types=1);
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
|
||||
return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
$containerConfigurator->extension('web_profiler', ['toolbar' => false, 'intercept_redirects' => false]);
|
||||
$containerConfigurator->extension('web_profiler', ['toolbar' => FALSE, 'intercept_redirects' => FALSE]);
|
||||
|
||||
$containerConfigurator->extension('framework', ['profiler' => ['collect' => false]]);
|
||||
$containerConfigurator->extension('framework', ['profiler' => ['collect' => FALSE]]);
|
||||
};
|
||||
|
@ -7,7 +7,7 @@ return static function (ContainerConfigurator $containerConfigurator): void {
|
||||
'default_locale' => 'en',
|
||||
'translator' => [
|
||||
'default_path' => '%kernel.project_dir%/translations',
|
||||
'fallbacks' => ['%locale%']
|
||||
]
|
||||
'fallbacks' => ['%locale%'],
|
||||
],
|
||||
]);
|
||||
};
|
||||
|
@ -6,6 +6,5 @@ return static function (TwigConfig $config): void {
|
||||
$config->formThemes(['form_custom_layout.html.twig'])
|
||||
->defaultPath('%kernel.project_dir%/templates')
|
||||
->debug('%kernel.debug%')
|
||||
->strictVariables('%kernel.debug%')
|
||||
;
|
||||
->strictVariables('%kernel.debug%');
|
||||
};
|
||||
|
@ -1,5 +1,6 @@
|
||||
<?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';
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ namespace Symfony\Component\DependencyInjection\Loader\Configurator;
|
||||
|
||||
use App\Maker\MakeCollectionCrud;
|
||||
|
||||
return function (ContainerConfigurator $configurator): void {
|
||||
return static function (ContainerConfigurator $configurator): void {
|
||||
$parameters = $configurator->parameters();
|
||||
$parameters->set('locale', 'en');
|
||||
|
||||
|
@ -11,17 +11,20 @@ require dirname(__DIR__) . '/vendor/autoload.php';
|
||||
|
||||
(new Dotenv())->bootEnv(dirname(__DIR__) . '/.env');
|
||||
|
||||
if ($_SERVER['APP_DEBUG']) {
|
||||
if ($_SERVER['APP_DEBUG'])
|
||||
{
|
||||
umask(0000);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? FALSE) {
|
||||
if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? FALSE)
|
||||
{
|
||||
Request::setTrustedHosts([$trustedHosts]);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
@ -6,13 +6,11 @@ use App\Entity\BrandCategory;
|
||||
use App\Form\BrandCategoryType;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\{Request, Response};
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
#[Route('/brand/category')]
|
||||
class BrandCategoryController extends AbstractController
|
||||
{
|
||||
class BrandCategoryController extends AbstractController {
|
||||
use FormControllerBase;
|
||||
|
||||
protected const ENTITY = BrandCategory::class;
|
||||
|
@ -10,8 +10,7 @@ use Symfony\Component\HttpFoundation\{Request, Response};
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
#[Route('/brand')]
|
||||
class BrandController extends AbstractController
|
||||
{
|
||||
class BrandController extends AbstractController {
|
||||
use FormControllerBase;
|
||||
|
||||
protected const ENTITY = Brand::class;
|
||||
|
@ -2,10 +2,10 @@
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\Camera;
|
||||
use App\Form\CameraType;
|
||||
use App\Controller\
|
||||
{DeleteFormTrait};
|
||||
use App\Entity\Camera;
|
||||
use App\Form\CameraType;
|
||||
use Doctrine\ORM\{EntityManagerInterface, ORMInvalidArgumentException};
|
||||
use LogicException;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
@ -17,8 +17,7 @@ use Symfony\Component\Routing\Annotation\Route;
|
||||
* Camera controller.
|
||||
*/
|
||||
#[Route(path: 'camera')]
|
||||
class CameraController extends AbstractController
|
||||
{
|
||||
class CameraController extends AbstractController {
|
||||
use FormControllerBase;
|
||||
use DeleteFormTrait;
|
||||
|
||||
|
@ -2,18 +2,17 @@
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\CameraType;
|
||||
use App\Form\CameraTypeType;
|
||||
use App\Controller\
|
||||
{DeleteFormTrait};
|
||||
use App\Entity\CameraType;
|
||||
use App\Form\CameraTypeType;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\{RedirectResponse, Request, Response};
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
#[Route(path: 'camera-type')]
|
||||
class CameraTypeController extends AbstractController
|
||||
{
|
||||
class CameraTypeController extends AbstractController {
|
||||
use FormControllerBase;
|
||||
use DeleteFormTrait;
|
||||
|
||||
|
@ -6,8 +6,7 @@ use App\Entity\Chipset;
|
||||
use App\Form\ChipsetType;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\{Request, Response};
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
#[Route('/chipset')]
|
||||
|
@ -6,8 +6,7 @@ use App\Entity\Cpu;
|
||||
use App\Form\CpuType;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\{Request, Response};
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
#[Route('/cpu')]
|
||||
@ -35,7 +34,7 @@ class CpuController extends AbstractController {
|
||||
|
||||
$amd = array_filter($items, static fn (Cpu $cpu) => $cpu->getBrand()->getName() === 'AMD' && $cpu->isReceived());
|
||||
$intel = array_filter($items, static fn (Cpu $cpu) => $cpu->getBrand()->getName() === 'Intel' && $cpu->isReceived());
|
||||
$others = array_filter($items, static fn (Cpu $cpu) => ( ! in_array($cpu->getBrand()->getName(), ['AMD','Intel'])) && $cpu->isReceived());
|
||||
$others = array_filter($items, static fn (Cpu $cpu) => ( ! in_array($cpu->getBrand()->getName(), ['AMD', 'Intel'], TRUE)) && $cpu->isReceived());
|
||||
$notReceived = array_filter($items, static fn (CPU $cpu) => $cpu->isReceived() === FALSE);
|
||||
|
||||
return $this->render($template, [
|
||||
|
@ -6,8 +6,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\{Request, Response};
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
class DefaultController extends AbstractController
|
||||
{
|
||||
class DefaultController extends AbstractController {
|
||||
#[Route(path: '/', name: 'homepage')]
|
||||
public function indexAction(Request $request): Response
|
||||
{
|
||||
|
@ -4,8 +4,7 @@ namespace App\Controller;
|
||||
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
|
||||
trait DeleteFormTrait
|
||||
{
|
||||
trait DeleteFormTrait {
|
||||
/**
|
||||
* Creates a form to delete an entity.
|
||||
*/
|
||||
|
@ -4,8 +4,6 @@ namespace App\Controller;
|
||||
|
||||
use App\Entity\Film;
|
||||
use App\Form\FilmType;
|
||||
use App\Controller\
|
||||
{DeleteFormTrait};
|
||||
use Doctrine\Common\Collections\Criteria;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use LogicException;
|
||||
@ -17,8 +15,7 @@ use Symfony\Component\Routing\Annotation\Route;
|
||||
* Film controller.
|
||||
*/
|
||||
#[Route(path: 'film')]
|
||||
class FilmController extends AbstractController
|
||||
{
|
||||
class FilmController extends AbstractController {
|
||||
use FormControllerBase;
|
||||
use DeleteFormTrait;
|
||||
|
||||
|
@ -2,10 +2,10 @@
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\Flash;
|
||||
use App\Form\FlashType;
|
||||
use App\Controller\
|
||||
{DeleteFormTrait};
|
||||
use App\Entity\Flash;
|
||||
use App\Form\FlashType;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\{RedirectResponse, Request, Response};
|
||||
@ -15,8 +15,7 @@ use Symfony\Component\Routing\Annotation\Route;
|
||||
* Flash controller.
|
||||
*/
|
||||
#[Route(path: 'flash')]
|
||||
class FlashController extends AbstractController
|
||||
{
|
||||
class FlashController extends AbstractController {
|
||||
use FormControllerBase;
|
||||
use DeleteFormTrait;
|
||||
|
||||
|
@ -6,8 +6,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\HttpFoundation\{RedirectResponse, Request, Response};
|
||||
|
||||
trait FormControllerBase
|
||||
{
|
||||
trait FormControllerBase {
|
||||
public function __construct(private readonly EntityManagerInterface $entityManager)
|
||||
{
|
||||
}
|
||||
@ -37,7 +36,8 @@ trait FormControllerBase
|
||||
$form->handleRequest($request);
|
||||
|
||||
// If creating the item
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
if ($form->isSubmitted() && $form->isValid())
|
||||
{
|
||||
$this->entityManager->persist($item);
|
||||
$this->entityManager->flush();
|
||||
|
||||
@ -81,7 +81,8 @@ trait FormControllerBase
|
||||
$templateKey => $item,
|
||||
];
|
||||
|
||||
if (method_exists($this, 'createDeleteForm')) {
|
||||
if (method_exists($this, 'createDeleteForm'))
|
||||
{
|
||||
$deleteForm = $this->createDeleteForm($item);
|
||||
$templateData['delete_form'] = $deleteForm->createView();
|
||||
}
|
||||
@ -101,7 +102,8 @@ trait FormControllerBase
|
||||
$editForm->handleRequest($request);
|
||||
|
||||
// If updating the item
|
||||
if ($editForm->isSubmitted() && $editForm->isValid()) {
|
||||
if ($editForm->isSubmitted() && $editForm->isValid())
|
||||
{
|
||||
$this->entityManager->persist($item);
|
||||
$this->entityManager->flush();
|
||||
|
||||
@ -114,17 +116,20 @@ trait FormControllerBase
|
||||
'form' => $editForm->createView(),
|
||||
];
|
||||
|
||||
if (method_exists($this, 'createDeleteForm')) {
|
||||
if (method_exists($this, 'createDeleteForm'))
|
||||
{
|
||||
$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();
|
||||
}
|
||||
|
||||
if (method_exists($this, 'createReacquireForm')) {
|
||||
if (method_exists($this, 'createReacquireForm'))
|
||||
{
|
||||
$reacquireForm = $this->createReacquireForm($item);
|
||||
$templateData['reacquire_form'] = $reacquireForm->createView();
|
||||
}
|
||||
@ -180,7 +185,8 @@ trait FormControllerBase
|
||||
|
||||
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();
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
@ -6,13 +6,11 @@ use App\Entity\Fpu;
|
||||
use App\Form\FpuType;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\{Request, Response};
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
#[Route('/fpu')]
|
||||
class FpuController extends AbstractController
|
||||
{
|
||||
class FpuController extends AbstractController {
|
||||
use FormControllerBase;
|
||||
|
||||
protected const ENTITY = Fpu::class;
|
||||
|
@ -11,8 +11,7 @@ use Symfony\Component\HttpFoundation\{Request, Response};
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
#[Route('/gpu')]
|
||||
class GpuController extends AbstractController
|
||||
{
|
||||
class GpuController extends AbstractController {
|
||||
use FormControllerBase;
|
||||
|
||||
protected const ENTITY = Gpu::class;
|
||||
@ -28,10 +27,10 @@ class GpuController extends AbstractController
|
||||
public function index(): Response
|
||||
{
|
||||
$items = $this->entityManager->getRepository(self::ENTITY)->findAll();
|
||||
$acquiredItems = array_filter($items, fn (Gpu $item) => $item->isAcquired());
|
||||
$newItems = array_filter($items, fn ($item) => !$item->isAcquired());
|
||||
$acquiredItems = array_filter($items, static fn (Gpu $item) => $item->isAcquired());
|
||||
$newItems = array_filter($items, static fn ($item) => ! $item->isAcquired());
|
||||
|
||||
$filter = fn (array $itemTypes) => array_filter($acquiredItems, fn (Gpu $item) => in_array($item->getCardKey(), $itemTypes));
|
||||
$filter = static fn (array $itemTypes) => array_filter($acquiredItems, static fn (Gpu $item) => in_array($item->getCardKey(), $itemTypes, TRUE));
|
||||
|
||||
$cardTypes = SlotKey::getGroups();
|
||||
$pcieCardTypes = $cardTypes['PCI Express'];
|
||||
@ -47,7 +46,7 @@ class GpuController extends AbstractController
|
||||
'agp' => $filter($agpCardTypes),
|
||||
'pci' => $filter($pciCardTypes),
|
||||
'isa' => $filter($isaCardTypes),
|
||||
]
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -10,8 +10,7 @@ use Symfony\Component\HttpFoundation\{Request, Response};
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
#[Route('/gpu-core')]
|
||||
class GpuCoreController extends AbstractController
|
||||
{
|
||||
class GpuCoreController extends AbstractController {
|
||||
use FormControllerBase;
|
||||
|
||||
protected const ENTITY = GpuCore::class;
|
||||
@ -57,7 +56,8 @@ class GpuCoreController extends AbstractController
|
||||
#[Route('/{id}', name: 'gpu-core_delete', methods: ['POST'])]
|
||||
public function delete(Request $request, GpuCore $gPUCore, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
if ($this->isCsrfTokenValid('delete' . $gPUCore->getId(), $request->request->get('_token'))) {
|
||||
if ($this->isCsrfTokenValid('delete' . $gPUCore->getId(), $request->request->get('_token')))
|
||||
{
|
||||
$entityManager->remove($gPUCore);
|
||||
$entityManager->flush();
|
||||
}
|
||||
|
@ -2,10 +2,10 @@
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\Lenses;
|
||||
use App\Form\LensesType;
|
||||
use App\Controller\
|
||||
{DeleteFormTrait};
|
||||
use App\Entity\Lenses;
|
||||
use App\Form\LensesType;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
@ -16,8 +16,7 @@ use Symfony\Component\Routing\Annotation\Route;
|
||||
* Lens controller.
|
||||
*/
|
||||
#[Route(path: 'lens')]
|
||||
class LensesController extends AbstractController
|
||||
{
|
||||
class LensesController extends AbstractController {
|
||||
use FormControllerBase;
|
||||
use DeleteFormTrait;
|
||||
|
||||
@ -90,10 +89,6 @@ class LensesController extends AbstractController
|
||||
|
||||
/**
|
||||
* Moves a camera to the previouslyOwned table
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
#[Route(path: '/{id}/deacquire', name: 'lens_deacquire', methods: ['POST'])]
|
||||
public function deacquireAction(Request $request, Lenses $lens): RedirectResponse
|
||||
|
@ -4,7 +4,6 @@ namespace App\Controller;
|
||||
|
||||
use App\Entity\PreviouslyOwnedCamera;
|
||||
use App\Form\PreviouslyOwnedCameraType;
|
||||
use App\Controller\FormControllerBase;
|
||||
use Doctrine\ORM\{EntityManagerInterface, ORMInvalidArgumentException};
|
||||
use LogicException;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
@ -17,8 +16,7 @@ use UnexpectedValueException;
|
||||
* Previouslyownedcamera controller.
|
||||
*/
|
||||
#[Route(path: 'previously-owned-camera')]
|
||||
class PreviouslyOwnedCameraController extends AbstractController
|
||||
{
|
||||
class PreviouslyOwnedCameraController extends AbstractController {
|
||||
use FormControllerBase;
|
||||
|
||||
protected const ENTITY = PreviouslyOwnedCamera::class;
|
||||
@ -68,12 +66,8 @@ class PreviouslyOwnedCameraController extends AbstractController
|
||||
/**
|
||||
* Moves a camera to the previouslyOwned table
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @throws LogicException
|
||||
* @throws ORMInvalidArgumentException
|
||||
*
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
#[Route(path: '/{id}/reacquire', name: 'previously-owned-camera_reacquire', methods: ['POST'])]
|
||||
public function reacquireAction(Request $request, PreviouslyOwnedCamera $camera): RedirectResponse
|
||||
|
@ -4,7 +4,6 @@ namespace App\Controller;
|
||||
|
||||
use App\Entity\PreviouslyOwnedFlash;
|
||||
use App\Form\PreviouslyOwnedFlashType;
|
||||
use App\Controller\FormControllerBase;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\{RedirectResponse, Request, Response};
|
||||
@ -14,8 +13,7 @@ use Symfony\Component\Routing\Annotation\Route;
|
||||
* Previouslyownedflash controller.
|
||||
*/
|
||||
#[Route(path: 'previously-owned-flash')]
|
||||
class PreviouslyOwnedFlashController extends AbstractController
|
||||
{
|
||||
class PreviouslyOwnedFlashController extends AbstractController {
|
||||
use FormControllerBase;
|
||||
|
||||
protected const ENTITY = PreviouslyOwnedFlash::class;
|
||||
|
@ -4,15 +4,13 @@ namespace App\Controller;
|
||||
|
||||
use App\Entity\PreviouslyOwnedLenses;
|
||||
use App\Form\PreviouslyOwnedLensesType;
|
||||
use App\Controller\FormControllerBase;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\{RedirectResponse, Request, Response};
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
#[Route(path: 'previously-owned-lens')]
|
||||
class PreviouslyOwnedLensesController extends AbstractController
|
||||
{
|
||||
class PreviouslyOwnedLensesController extends AbstractController {
|
||||
use FormControllerBase;
|
||||
|
||||
protected const ENTITY = PreviouslyOwnedLenses::class;
|
||||
|
@ -1,17 +1,15 @@
|
||||
<?php
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\Socket;
|
||||
use App\Form\SocketTypeForm;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\{Request, Response};
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
#[Route('/socket')]
|
||||
class SocketController extends AbstractController
|
||||
{
|
||||
class SocketController extends AbstractController {
|
||||
use FormControllerBase;
|
||||
|
||||
protected const ENTITY = Socket::class;
|
||||
|
@ -2,13 +2,12 @@
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\Common\Collections\{ArrayCollection, Collection};
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Table(name: 'brand', schema: 'collection')]
|
||||
#[ORM\Entity]
|
||||
#[ORM\UniqueConstraint(name: 'brand_unq', columns: ["name"])]
|
||||
#[ORM\UniqueConstraint(name: 'brand_unq', columns: ['name'])]
|
||||
class Brand {
|
||||
use GetSet;
|
||||
|
||||
|
@ -10,8 +10,7 @@ use Doctrine\ORM\Mapping as ORM;
|
||||
*/
|
||||
#[ORM\Table(name: 'camera', schema: 'collection')]
|
||||
#[ORM\Entity(repositoryClass: CameraRepository::class)]
|
||||
class Camera
|
||||
{
|
||||
class Camera {
|
||||
use GetSet;
|
||||
use CameraBase;
|
||||
|
||||
|
@ -9,8 +9,7 @@ use Doctrine\ORM\Mapping as ORM;
|
||||
*
|
||||
* Shared columns for camera, and previously_owned_camera tables
|
||||
*/
|
||||
trait CameraBase
|
||||
{
|
||||
trait CameraBase {
|
||||
use PurchasePrice;
|
||||
|
||||
#[ORM\ManyToOne(targetEntity: 'CameraType')]
|
||||
@ -36,7 +35,7 @@ trait CameraBase
|
||||
private bool $isWorking;
|
||||
|
||||
#[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)]
|
||||
private string $serial;
|
||||
|
@ -10,8 +10,7 @@ use Stringable;
|
||||
*/
|
||||
#[ORM\Table(name: 'camera_type', schema: 'collection')]
|
||||
#[ORM\Entity]
|
||||
class CameraType implements Stringable
|
||||
{
|
||||
class CameraType implements Stringable {
|
||||
use GetSet;
|
||||
|
||||
#[ORM\Column(name: 'id', type: 'integer', nullable: FALSE)]
|
||||
|
@ -2,8 +2,8 @@
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use Doctrine\Common\Collections\{ArrayCollection, Collection};
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Doctrine\Common\Collections\{Collection, ArrayCollection};
|
||||
|
||||
#[ORM\Table(name: 'chipset', schema: 'collection')]
|
||||
#[ORM\Entity]
|
||||
|
@ -3,7 +3,7 @@
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Enum\CpuArchitecture;
|
||||
use Doctrine\Common\Collections\{Collection, ArrayCollection};
|
||||
use Doctrine\Common\Collections\{ArrayCollection, Collection};
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Table('cpu', schema: 'collection')]
|
||||
@ -43,9 +43,9 @@ class Cpu {
|
||||
#[ORM\Column('part_number', type: 'string')]
|
||||
private string $partNumber;
|
||||
|
||||
#[ORM\Column('lot_number', type: 'string', nullable: TRUE, options: array(
|
||||
'comment' => 'The CPU lot number, such as s-spec for Intel CPUs'
|
||||
))]
|
||||
#[ORM\Column('lot_number', type: 'string', nullable: TRUE, options: [
|
||||
'comment' => 'The CPU lot number, such as s-spec for Intel CPUs',
|
||||
])]
|
||||
private ?string $lotNumber;
|
||||
|
||||
#[ORM\Column('micro_architecture', type: 'string', nullable: TRUE)]
|
||||
@ -54,14 +54,14 @@ class Cpu {
|
||||
#[ORM\Column('codename', type: 'string', nullable: TRUE)]
|
||||
private ?string $codeName = '';
|
||||
|
||||
#[ORM\Column('base_speed', type: 'integer', options: array(
|
||||
'comment' => 'The stock speed of the cpu in MHz'
|
||||
))]
|
||||
#[ORM\Column('base_speed', type: 'integer', options: [
|
||||
'comment' => 'The stock speed of the cpu in MHz',
|
||||
])]
|
||||
private int $baseSpeed;
|
||||
|
||||
#[ORM\Column('boost_speed', type: 'integer', nullable: true, options: array(
|
||||
'comment' => 'The max boost speed of the cpu in MHz, if applicable'
|
||||
))]
|
||||
#[ORM\Column('boost_speed', type: 'integer', nullable: TRUE, options: [
|
||||
'comment' => 'The max boost speed of the cpu in MHz, if applicable',
|
||||
])]
|
||||
private ?int $boostSpeed;
|
||||
|
||||
#[ORM\Column('cores', type: 'integer')]
|
||||
@ -70,15 +70,15 @@ class Cpu {
|
||||
#[ORM\Column('threads', type: 'integer')]
|
||||
private int $threads = 1;
|
||||
|
||||
#[ORM\Column('igp', type: 'string', nullable: true, options: array(
|
||||
'comment' => 'The name of the integrated graphics processor'
|
||||
))]
|
||||
#[ORM\Column('igp', type: 'string', nullable: TRUE, options: [
|
||||
'comment' => 'The name of the integrated graphics processor',
|
||||
])]
|
||||
private ?string $igp;
|
||||
|
||||
#[ORM\Column('voltage', type: 'float', nullable: true)]
|
||||
#[ORM\Column('voltage', type: 'float', nullable: TRUE)]
|
||||
private ?float $voltage;
|
||||
|
||||
#[ORM\Column('tdp', type: 'integer', nullable: true)]
|
||||
#[ORM\Column('tdp', type: 'integer', nullable: TRUE)]
|
||||
private ?int $tdp;
|
||||
|
||||
#[ORM\Column('process_node', type: 'integer', nullable: TRUE)]
|
||||
@ -87,89 +87,89 @@ class Cpu {
|
||||
#[ORM\Column('count', type: 'integer')]
|
||||
private int $count = 1;
|
||||
|
||||
#[ORM\Column('usable', type: 'boolean', options: array(
|
||||
'comment' => 'Whether the chip is working, and can be used with other hardware I have'
|
||||
))]
|
||||
private bool $usable = true;
|
||||
#[ORM\Column('usable', type: 'boolean', options: [
|
||||
'comment' => 'Whether the chip is working, and can be used with other hardware I have',
|
||||
])]
|
||||
private bool $usable = TRUE;
|
||||
|
||||
#[ORM\Column('received', type: 'boolean', options: array(
|
||||
'comment' => "Whether I have the chip in my possession (instead of in shipping)"
|
||||
))]
|
||||
private bool $received = true;
|
||||
#[ORM\Column('received', type: 'boolean', options: [
|
||||
'comment' => 'Whether I have the chip in my possession (instead of in shipping)',
|
||||
])]
|
||||
private bool $received = TRUE;
|
||||
|
||||
#[ORM\Column('link', type: 'string')]
|
||||
private string $link;
|
||||
|
||||
#[ORM\Column('notes', type: 'text', nullable: true)]
|
||||
#[ORM\Column('notes', type: 'text', nullable: TRUE)]
|
||||
private ?string $notes = '';
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// CPU Cache
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
#[ORM\Column('l1_data_count', type:'integer', nullable: true, options: array(
|
||||
'comment' => 'The number of L1 data caches on the package, usually the same as the number of cores'
|
||||
))]
|
||||
private ?int $L1dCount = null;
|
||||
#[ORM\Column('l1_data_count', type: 'integer', nullable: TRUE, options: [
|
||||
'comment' => 'The number of L1 data caches on the package, usually the same as the number of cores',
|
||||
])]
|
||||
private ?int $L1dCount = NULL;
|
||||
|
||||
#[ORM\Column('l1_data_size', type: 'integer', nullable: true, options: array(
|
||||
'comment' => 'The size of each Level 1 data cache in KB'
|
||||
))]
|
||||
private ?int $L1dSize = null;
|
||||
#[ORM\Column('l1_data_size', type: 'integer', nullable: TRUE, options: [
|
||||
'comment' => 'The size of each Level 1 data cache in KB',
|
||||
])]
|
||||
private ?int $L1dSize = NULL;
|
||||
|
||||
#[ORM\Column('l1_data_way', type: 'integer', nullable: true)]
|
||||
private ?int $L1dWay = null;
|
||||
#[ORM\Column('l1_data_way', type: 'integer', nullable: TRUE)]
|
||||
private ?int $L1dWay = NULL;
|
||||
|
||||
#[ORM\Column('l1_code_count', type:'integer', nullable: true, options: array(
|
||||
'comment' => 'The number of L1 instruction caches on the package, usually the same as the number of cores'
|
||||
))]
|
||||
private ?int $L1cCount = null;
|
||||
#[ORM\Column('l1_code_count', type: 'integer', nullable: TRUE, options: [
|
||||
'comment' => 'The number of L1 instruction caches on the package, usually the same as the number of cores',
|
||||
])]
|
||||
private ?int $L1cCount = NULL;
|
||||
|
||||
#[ORM\Column('l1_code_size', type: 'integer', nullable: true, options: array(
|
||||
'comment' => 'The size of each Level 1 instruction cache in KB'
|
||||
))]
|
||||
private ?int $L1cSize = null;
|
||||
#[ORM\Column('l1_code_size', type: 'integer', nullable: TRUE, options: [
|
||||
'comment' => 'The size of each Level 1 instruction cache in KB',
|
||||
])]
|
||||
private ?int $L1cSize = NULL;
|
||||
|
||||
#[ORM\Column('l1_code_way', type: 'integer', nullable: true)]
|
||||
private ?int $L1cWay = null;
|
||||
#[ORM\Column('l1_code_way', type: 'integer', nullable: TRUE)]
|
||||
private ?int $L1cWay = NULL;
|
||||
|
||||
#[ORM\Column('l1_unified_count', type:'integer', nullable: true, options: array(
|
||||
'comment' => 'The number of L1 caches on the package, usually the same as the number of cores'
|
||||
))]
|
||||
private ?int $L1uCount = null;
|
||||
#[ORM\Column('l1_unified_count', type: 'integer', nullable: TRUE, options: [
|
||||
'comment' => 'The number of L1 caches on the package, usually the same as the number of cores',
|
||||
])]
|
||||
private ?int $L1uCount = NULL;
|
||||
|
||||
#[ORM\Column('l1_unified_size', type: 'integer', nullable: true, options: array(
|
||||
'comment' => 'The size of each Level 1 unified cache in KB'
|
||||
))]
|
||||
private ?int $L1uSize = null;
|
||||
#[ORM\Column('l1_unified_size', type: 'integer', nullable: TRUE, options: [
|
||||
'comment' => 'The size of each Level 1 unified cache in KB',
|
||||
])]
|
||||
private ?int $L1uSize = NULL;
|
||||
|
||||
#[ORM\Column('l1_unified_way', type: 'integer', nullable: true)]
|
||||
private ?int $L1uWay = null;
|
||||
#[ORM\Column('l1_unified_way', type: 'integer', nullable: TRUE)]
|
||||
private ?int $L1uWay = NULL;
|
||||
|
||||
#[ORM\Column('l2_count', type: 'integer', options: array(
|
||||
'comment' => 'The number of L2 caches on the package, usually the same as the number of cores'
|
||||
))]
|
||||
#[ORM\Column('l2_count', type: 'integer', options: [
|
||||
'comment' => 'The number of L2 caches on the package, usually the same as the number of cores',
|
||||
])]
|
||||
private int $L2Count = 1;
|
||||
|
||||
#[ORM\Column('l2_size', type: 'integer', nullable: true, options: array(
|
||||
'comment' => 'The size of each Level 2 cache in KB'
|
||||
))]
|
||||
#[ORM\Column('l2_size', type: 'integer', nullable: TRUE, options: [
|
||||
'comment' => 'The size of each Level 2 cache in KB',
|
||||
])]
|
||||
private ?int $L2Size;
|
||||
|
||||
#[ORM\Column('l2_way', type: 'integer', nullable: true)]
|
||||
#[ORM\Column('l2_way', type: 'integer', nullable: TRUE)]
|
||||
private ?int $L2Way;
|
||||
|
||||
#[ORM\Column('l3_count', type: 'integer', options: array(
|
||||
'comment' => 'The number of L3 caches on the package'
|
||||
))]
|
||||
#[ORM\Column('l3_count', type: 'integer', options: [
|
||||
'comment' => 'The number of L3 caches on the package',
|
||||
])]
|
||||
private int $L3Count = 0;
|
||||
|
||||
#[ORM\Column('l3_size', type: 'integer', nullable: true, options: array(
|
||||
'comment' => 'The size of each Level 3 cache in KB'
|
||||
))]
|
||||
#[ORM\Column('l3_size', type: 'integer', nullable: TRUE, options: [
|
||||
'comment' => 'The size of each Level 3 cache in KB',
|
||||
])]
|
||||
private ?int $L3Size;
|
||||
|
||||
#[ORM\Column('l3_way', type: 'integer', nullable: true)]
|
||||
#[ORM\Column('l3_way', type: 'integer', nullable: TRUE)]
|
||||
private ?int $L3Way;
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
@ -10,8 +9,7 @@ use Doctrine\ORM\Mapping as ORM;
|
||||
*/
|
||||
#[ORM\Table(name: 'film', schema: 'collection')]
|
||||
#[ORM\Entity]
|
||||
class Film
|
||||
{
|
||||
class Film {
|
||||
use GetSet;
|
||||
|
||||
#[ORM\Id]
|
||||
|
@ -6,8 +6,7 @@ use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Table(name: 'film_format', schema: 'collection')]
|
||||
#[ORM\Entity]
|
||||
class FilmFormat
|
||||
{
|
||||
class FilmFormat {
|
||||
use GetSet;
|
||||
|
||||
#[ORM\Id]
|
||||
|
@ -9,8 +9,7 @@ use Doctrine\ORM\Mapping as ORM;
|
||||
*/
|
||||
#[ORM\Table(name: 'flash', schema: 'collection')]
|
||||
#[ORM\Entity]
|
||||
class Flash
|
||||
{
|
||||
class Flash {
|
||||
use GetSet;
|
||||
use FlashBase;
|
||||
|
||||
|
@ -4,8 +4,7 @@ namespace App\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
trait FlashBase
|
||||
{
|
||||
trait FlashBase {
|
||||
use PurchasePrice;
|
||||
|
||||
#[ORM\Column(name: 'brand', type: 'string', nullable: FALSE)]
|
||||
|
@ -33,7 +33,7 @@ class Fpu {
|
||||
#[ORM\Column(name: 'clock_speed', type: 'integer')]
|
||||
private int $clockSpeed = 33;
|
||||
|
||||
#[ORM\Column(name: 'count', nullable: FALSE, options: array('default' => 1))]
|
||||
#[ORM\Column(name: 'count', nullable: FALSE, options: ['default' => 1])]
|
||||
private int $count = 1;
|
||||
|
||||
#[ORM\Column(name: 'notes', type: 'text', nullable: TRUE)]
|
||||
|
@ -2,8 +2,7 @@
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Enum\CardBus;
|
||||
use App\Enum\SlotKey;
|
||||
use App\Enum\{CardBus, SlotKey};
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Table(name: 'gpu', schema: 'collection')]
|
||||
@ -41,10 +40,10 @@ class Gpu {
|
||||
name: 'card_key',
|
||||
type: 'string',
|
||||
enumType: SlotKey::class,
|
||||
options: array(
|
||||
'comment' => "The shape of the card connector",
|
||||
'default' => "PCIe x16"
|
||||
)
|
||||
options: [
|
||||
'comment' => 'The shape of the card connector',
|
||||
'default' => 'PCIe x16',
|
||||
]
|
||||
)]
|
||||
private SlotKey $cardKey = SlotKey::PCIE_X16;
|
||||
|
||||
@ -53,67 +52,67 @@ class Gpu {
|
||||
type: 'string',
|
||||
nullable: TRUE,
|
||||
enumType: CardBus::class,
|
||||
options: array('comment' => "The type of electrical bus this card uses")
|
||||
options: ['comment' => 'The type of electrical bus this card uses']
|
||||
)]
|
||||
private ?CardBus $busInterface;
|
||||
|
||||
#[ORM\Column(
|
||||
name: 'slot_span',
|
||||
options: array(
|
||||
'comment' => "How many expansion slots the card occupies",
|
||||
options: [
|
||||
'comment' => 'How many expansion slots the card occupies',
|
||||
'default' => 1,
|
||||
),
|
||||
],
|
||||
)]
|
||||
private int $slotSpan = 1;
|
||||
|
||||
#[ORM\Column(name: 'molex_power', options: array('default' => 0))]
|
||||
#[ORM\Column(name: 'molex_power', options: ['default' => 0])]
|
||||
private int $molexPower = 0;
|
||||
|
||||
#[ORM\Column(name: 'pcie_6_pin', options: array('default' => 0))]
|
||||
#[ORM\Column(name: 'pcie_6_pin', options: ['default' => 0])]
|
||||
private int $pcie6power = 0;
|
||||
|
||||
#[ORM\Column(name: 'pcie_8_pin', options: array('default' => 0))]
|
||||
#[ORM\Column(name: 'pcie_8_pin', options: ['default' => 0])]
|
||||
private int $pcie8power = 0;
|
||||
|
||||
#[ORM\Column(
|
||||
name: 'tdp',
|
||||
nullable: TRUE,
|
||||
options: array('comment' => "Thermal Design Power (in Watts)")
|
||||
options: ['comment' => 'Thermal Design Power (in Watts)']
|
||||
)]
|
||||
private ?int $tdp = 0;
|
||||
|
||||
#[ORM\Column(
|
||||
name: 'base_clock',
|
||||
nullable: TRUE,
|
||||
options: array('comment' => "Base speed of the gpu core, in MHz")
|
||||
options: ['comment' => 'Base speed of the gpu core, in MHz']
|
||||
)]
|
||||
private ?int $baseClock;
|
||||
|
||||
#[ORM\Column(
|
||||
name: 'boost_clock',
|
||||
nullable: TRUE,
|
||||
options: array('comment' => "GPU core boost clock, in MHz")
|
||||
options: ['comment' => 'GPU core boost clock, in MHz']
|
||||
)]
|
||||
private ?int $boostClock;
|
||||
|
||||
#[ORM\Column(
|
||||
name: 'memory_clock',
|
||||
nullable: TRUE,
|
||||
options: array('comment' => "Clock speed of the VRAM, in MHz")
|
||||
options: ['comment' => 'Clock speed of the VRAM, in MHz']
|
||||
)]
|
||||
private ?int $memoryClock;
|
||||
|
||||
#[ORM\Column(
|
||||
name: 'memory_size',
|
||||
nullable: TRUE,
|
||||
options: array('comment' => 'VRAM size, in MiB')
|
||||
options: ['comment' => 'VRAM size, in MiB']
|
||||
)]
|
||||
private ?int $memorySize;
|
||||
|
||||
#[ORM\Column(
|
||||
name: 'memory_bus',
|
||||
nullable: TRUE,
|
||||
options: array("comment" => 'The width of the memory bus in bits')
|
||||
options: ['comment' => 'The width of the memory bus in bits']
|
||||
)]
|
||||
private ?int $memoryBus;
|
||||
|
||||
@ -156,10 +155,10 @@ class Gpu {
|
||||
#[ORM\Column(name: 'link', nullable: TRUE)]
|
||||
private ?string $link;
|
||||
|
||||
#[ORM\Column(name: 'count', nullable: FALSE, options: array('default' => 1))]
|
||||
#[ORM\Column(name: 'count', nullable: FALSE, options: ['default' => 1])]
|
||||
private int $count = 1;
|
||||
|
||||
#[ORM\Column(name: 'acquired', nullable: FALSE, options: array('default' => TRUE))]
|
||||
#[ORM\Column(name: 'acquired', nullable: FALSE, options: ['default' => TRUE])]
|
||||
private bool $acquired;
|
||||
|
||||
#[ORM\Column(name: 'notes', type: 'text', nullable: TRUE)]
|
||||
|
@ -4,8 +4,7 @@ namespace App\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
trait LensTrait
|
||||
{
|
||||
trait LensTrait {
|
||||
use PurchasePrice;
|
||||
|
||||
#[ORM\Column(name: 'brand', type: 'string', length: 64, nullable: TRUE)]
|
||||
|
@ -10,8 +10,7 @@ use Doctrine\ORM\Mapping as ORM;
|
||||
*/
|
||||
#[ORM\Table(name: 'lenses', schema: 'collection')]
|
||||
#[ORM\Entity(repositoryClass: LensesRepository::class)]
|
||||
class Lenses
|
||||
{
|
||||
class Lenses {
|
||||
use GetSet;
|
||||
use LensTrait;
|
||||
|
||||
|
@ -2,8 +2,8 @@
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use Doctrine\Common\Collections\{ArrayCollection, Collection};
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Doctrine\Common\Collections\{Collection, ArrayCollection};
|
||||
|
||||
#[ORM\Table(name: 'motherboard', schema: 'collection')]
|
||||
#[ORM\Entity]
|
||||
@ -41,7 +41,7 @@ class Motherboard {
|
||||
#[ORM\Column('link', type: 'string')]
|
||||
private string $link;
|
||||
|
||||
#[ORM\Column('notes', type: 'text', nullable: true)]
|
||||
#[ORM\Column('notes', type: 'text', nullable: TRUE)]
|
||||
private ?string $notes = '';
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
@ -10,8 +10,7 @@ use Doctrine\ORM\Mapping as ORM;
|
||||
*/
|
||||
#[ORM\Table(name: 'previously_owned_camera', schema: 'collection')]
|
||||
#[ORM\Entity(repositoryClass: CameraRepository::class)]
|
||||
class PreviouslyOwnedCamera
|
||||
{
|
||||
class PreviouslyOwnedCamera {
|
||||
use GetSet;
|
||||
use CameraBase;
|
||||
|
||||
|
@ -9,8 +9,7 @@ use Doctrine\ORM\Mapping as ORM;
|
||||
*/
|
||||
#[ORM\Table(name: 'previously_owned_flash', schema: 'collection')]
|
||||
#[ORM\Entity]
|
||||
class PreviouslyOwnedFlash
|
||||
{
|
||||
class PreviouslyOwnedFlash {
|
||||
use GetSet;
|
||||
use FlashBase;
|
||||
|
||||
|
@ -10,8 +10,7 @@ use Doctrine\ORM\Mapping as ORM;
|
||||
*/
|
||||
#[ORM\Table(name: 'previously_owned_lenses', schema: 'collection')]
|
||||
#[ORM\Entity(repositoryClass: LensesRepository::class)]
|
||||
class PreviouslyOwnedLenses
|
||||
{
|
||||
class PreviouslyOwnedLenses {
|
||||
use GetSet;
|
||||
use LensTrait;
|
||||
|
||||
|
@ -4,8 +4,7 @@ namespace App\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
trait PurchasePrice
|
||||
{
|
||||
trait PurchasePrice {
|
||||
#[ORM\Column(name: 'purchase_price', type: 'money', nullable: TRUE)]
|
||||
private ?string $purchasePrice = NULL;
|
||||
|
||||
@ -18,7 +17,8 @@ trait PurchasePrice
|
||||
|
||||
public function getPurchasePrice(): string
|
||||
{
|
||||
if (empty($this->purchasePrice)) {
|
||||
if (empty($this->purchasePrice))
|
||||
{
|
||||
return '0';
|
||||
}
|
||||
|
||||
|
@ -26,9 +26,9 @@ enum CardBus: string {
|
||||
|
||||
public static function getGroups(): array
|
||||
{
|
||||
$filter = static fn (string $starts_with) =>
|
||||
array_filter(self::cases(), fn (CardBus $case) =>
|
||||
str_starts_with($case->name, $starts_with)
|
||||
$filter = static fn (string $starts_with) => array_filter(
|
||||
self::cases(),
|
||||
static fn (CardBus $case) => str_starts_with($case->name, $starts_with)
|
||||
);
|
||||
|
||||
$pcie = $filter('PCIE_');
|
||||
@ -36,8 +36,8 @@ enum CardBus: string {
|
||||
$pci = $filter('PCI_');
|
||||
$isa = $filter('ISA_');
|
||||
|
||||
$pcie16 = array_filter($pcie, fn (CardBus $case) => str_ends_with($case->name, '_16'));
|
||||
$pcieOther = array_udiff($pcie, $pcie16, fn ($a, $b) => $a->name <=> $b->name);
|
||||
$pcie16 = array_filter($pcie, static fn (CardBus $case) => str_ends_with($case->name, '_16'));
|
||||
$pcieOther = array_udiff($pcie, $pcie16, static fn ($a, $b) => $a->name <=> $b->name);
|
||||
|
||||
return [
|
||||
'PCI Express x16' => $pcie16,
|
||||
|
@ -30,20 +30,22 @@ enum SlotKey: string {
|
||||
public static function getCases(): array
|
||||
{
|
||||
$cases = self::cases();
|
||||
|
||||
return array_map(static fn (UnitEnum $case) => $case->name, $cases);
|
||||
}
|
||||
|
||||
public static function getValues(): array
|
||||
{
|
||||
$cases = self::cases();
|
||||
|
||||
return array_map(static fn (UnitEnum $case) => $case->value, $cases);
|
||||
}
|
||||
|
||||
public static function getGroups(): array
|
||||
{
|
||||
$filter = static fn (string $starts_with) =>
|
||||
array_filter(self::cases(), fn (SlotKey $case) =>
|
||||
str_starts_with($case->name, $starts_with)
|
||||
$filter = static fn (string $starts_with) => array_filter(
|
||||
self::cases(),
|
||||
static fn (SlotKey $case) => str_starts_with($case->name, $starts_with)
|
||||
);
|
||||
|
||||
return [
|
||||
@ -68,7 +70,7 @@ enum SlotKey: string {
|
||||
self::ISA_16,
|
||||
self::ISA_8,
|
||||
self::ISA_VLB,
|
||||
]
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -2,14 +2,12 @@
|
||||
|
||||
namespace App\Form;
|
||||
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Doctrine\ORM\{EntityRepository, QueryBuilder};
|
||||
|
||||
trait BrandCategoryTrait {
|
||||
public static function filterBrands(string $filter): callable
|
||||
{
|
||||
return static fn(EntityRepository $e) =>
|
||||
$e->createQueryBuilder('b')
|
||||
return static fn (EntityRepository $e) => $e->createQueryBuilder('b')
|
||||
->join('b.categories', 'bc')
|
||||
->where('bc.name=:name')
|
||||
->orderBy('b.name', 'ASC')
|
||||
|
@ -1,19 +1,16 @@
|
||||
<?php
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace App\Form;
|
||||
|
||||
use App\Entity\BrandCategory;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Form\{AbstractType, FormBuilderInterface};
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class BrandCategoryType extends AbstractType
|
||||
{
|
||||
class BrandCategoryType extends AbstractType {
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder
|
||||
->add('name')
|
||||
;
|
||||
->add('name');
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
|
@ -2,15 +2,11 @@
|
||||
|
||||
namespace App\Form;
|
||||
|
||||
use App\Entity\Brand;
|
||||
use App\Entity\{Brand, BrandCategory};
|
||||
use Symfony\Component\Form\{AbstractType, FormBuilderInterface};
|
||||
use App\Entity\BrandCategory;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class BrandType extends AbstractType
|
||||
{
|
||||
class BrandType extends AbstractType {
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder
|
||||
|
@ -9,8 +9,7 @@ use Symfony\Component\OptionsResolver\Exception\AccessException;
|
||||
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class CameraType extends AbstractType
|
||||
{
|
||||
class CameraType extends AbstractType {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
@ -8,8 +8,7 @@ use Symfony\Component\OptionsResolver\Exception\AccessException;
|
||||
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class CameraTypeType extends AbstractType
|
||||
{
|
||||
class CameraTypeType extends AbstractType {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
@ -1,16 +1,13 @@
|
||||
<?php
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace App\Form;
|
||||
|
||||
use App\Entity\Brand;
|
||||
use App\Entity\Chipset;
|
||||
use App\Entity\{Brand, Chipset};
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Form\{AbstractType, FormBuilderInterface};
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class ChipsetType extends AbstractType
|
||||
{
|
||||
class ChipsetType extends AbstractType {
|
||||
use BrandCategoryTrait;
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
@ -22,8 +19,7 @@ class ChipsetType extends AbstractType
|
||||
])
|
||||
->add('name')
|
||||
->add('parts')
|
||||
->add('link')
|
||||
;
|
||||
->add('link');
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
|
@ -1,15 +1,12 @@
|
||||
<?php
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace App\Form;
|
||||
|
||||
use App\Entity\Brand;
|
||||
use App\Entity\Cpu;
|
||||
use App\Entity\{Brand, Cpu};
|
||||
use App\Enum\CpuArchitecture;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\EnumType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\UrlType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Form\Extension\Core\Type\{EnumType, UrlType};
|
||||
use Symfony\Component\Form\{AbstractType, FormBuilderInterface};
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use UnitEnum;
|
||||
|
||||
@ -21,7 +18,7 @@ class CpuType extends AbstractType {
|
||||
$builder
|
||||
->add('architecture', EnumType::class, [
|
||||
'class' => CpuArchitecture::class,
|
||||
'choice_label' => fn(UnitEnum $choice): string => $choice->value,
|
||||
'choice_label' => static fn (UnitEnum $choice): string => $choice->value,
|
||||
'choices' => CpuArchitecture::getGroups(),
|
||||
])
|
||||
->add('brand', EntityType::class, [
|
||||
@ -37,50 +34,50 @@ class CpuType extends AbstractType {
|
||||
->add('codeName')
|
||||
|
||||
// Cache Stuff
|
||||
->add('L1dCount', null, [
|
||||
->add('L1dCount', NULL, [
|
||||
'label' => 'L1 Data Cache(s)',
|
||||
])
|
||||
->add('L1dSize', null, [
|
||||
'label' => 'L1 Data Size KB'
|
||||
->add('L1dSize', NULL, [
|
||||
'label' => 'L1 Data Size KB',
|
||||
])
|
||||
->add('L1dWay', null, [
|
||||
'label' => 'L1 Data (x-way)'
|
||||
->add('L1dWay', NULL, [
|
||||
'label' => 'L1 Data (x-way)',
|
||||
])
|
||||
->add('L1cCount', null, [
|
||||
->add('L1cCount', NULL, [
|
||||
'label' => 'L1 Instruction Cache(s)',
|
||||
])
|
||||
->add('L1cSize', null, [
|
||||
'label' => 'L1 Instruction Size KB'
|
||||
->add('L1cSize', NULL, [
|
||||
'label' => 'L1 Instruction Size KB',
|
||||
])
|
||||
->add('L1cWay', null, [
|
||||
'label' => 'L1 Instruction (x-way)'
|
||||
->add('L1cWay', NULL, [
|
||||
'label' => 'L1 Instruction (x-way)',
|
||||
])
|
||||
->add('L1uCount', null, [
|
||||
->add('L1uCount', NULL, [
|
||||
'label' => 'L1 Unified Cache(s)',
|
||||
])
|
||||
->add('L1uSize', null, [
|
||||
'label' => 'L1 Unified Cache Size: KB'
|
||||
->add('L1uSize', NULL, [
|
||||
'label' => 'L1 Unified Cache Size: KB',
|
||||
])
|
||||
->add('L1uWay', null, [
|
||||
'label' => 'L1 Unified (x-way)'
|
||||
->add('L1uWay', NULL, [
|
||||
'label' => 'L1 Unified (x-way)',
|
||||
])
|
||||
->add('L2Count', null, [
|
||||
'label' => 'L2 Cache(s)'
|
||||
->add('L2Count', NULL, [
|
||||
'label' => 'L2 Cache(s)',
|
||||
])
|
||||
->add('L2Size', null, [
|
||||
'label' => 'L2 Cache Size KB (per unit)'
|
||||
->add('L2Size', NULL, [
|
||||
'label' => 'L2 Cache Size KB (per unit)',
|
||||
])
|
||||
->add('L2Way', null, [
|
||||
'label' => 'L2 Cache (x-way)'
|
||||
->add('L2Way', NULL, [
|
||||
'label' => 'L2 Cache (x-way)',
|
||||
])
|
||||
->add('L3Count', null, [
|
||||
'label' => 'L3 Cache(s)'
|
||||
->add('L3Count', NULL, [
|
||||
'label' => 'L3 Cache(s)',
|
||||
])
|
||||
->add('L3Size', null, [
|
||||
'label' => 'L3 Cache Size KB (per unit)'
|
||||
->add('L3Size', NULL, [
|
||||
'label' => 'L3 Cache Size KB (per unit)',
|
||||
])
|
||||
->add('L3Way', null, [
|
||||
'label' => 'L3 Cache (x-way)'
|
||||
->add('L3Way', NULL, [
|
||||
'label' => 'L3 Cache (x-way)',
|
||||
])
|
||||
|
||||
->add('baseSpeed')
|
||||
@ -95,8 +92,7 @@ class CpuType extends AbstractType {
|
||||
->add('usable')
|
||||
->add('received')
|
||||
->add('link', UrlType::class)
|
||||
->add('notes')
|
||||
;
|
||||
->add('notes');
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
|
@ -7,8 +7,7 @@ use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\{AbstractType, FormBuilderInterface};
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class FilmType extends AbstractType
|
||||
{
|
||||
class FilmType extends AbstractType {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
@ -8,8 +8,7 @@ use Symfony\Component\OptionsResolver\Exception\AccessException;
|
||||
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class FlashType extends AbstractType
|
||||
{
|
||||
class FlashType extends AbstractType {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
@ -1,18 +1,14 @@
|
||||
<?php
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace App\Form;
|
||||
|
||||
use App\Entity\Brand;
|
||||
use App\Entity\Fpu;
|
||||
use App\Entity\Socket;
|
||||
use App\Entity\{Brand, Fpu, Socket};
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Form\{AbstractType, FormBuilderInterface};
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class FpuType extends AbstractType
|
||||
{
|
||||
class FpuType extends AbstractType {
|
||||
use BrandCategoryTrait;
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
@ -30,8 +26,7 @@ class FpuType extends AbstractType
|
||||
->add('model')
|
||||
->add('clockSpeed')
|
||||
->add('count')
|
||||
->add('notes')
|
||||
;
|
||||
->add('notes');
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
|
@ -3,13 +3,11 @@
|
||||
namespace App\Form;
|
||||
|
||||
use App\Entity\{Brand, GpuCore};
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\{AbstractType, FormBuilderInterface};
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class GPUCoreType extends AbstractType
|
||||
{
|
||||
class GPUCoreType extends AbstractType {
|
||||
use BrandCategoryTrait;
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
@ -35,4 +33,3 @@ class GPUCoreType extends AbstractType
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,8 +2,8 @@
|
||||
|
||||
namespace App\Form;
|
||||
|
||||
use App\Enum\{CardBus, SlotKey};
|
||||
use App\Entity\{Brand, Gpu, GpuCore};
|
||||
use App\Enum\{CardBus, SlotKey};
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\
|
||||
@ -40,12 +40,12 @@ class GpuType extends AbstractType {
|
||||
->add('cardKey', EnumType::class, [
|
||||
'class' => SlotKey::class,
|
||||
'choices' => SlotKey::getGroups(),
|
||||
'choice_label' => fn(UnitEnum $choice): string => $choice->value,
|
||||
'choice_label' => static fn (UnitEnum $choice): string => $choice->value,
|
||||
])
|
||||
->add('busInterface', EnumType::class, [
|
||||
'class' => CardBus::class,
|
||||
'choices' => CardBus::getGroups(),
|
||||
'choice_label' => fn(UnitEnum $choice): string => $choice->value,
|
||||
'choice_label' => static fn (UnitEnum $choice): string => $choice->value,
|
||||
])
|
||||
->add('slotSpan')
|
||||
->add('molexPower', NULL, ['label' => 'Molex Power Connectors'])
|
||||
|
@ -9,8 +9,7 @@ use Symfony\Component\OptionsResolver\Exception\AccessException;
|
||||
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class LensesType extends AbstractType
|
||||
{
|
||||
class LensesType extends AbstractType {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
@ -8,8 +8,7 @@ use Symfony\Component\OptionsResolver\Exception\AccessException;
|
||||
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class PreviouslyOwnedCameraType extends AbstractType
|
||||
{
|
||||
class PreviouslyOwnedCameraType extends AbstractType {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
@ -8,8 +8,7 @@ use Symfony\Component\OptionsResolver\Exception\AccessException;
|
||||
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class PreviouslyOwnedFlashType extends AbstractType
|
||||
{
|
||||
class PreviouslyOwnedFlashType extends AbstractType {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
@ -8,8 +8,7 @@ use Symfony\Component\OptionsResolver\Exception\AccessException;
|
||||
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class PreviouslyOwnedLensesType extends AbstractType
|
||||
{
|
||||
class PreviouslyOwnedLensesType extends AbstractType {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
@ -1,16 +1,14 @@
|
||||
<?php
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace App\Form;
|
||||
|
||||
use App\Entity\Socket;
|
||||
use App\Enum\SocketType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\EnumType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Form\{AbstractType, FormBuilderInterface};
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class SocketTypeForm extends AbstractType
|
||||
{
|
||||
class SocketTypeForm extends AbstractType {
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder
|
||||
@ -19,8 +17,7 @@ class SocketTypeForm extends AbstractType
|
||||
->add('pinCount')
|
||||
->add('type', EnumType::class, [
|
||||
'class' => SocketType::class,
|
||||
])
|
||||
;
|
||||
]);
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
|
@ -18,16 +18,14 @@ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigura
|
||||
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
|
||||
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
|
||||
|
||||
class Kernel extends BaseKernel
|
||||
{
|
||||
class Kernel extends BaseKernel {
|
||||
use MicroKernelTrait;
|
||||
|
||||
protected function configureContainer(
|
||||
ContainerConfigurator $container,
|
||||
LoaderInterface $loader,
|
||||
ContainerBuilder $builder
|
||||
): void
|
||||
{
|
||||
): void {
|
||||
$configDir = $this->getConfigDir();
|
||||
|
||||
$container->import('../config/{packages}/*.yaml');
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony MakerBundle package.
|
||||
@ -12,32 +12,23 @@
|
||||
namespace App\Maker;
|
||||
|
||||
use Doctrine\Bundle\DoctrineBundle\DoctrineBundle;
|
||||
use Doctrine\Inflector\Inflector;
|
||||
use Doctrine\Inflector\InflectorFactory;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\Inflector\{Inflector, InflectorFactory};
|
||||
use Doctrine\ORM\{EntityManagerInterface, EntityRepository};
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
use Symfony\Bundle\MakerBundle\ConsoleStyle;
|
||||
use Symfony\Bundle\MakerBundle\DependencyBuilder;
|
||||
use Symfony\Bundle\MakerBundle\Doctrine\DoctrineHelper;
|
||||
use Symfony\Bundle\MakerBundle\Generator;
|
||||
use Symfony\Bundle\MakerBundle\InputConfiguration;
|
||||
use Symfony\Bundle\MakerBundle\Maker\AbstractMaker;
|
||||
use Symfony\Bundle\MakerBundle\Renderer\FormTypeRenderer;
|
||||
use Symfony\Bundle\MakerBundle\Str;
|
||||
use Symfony\Bundle\MakerBundle\Util\UseStatementGenerator;
|
||||
use Symfony\Bundle\MakerBundle\Validator;
|
||||
use Symfony\Bundle\MakerBundle\{ConsoleStyle, DependencyBuilder, Generator, InputConfiguration, Str, Validator};
|
||||
use Symfony\Bundle\TwigBundle\TwigBundle;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\{InputArgument, InputInterface};
|
||||
use Symfony\Component\Console\Question\Question;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\{Request, Response};
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Security\Csrf\CsrfTokenManager;
|
||||
use Symfony\Component\Validator\Validation;
|
||||
@ -45,11 +36,10 @@ use Symfony\Component\Validator\Validation;
|
||||
/**
|
||||
* @author Sadicov Vladimir <sadikoff@gmail.com>
|
||||
*/
|
||||
final class MakeCollectionCrud extends AbstractMaker
|
||||
{
|
||||
final class MakeCollectionCrud extends AbstractMaker {
|
||||
private Inflector $inflector;
|
||||
private string $controllerClassName;
|
||||
private bool $generateTests = false;
|
||||
private bool $generateTests = FALSE;
|
||||
|
||||
public function __construct(private DoctrineHelper $doctrineHelper, private FormTypeRenderer $formTypeRenderer)
|
||||
{
|
||||
@ -72,15 +62,15 @@ final class MakeCollectionCrud extends AbstractMaker
|
||||
{
|
||||
$command
|
||||
->addArgument('entity-class', InputArgument::OPTIONAL, sprintf('The class name of the entity to create CRUD (e.g. <fg=yellow>%s</>)', Str::asClassName(Str::getRandomTerm())))
|
||||
->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeCrud.txt'))
|
||||
;
|
||||
->setHelp(file_get_contents(__DIR__ . '/../Resources/help/MakeCrud.txt'));
|
||||
|
||||
$inputConfig->setArgumentAsNonInteractive('entity-class');
|
||||
}
|
||||
|
||||
public function interact(InputInterface $input, ConsoleStyle $io, Command $command): void
|
||||
{
|
||||
if (null === $input->getArgument('entity-class')) {
|
||||
if (NULL === $input->getArgument('entity-class'))
|
||||
{
|
||||
$argument = $command->getDefinition()->getArgument('entity-class');
|
||||
|
||||
$entities = $this->doctrineHelper->getEntitiesForAutocomplete();
|
||||
@ -100,7 +90,7 @@ final class MakeCollectionCrud extends AbstractMaker
|
||||
$defaultControllerClass
|
||||
);
|
||||
|
||||
$this->generateTests = $io->confirm('Do you want to generate tests for the controller?. [Experimental]', false);
|
||||
$this->generateTests = $io->confirm('Do you want to generate tests for the controller?. [Experimental]', FALSE);
|
||||
}
|
||||
|
||||
public function generate(InputInterface $input, ConsoleStyle $io, Generator $generator): void
|
||||
@ -115,7 +105,8 @@ final class MakeCollectionCrud extends AbstractMaker
|
||||
$repositoryVars = [];
|
||||
$repositoryClassName = EntityManagerInterface::class;
|
||||
|
||||
if (null !== $entityDoctrineDetails->getRepositoryClass()) {
|
||||
if (NULL !== $entityDoctrineDetails->getRepositoryClass())
|
||||
{
|
||||
$repositoryClassDetails = $generator->createClassNameDetails(
|
||||
'\\' . $entityDoctrineDetails->getRepositoryClass(),
|
||||
'Repository\\',
|
||||
@ -138,14 +129,17 @@ final class MakeCollectionCrud extends AbstractMaker
|
||||
);
|
||||
|
||||
$iter = 0;
|
||||
do {
|
||||
|
||||
do
|
||||
{
|
||||
$formClassDetails = $generator->createClassNameDetails(
|
||||
$entityClassDetails->getRelativeNameWithoutSuffix() . ($iter ?: '') . 'Type',
|
||||
'Form\\',
|
||||
'Type'
|
||||
);
|
||||
++$iter;
|
||||
} while (class_exists($formClassDetails->getFullName()));
|
||||
$iter++;
|
||||
}
|
||||
while (class_exists($formClassDetails->getFullName()));
|
||||
|
||||
$entityVarPlural = lcfirst($this->inflector->pluralize($entityClassDetails->getShortName()));
|
||||
$entityVarSingular = lcfirst($this->inflector->singularize($entityClassDetails->getShortName()));
|
||||
@ -169,7 +163,8 @@ final class MakeCollectionCrud extends AbstractMaker
|
||||
$generator->generateController(
|
||||
$controllerClassDetails->getFullName(),
|
||||
CRUD_TEMPLATE_PREFIX . '/controller/Controller.tpl.php',
|
||||
array_merge([
|
||||
array_merge(
|
||||
[
|
||||
'use_statements' => $useStatements,
|
||||
'entity_class_name' => $entityClassDetails->getShortName(),
|
||||
'form_class_name' => $formClassDetails->getShortName(),
|
||||
@ -224,7 +219,8 @@ final class MakeCollectionCrud extends AbstractMaker
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($templates as $template => $variables) {
|
||||
foreach ($templates as $template => $variables)
|
||||
{
|
||||
$generator->generateTemplate(
|
||||
$templatesPath . '/' . $template . '.html.twig',
|
||||
CRUD_TEMPLATE_PREFIX . '/templates/' . $template . '.tpl.php',
|
||||
@ -232,7 +228,8 @@ final class MakeCollectionCrud extends AbstractMaker
|
||||
);
|
||||
}
|
||||
|
||||
if ($this->generateTests) {
|
||||
if ($this->generateTests)
|
||||
{
|
||||
$testClassDetails = $generator->createClassNameDetails(
|
||||
$entityClassDetails->getRelativeNameWithoutSuffix(),
|
||||
'Test\\Controller\\',
|
||||
@ -248,7 +245,8 @@ final class MakeCollectionCrud extends AbstractMaker
|
||||
|
||||
$usesEntityManager = EntityManagerInterface::class === $repositoryClassName;
|
||||
|
||||
if ($usesEntityManager) {
|
||||
if ($usesEntityManager)
|
||||
{
|
||||
$useStatements->addUseStatement(EntityRepository::class);
|
||||
}
|
||||
|
||||
@ -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.');
|
||||
}
|
||||
}
|
||||
|
@ -10,8 +10,7 @@ use Doctrine\Migrations\AbstractMigration;
|
||||
/**
|
||||
* Auto-generated Migration: Please modify to your needs!
|
||||
*/
|
||||
final class Version20221117193508 extends AbstractMigration
|
||||
{
|
||||
final class Version20221117193508 extends AbstractMigration {
|
||||
public function getDescription(): string
|
||||
{
|
||||
return '';
|
||||
|
@ -7,8 +7,7 @@ use Doctrine\ORM\{EntityRepository};
|
||||
use ReflectionObject;
|
||||
use Throwable;
|
||||
|
||||
abstract class AcquireRepository extends EntityRepository
|
||||
{
|
||||
abstract class AcquireRepository extends EntityRepository {
|
||||
abstract public function reacquire(mixed $currentRecord): void;
|
||||
|
||||
abstract public function deacquire(mixed $currentRecord): void;
|
||||
@ -24,9 +23,11 @@ abstract class AcquireRepository extends EntityRepository
|
||||
$old = new ReflectionObject($currentRecord);
|
||||
$new = new ReflectionObject($newRecord);
|
||||
|
||||
foreach ($old->getProperties() as $property) {
|
||||
foreach ($old->getProperties() as $property)
|
||||
{
|
||||
$propertyName = $property->getName();
|
||||
if ($new->hasProperty($propertyName)) {
|
||||
if ($new->hasProperty($propertyName))
|
||||
{
|
||||
$newProperty = $new->getProperty($propertyName);
|
||||
$newProperty->setAccessible(TRUE);
|
||||
$property->setAccessible(TRUE);
|
||||
@ -34,11 +35,14 @@ abstract class AcquireRepository extends EntityRepository
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
try
|
||||
{
|
||||
$em->persist($newRecord);
|
||||
$em->remove($currentRecord);
|
||||
$em->flush();
|
||||
} catch (Throwable) {
|
||||
}
|
||||
catch (Throwable)
|
||||
{
|
||||
dump($newRecord);
|
||||
}
|
||||
}
|
||||
|
@ -5,8 +5,7 @@ namespace App\Repository;
|
||||
use App\Entity\{Camera, PreviouslyOwnedCamera};
|
||||
use Doctrine\ORM\{ORMInvalidArgumentException};
|
||||
|
||||
class CameraRepository extends AcquireRepository
|
||||
{
|
||||
class CameraRepository extends AcquireRepository {
|
||||
/**
|
||||
* @throws ORMInvalidArgumentException
|
||||
*/
|
||||
|
@ -5,8 +5,7 @@ namespace App\Repository;
|
||||
use App\Entity\{Flash, PreviouslyOwnedFlash};
|
||||
use Doctrine\ORM\{ORMInvalidArgumentException};
|
||||
|
||||
class FlashRepository extends AcquireRepository
|
||||
{
|
||||
class FlashRepository extends AcquireRepository {
|
||||
/**
|
||||
* @throws ORMInvalidArgumentException
|
||||
*/
|
||||
|
@ -4,8 +4,7 @@ namespace App\Repository;
|
||||
|
||||
use App\Entity\{Lenses, PreviouslyOwnedLenses};
|
||||
|
||||
class LensesRepository extends AcquireRepository
|
||||
{
|
||||
class LensesRepository extends AcquireRepository {
|
||||
public function deacquire(mixed $currentRecord): void
|
||||
{
|
||||
$currentRecord->setFormerlyOwned(TRUE)
|
||||
|
@ -32,9 +32,12 @@ class <?= $class_name ?> extends AbstractController {
|
||||
<?php endif ?>
|
||||
|
||||
<?= $generator->generateRouteForControllerMethod('/new', sprintf('%s_new', $route_name), ['GET', 'POST']) ?>
|
||||
<?php if (isset($repository_full_class_name) && $generator->repositoryHasSaveAndRemoveMethods($repository_full_class_name)) { ?>
|
||||
<?php if (isset($repository_full_class_name) && $generator->repositoryHasSaveAndRemoveMethods($repository_full_class_name))
|
||||
{ ?>
|
||||
public function new(Request $request, <?= $repository_class_name ?> $<?= $repository_var ?>): Response
|
||||
<?php } else { ?>
|
||||
<?php }
|
||||
else
|
||||
{ ?>
|
||||
public function new(Request $request): Response
|
||||
<?php } ?>
|
||||
{
|
||||
@ -48,9 +51,12 @@ class <?= $class_name ?> extends AbstractController {
|
||||
}
|
||||
|
||||
<?= $generator->generateRouteForControllerMethod(sprintf('/{%s}/edit', $entity_identifier), sprintf('%s_edit', $route_name), ['GET', 'POST']) ?>
|
||||
<?php if (isset($repository_full_class_name) && $generator->repositoryHasSaveAndRemoveMethods($repository_full_class_name)) { ?>
|
||||
<?php if (isset($repository_full_class_name) && $generator->repositoryHasSaveAndRemoveMethods($repository_full_class_name))
|
||||
{ ?>
|
||||
public function edit(Request $request, <?= $entity_class_name ?> $<?= $entity_var_singular ?>, <?= $repository_class_name ?> $<?= $repository_var ?>): Response
|
||||
<?php } else { ?>
|
||||
<?php }
|
||||
else
|
||||
{ ?>
|
||||
public function edit(Request $request, <?= $entity_class_name ?> $<?= $entity_var_singular ?>): Response
|
||||
<?php } ?>
|
||||
{
|
||||
@ -58,9 +64,12 @@ class <?= $class_name ?> extends AbstractController {
|
||||
}
|
||||
|
||||
<?= $generator->generateRouteForControllerMethod(sprintf('/{%s}', $entity_identifier), sprintf('%s_delete', $route_name), ['POST']) ?>
|
||||
<?php if (isset($repository_full_class_name) && $generator->repositoryHasSaveAndRemoveMethods($repository_full_class_name)) { ?>
|
||||
<?php if (isset($repository_full_class_name) && $generator->repositoryHasSaveAndRemoveMethods($repository_full_class_name))
|
||||
{ ?>
|
||||
public function delete(Request $request, <?= $entity_class_name ?> $<?= $entity_var_singular ?>, <?= $repository_class_name ?> $<?= $repository_var ?>): Response
|
||||
<?php } else { ?>
|
||||
<?php }
|
||||
else
|
||||
{ ?>
|
||||
public function delete(Request $request, <?= $entity_class_name ?> $<?= $entity_var_singular ?>): Response
|
||||
<?php } ?>
|
||||
{
|
||||
|
@ -7,8 +7,7 @@ use Doctrine\DBAL\Platforms\AbstractPlatform;
|
||||
|
||||
use Doctrine\DBAL\Types\Type;
|
||||
|
||||
class MoneyType extends Type
|
||||
{
|
||||
class MoneyType extends Type {
|
||||
public function getSQLDeclaration(array $column, AbstractPlatform $platform): string
|
||||
{
|
||||
return 'MONEY';
|
||||
|
@ -4,8 +4,7 @@ namespace App\ValueObject;
|
||||
|
||||
use Stringable;
|
||||
|
||||
class Money implements Stringable
|
||||
{
|
||||
class Money implements Stringable {
|
||||
private readonly float $value;
|
||||
|
||||
public function __construct(mixed $value)
|
||||
@ -13,13 +12,13 @@ class Money implements Stringable
|
||||
$this->value = (float) str_replace(['$', ','], '', (string) $value);
|
||||
}
|
||||
|
||||
public function getValue(): float
|
||||
{
|
||||
return (float) str_replace(['$', ','], '', (string) $this->value);
|
||||
}
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return (string) $this->getValue();
|
||||
}
|
||||
|
||||
public function getValue(): float
|
||||
{
|
||||
return (float) str_replace(['$', ','], '', (string) $this->value);
|
||||
}
|
||||
}
|
||||
|
@ -4,8 +4,11 @@ use Symfony\Component\Dotenv\Dotenv;
|
||||
|
||||
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')) {
|
||||
}
|
||||
elseif (method_exists(Dotenv::class, 'bootEnv'))
|
||||
{
|
||||
(new Dotenv())->bootEnv(dirname(__DIR__) . '/.env');
|
||||
}
|
||||
|
@ -2,7 +2,8 @@
|
||||
|
||||
function walk_array(callable $method, array $items): void
|
||||
{
|
||||
foreach ($items as $item) {
|
||||
foreach ($items as $item)
|
||||
{
|
||||
$method($item);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user