Compare commits

...

6 Commits

57 changed files with 5759 additions and 3350 deletions

5
.gitignore vendored
View File

@ -9,3 +9,8 @@
/phpunit.xml /phpunit.xml
.phpunit.result.cache .phpunit.result.cache
###< phpunit/phpunit ### ###< phpunit/phpunit ###
# PHP CS Fixer
tools/vendor/
/.php-cs-fixer.php
/.php-cs-fixer.cache

545
.php-cs-fixer.dist.php Normal file
View File

@ -0,0 +1,545 @@
<?php declare(strict_types=1);
use Nexus\CsConfig\Factory;
use PhpCsFixer\{Config, Finder};
$finder = Finder::create()
->in(__DIR__)
->exclude('var')
->exclude('vendor');
return (new Config())
->setRiskyAllowed(TRUE)
->setFinder($finder)
->setRules([
'align_multiline_comment' => false,
'array_indentation' => true,
'array_push' => true,
'array_syntax' => ['syntax' => 'short'],
'assign_null_coalescing_to_coalesce_equal' => true,
'backtick_to_shell_exec' => true,
'binary_operator_spaces' => [
'default' => 'single_space',
'operators' => [
'=' => 'align_single_space_minimal',
'=>' => 'align_single_space_minimal',
'||' => 'align_single_space_minimal',
'.=' => 'align_single_space_minimal',
],
],
'blank_line_after_namespace' => true,
'blank_line_after_opening_tag' => false,
'blank_line_before_statement' => [
'statements' => [
'case',
'continue',
'declare',
'default',
'do',
'exit',
'for',
'foreach',
'goto',
'return',
'switch',
'throw',
'try',
'while',
'yield',
'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',
],
'cast_spaces' => ['space' => 'single'],
'class_attributes_separation' => [
'elements' => [
'const' => 'none',
'property' => 'none',
'method' => 'one',
'trait_import' => 'none',
],
],
'class_definition' => [
'multi_line_extends_each_single_line' => true,
'single_item_single_line' => true,
'single_line' => true,
'space_before_parenthesis' => true,
],
'class_reference_name_casing' => true,
'clean_namespace' => true,
'combine_consecutive_issets' => true,
'combine_consecutive_unsets' => true,
'combine_nested_dirname' => true,
'comment_to_phpdoc' => [
'ignored_tags' => [
'todo',
'codeCoverageIgnore',
'codeCoverageIgnoreStart',
'codeCoverageIgnoreEnd',
'phpstan-ignore-line',
'phpstan-ignore-next-line',
],
],
'compact_nullable_typehint' => true,
'concat_space' => ['spacing' => 'one'],
'constant_case' => ['case' => 'upper'],
'control_structure_continuation_position' => ['position' => 'same_line'],
'date_time_immutable' => false,
'declare_equal_normalize' => ['space' => 'none'],
'declare_parentheses' => true,
'declare_strict_types' => true,
'dir_constant' => true,
'doctrine_annotation_array_assignment' => false,
'doctrine_annotation_braces' => false,
'doctrine_annotation_indentation' => false,
'doctrine_annotation_spaces' => false,
'echo_tag_syntax' => [
'format' => 'short',
'long_function' => 'echo',
'shorten_simple_statements_only' => false,
],
'elseif' => false,
'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,
'single_quoted' => false,
],
'explicit_indirect_variable' => true,
'explicit_string_variable' => true,
'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,
'fopen_flag_order' => true,
'fopen_flags' => ['b_mode' => true],
'full_opening_tag' => true,
'fully_qualified_strict_types' => true,
'function_declaration' => ['closure_function_spacing' => 'one'],
'function_to_constant' => [
'functions' => [
'get_called_class',
'get_class',
'get_class_this',
'php_sapi_name',
'phpversion',
'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'],
],
'get_class_to_class_keyword' => false,
'global_namespace_import' => [
'import_constants' => false,
'import_functions' => false,
'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,
'increment_style' => ['style' => 'post'],
'indentation_type' => true,
'integer_literal_case' => true,
'is_null' => true,
'lambda_not_used_import' => true,
'line_ending' => true,
'linebreak_after_opening_tag' => false,
'list_syntax' => ['syntax' => 'short'],
'logical_operators' => true,
'lowercase_cast' => true,
'lowercase_keywords' => true,
'lowercase_static_reference' => true,
'magic_constant_casing' => true,
'magic_method_casing' => true,
'mb_str_functions' => false,
'method_argument_space' => [
'after_heredoc' => false,
'keep_multiple_spaces_after_comma' => false,
'on_multiline' => 'ensure_fully_multiline',
],
'method_chaining_indentation' => true,
'modernize_strpos' => false, // requires 8.0+
'modernize_types_casting' => true,
'multiline_comment_opening_closing' => true,
'multiline_whitespace_before_semicolons' => ['strategy' => 'no_multi_line'],
'native_constant_invocation' => false,
'native_function_casing' => true,
'native_function_invocation' => false,
'native_function_type_declaration_casing' => true,
'new_with_braces' => true,
'no_alias_functions' => ['sets' => ['@all']],
'no_alias_language_construct_call' => true,
'no_alternative_syntax' => ['fix_non_monolithic_code' => false],
'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,
'no_empty_phpdoc' => true,
'no_empty_statement' => true,
'no_extra_blank_lines' => ['tokens' => ['extra']],
'no_homoglyph_names' => true,
'no_leading_import_slash' => true,
'no_leading_namespace_whitespace' => true,
'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,
'no_spaces_after_function_name' => true,
'no_spaces_around_offset' => ['positions' => ['inside', 'outside']],
'no_spaces_inside_parenthesis' => true,
'no_superfluous_elseif' => true,
'no_superfluous_phpdoc_tags' => [
'allow_mixed' => true,
'allow_unused_params' => true,
'remove_inheritdoc' => false,
],
'no_trailing_comma_in_list_call' => true,
'no_trailing_comma_in_singleline_array' => true,
'no_trailing_whitespace' => true,
'no_trailing_whitespace_in_comment' => true,
'no_trailing_whitespace_in_string' => true,
'no_unneeded_control_parentheses' => [
'statements' => [
'break',
'clone',
'continue',
'echo_print',
'return',
'switch_case',
'yield',
],
],
'no_unneeded_curly_braces' => ['namespaces' => true],
'no_unneeded_final_method' => ['private_methods' => true],
'no_unneeded_import_alias' => true,
'no_unreachable_default_argument_value' => true,
'no_unset_cast' => true,
'no_unset_on_property' => false,
'no_unused_imports' => true,
'no_useless_else' => true,
'no_useless_return' => true,
'no_useless_sprintf' => true,
'no_whitespace_before_comma_in_array' => ['after_heredoc' => true],
'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_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',
],
'sort_algorithm' => 'none',
],
'ordered_imports' => [
'sort_algorithm' => 'alpha',
'imports_order' => ['class', 'function', 'const'],
],
'ordered_interfaces' => false,
'ordered_traits' => false,
'php_unit_construct' => [
'assertions' => [
'assertSame',
'assertEquals',
'assertNotEquals',
'assertNotSame',
],
],
'php_unit_dedicate_assert' => ['target' => 'newest'],
'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_method_casing' => ['case' => 'camel_case'],
'php_unit_mock' => ['target' => 'newest'],
'php_unit_mock_short_will_return' => true,
'php_unit_namespaced' => ['target' => 'newest'],
'php_unit_no_expectation_annotation' => [
'target' => 'newest',
'use_class_const' => true,
],
'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',
'methods' => [],
],
'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',
],
],
'phpdoc_annotation_without_dot' => false,
'phpdoc_indent' => true,
'phpdoc_inline_tag_normalizer' => [
'tags' => [
'example',
'id',
'internal',
'inheritdoc',
'inheritdocs',
'link',
'source',
'toc',
'tutorial',
],
],
'phpdoc_line_span' => [
'const' => 'multi',
'method' => 'multi',
'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_useless_inheritdoc' => true,
'phpdoc_order' => true,
'phpdoc_order_by_value' => [
'annotations' => [
'author',
'covers',
'coversNothing',
'dataProvider',
'depends',
'group',
'internal',
'method',
'property',
'property-read',
'property-write',
'requires',
'throws',
'uses',
],
],
'phpdoc_return_self_reference' => [
'replacements' => [
'this' => '$this',
'@this' => '$this',
'$self' => 'self',
'@self' => 'self',
'$static' => 'static',
'@static' => 'static',
],
],
'phpdoc_scalar' => [
'types' => [
'boolean',
'callback',
'double',
'integer',
'real',
'str',
],
],
'phpdoc_separation' => true,
'phpdoc_single_line_var_spacing' => true,
'phpdoc_summary' => false,
'phpdoc_tag_casing' => ['tags' => ['inheritDoc']],
'phpdoc_tag_type' => ['tags' => ['inheritDoc' => 'inline']],
'phpdoc_to_comment' => false,
'phpdoc_to_param_type' => false,
'phpdoc_to_property_type' => false,
'phpdoc_to_return_type' => false,
'phpdoc_trim' => true,
'phpdoc_trim_consecutive_blank_line_separation' => true,
'phpdoc_types' => ['groups' => ['simple', 'alias', 'meta']],
'phpdoc_types_order' => [
'null_adjustment' => 'always_last',
'sort_algorithm' => 'alpha',
],
'phpdoc_var_annotation_correct_order' => true,
'phpdoc_var_without_name' => true,
'pow_to_exponentiation' => true,
'protected_to_private' => true,
'psr_autoloading' => ['dir' => null],
'random_api_migration' => [
'replacements' => [
'getrandmax' => 'mt_getrandmax',
'rand' => 'mt_rand',
'srand' => 'mt_srand',
],
],
'regular_callable_call' => true,
'return_assignment' => true,
'return_type_declaration' => ['space_before' => 'none'],
'self_accessor' => false,
'self_static_accessor' => true,
'semicolon_after_instruction' => false,
'set_type_to_cast' => true,
'short_scalar_cast' => true,
'simple_to_complex_string_variable' => true,
'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' => [
'abstract',
'as',
'attribute',
'break',
'case',
'catch',
'class',
'clone',
'comment',
'const',
'const_import',
'continue',
'do',
'echo',
'else',
'elseif',
'extends',
'final',
'finally',
'for',
'foreach',
'function',
'function_import',
'global',
'goto',
'if',
'implements',
'include',
'include_once',
'instanceof',
'insteadof',
'interface',
'match',
'named_argument',
'new',
'open_tag_with_echo',
'php_doc',
'php_open',
'print',
'private',
'protected',
'public',
'require',
'require_once',
'return',
'static',
'throw',
'trait',
'try',
'use',
'use_lambda',
'use_trait',
'var',
'while',
'yield',
'yield_from',
],
],
'single_trait_insert_per_statement' => true,
'space_after_semicolon' => ['remove_in_empty_for_expressions' => true],
'standardize_increment' => true,
'standardize_not_equals' => true,
'static_lambda' => true,
'strict_comparison' => true,
'strict_param' => true,
'string_length_to_empty' => true,
'string_line_ending' => true,
'switch_case_semicolon_to_colon' => true,
'switch_case_space' => true,
'switch_continue_to_break' => true,
'ternary_operator_spaces' => true,
'ternary_to_elvis_operator' => true,
'ternary_to_null_coalescing' => true,
'trailing_comma_in_multiline' => [
'after_heredoc' => true,
'elements' => ['arrays'],
],
'trim_array_spaces' => true,
'types_spaces' => ['space' => 'none'],
'unary_operator_spaces' => true,
'use_arrow_functions' => true,
'visibility_required' => ['elements' => ['const', 'method', 'property']],
'void_return' => false, // changes method signature
'whitespace_after_comma_in_array' => true,
'yoda_style' => [
'equal' => false,
'identical' => null,
'less_and_greater' => false,
'always_move_variable' => false,
],
]);

View File

@ -19,15 +19,11 @@
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^9.5", "phpunit/phpunit": "^9.5",
"rector/rector": "^0.12.16",
"roave/security-advisories": "dev-master", "roave/security-advisories": "dev-master",
"symfony/debug": "^4.4.9",
"symfony/debug-bundle": "^6.0",
"symfony/dotenv": "^6.0.3", "symfony/dotenv": "^6.0.3",
"symfony/flex": "^2.1.6", "symfony/flex": "^2.1.6",
"symfony/stopwatch": "^6.0.3", "symfony/stopwatch": "^6.0.3",
"symfony/web-profiler-bundle": "^6.0", "symfony/web-profiler-bundle": "^6.0"
"symplify/easy-coding-standard": "^10.0"
}, },
"config": { "config": {
"preferred-install": { "preferred-install": {

728
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -1,4 +0,0 @@
debug:
# Forwards VarDumper Data clones to a centralized server allowing to inspect dumps on CLI or in your browser.
# See the "server:dump" command to start a new server.
dump_destination: "tcp://%env(VAR_DUMPER_SERVER)%"

View File

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

19
justfile Normal file
View File

@ -0,0 +1,19 @@
# Lists the available actions
default:
@just --list
# Runs rector, showing what changes will be make
rector-dry-run:
tools/vendor/bin/rector process --config=tools/rector.php --dry-run src
# Runs rector, and updates the files
rector:
tools/vendor/bin/rector process --config=tools/rector.php src
# Check code formatting
check-fmt:
tools/vendor/bin/php-cs-fixer fix --dry-run --verbose
# Fix code formatting
fmt:
tools/vendor/bin/php-cs-fixer fix --verbose

View File

@ -1,30 +1,32 @@
<?php declare(strict_types=1); <?php
declare(strict_types=1);
use App\Kernel; use App\Kernel;
use Symfony\Component\Dotenv\Dotenv; use Symfony\Component\Dotenv\Dotenv;
use Symfony\Component\ErrorHandler\Debug; use Symfony\Component\ErrorHandler\Debug;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
require dirname(__DIR__).'/vendor/autoload.php'; require dirname(__DIR__) . '/vendor/autoload.php';
(new Dotenv())->bootEnv(dirname(__DIR__).'/.env'); (new Dotenv())->bootEnv(dirname(__DIR__) . '/.env');
if ($_SERVER['APP_DEBUG']) { if ($_SERVER['APP_DEBUG']) {
umask(0000); umask(0000);
Debug::enable(); Debug::enable();
} }
if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? false) { if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? FALSE) {
Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST); Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST);
} }
if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? false) { if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? FALSE) {
Request::setTrustedHosts([$trustedHosts]); Request::setTrustedHosts([$trustedHosts]);
} }
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']); $kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
$request = Request::createFromGlobals(); $request = Request::createFromGlobals();
$response = $kernel->handle($request); $response = $kernel->handle($request);
$response->send(); $response->send();
$kernel->terminate($request, $response); $kernel->terminate($request, $response);

View File

@ -1,66 +0,0 @@
<?php
declare(strict_types=1);
use Rector\Core\Configuration\Option;
use Rector\Doctrine\Set\DoctrineSetList;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Symfony\Set\SymfonyLevelSetList;
use Rector\Symfony\Set\SymfonySetList;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$parameters = $containerConfigurator->parameters();
$parameters->set(Option::AUTO_IMPORT_NAMES, TRUE);
$parameters->set(Option::IMPORT_SHORT_CLASSES, TRUE);
$parameters->set(Option::SKIP, [
Rector\Php81\Rector\Property\ReadOnlyPropertyRector::class,
]);
$containerConfigurator->import(DoctrineSetList::ANNOTATIONS_TO_ATTRIBUTES);
$containerConfigurator->import(SymfonySetList::ANNOTATIONS_TO_ATTRIBUTES);
$containerConfigurator->import(LevelSetList::UP_TO_PHP_81);
$containerConfigurator->import(SymfonyLevelSetList::UP_TO_SYMFONY_60);
// get services (needed for register a single rule)
$services = $containerConfigurator->services();
foreach ([
Rector\CodeQuality\Rector\BooleanNot\SimplifyDeMorganBinaryRector::class,
Rector\CodeQuality\Rector\Class_\CompleteDynamicPropertiesRector::class,
Rector\CodeQuality\Rector\For_\ForRepeatedCountToOwnVariableRector::class,
Rector\CodeQuality\Rector\For_\ForToForeachRector::class,
Rector\CodeQuality\Rector\If_\ConsecutiveNullCompareReturnsToNullCoalesceQueueRector::class,
Rector\CodeQuality\Rector\If_\SimplifyIfElseToTernaryRector::class,
Rector\CodeQuality\Rector\If_\SimplifyIfReturnBoolRector::class,
Rector\CodeQuality\Rector\Ternary\SimplifyDuplicatedTernaryRector::class,
Rector\CodeQuality\Rector\Ternary\SimplifyTautologyTernaryRector::class,
Rector\CodeQuality\Rector\Ternary\SwitchNegatedTernaryRector::class,
Rector\CodingStyle\Rector\Class_\AddArrayDefaultToArrayPropertyRector::class,
Rector\CodingStyle\Rector\ClassConst\RemoveFinalFromConstRector::class,
Rector\CodingStyle\Rector\ClassMethod\NewlineBeforeNewAssignSetRector::class,
Rector\CodingStyle\Rector\Encapsed\WrapEncapsedVariableInCurlyBracesRector::class,
Rector\CodingStyle\Rector\FuncCall\CallUserFuncArrayToVariadicRector::class,
Rector\CodingStyle\Rector\FuncCall\CallUserFuncToMethodCallRector::class,
Rector\CodingStyle\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector::class,
Rector\CodingStyle\Rector\Stmt\NewlineAfterStatementRector::class,
Rector\DeadCode\Rector\ClassMethod\RemoveUselessParamTagRector::class,
Rector\DeadCode\Rector\ClassMethod\RemoveUselessReturnTagRector::class,
Rector\DeadCode\Rector\Foreach_\RemoveUnusedForeachKeyRector::class,
Rector\DeadCode\Rector\Property\RemoveUselessVarTagRector::class,
Rector\DeadCode\Rector\Switch_\RemoveDuplicatedCaseInSwitchRector::class,
Rector\EarlyReturn\Rector\Foreach_\ChangeNestedForeachIfsToEarlyContinueRector::class,
Rector\EarlyReturn\Rector\If_\ChangeIfElseValueAssignToEarlyReturnRector::class,
Rector\EarlyReturn\Rector\If_\RemoveAlwaysElseRector::class,
Rector\Restoration\Rector\Property\MakeTypedPropertyNullableIfCheckedRector::class,
Rector\TypeDeclaration\Rector\ClassMethod\AddArrayParamDocTypeRector::class,
Rector\TypeDeclaration\Rector\ClassMethod\AddArrayReturnDocTypeRector::class,
Rector\TypeDeclaration\Rector\ClassMethod\AddMethodCallBasedStrictParamTypeRector::class,
Rector\TypeDeclaration\Rector\ClassMethod\ParamTypeByMethodCallTypeRector::class,
Rector\TypeDeclaration\Rector\ClassMethod\ParamTypeByParentCallTypeRector::class,
Rector\TypeDeclaration\Rector\Closure\AddClosureReturnTypeRector::class,
Rector\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector::class,
] as $rule) {
$services->set($rule);
}
};

View File

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

View File

@ -7,76 +7,73 @@ use App\Form\CameraTypeType;
use Doctrine\Persistence\ManagerRegistry; use Doctrine\Persistence\ManagerRegistry;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\{RedirectResponse, Request, Response};
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\Request;
#[Route(path: 'camera-type')] #[Route(path: 'camera-type')]
class CameraTypeController extends AbstractController class CameraTypeController extends AbstractController
{ {
use FormControllerTrait; use FormControllerTrait;
protected const ENTITY = CameraType::class; protected const ENTITY = CameraType::class;
protected const FORM = CameraTypeType::class;
protected const FORM = CameraTypeType::class; public function __construct(private readonly ManagerRegistry $managerRegistry)
{
}
public function __construct(private readonly ManagerRegistry $managerRegistry) /**
{ * Lists all cameraType entities.
} */
#[Route(path: '/', name: 'camera-type_index', methods: ['GET'])]
public function indexAction(): Response
{
return $this->itemListView('cameratype/index.html.twig', 'cameraTypes', [
'type' => 'ASC',
]);
}
/** /**
* Lists all cameraType entities. * Creates a new cameraType entity.
*/ */
#[Route(path: '/', name: 'camera-type_index', methods: ['GET'])] #[Route(path: '/new', name: 'camera-type_new', methods: ['GET', 'POST'])]
public function indexAction(): Response public function newAction(Request $request): Response
{ {
return $this->itemListView('cameratype/index.html.twig', 'cameraTypes', [ return $this->itemCreate($request, 'cameratype/new.html.twig', 'cameraType', 'camera-type_show');
'type' => 'ASC', }
]);
}
/** /**
* Creates a new cameraType entity. * Finds and displays a cameraType entity.
*/ */
#[Route(path: '/new', name: 'camera-type_new', methods: ['GET', 'POST'])] #[Route(path: '/{id}', name: 'camera-type_show', methods: ['GET'])]
public function newAction(Request $request): Response public function showAction(CameraType $cameraType): Response
{ {
return $this->itemCreate($request, 'cameratype/new.html.twig', 'cameraType', 'camera-type_show'); return $this->itemView($cameraType, 'cameratype/show.html.twig', 'cameraType');
} }
/** /**
* Finds and displays a cameraType entity. * Displays a form to edit an existing cameraType entity.
*/ */
#[Route(path: '/{id}', name: 'camera-type_show', methods: ['GET'])] #[Route(path: '/{id}/edit', name: 'camera-type_edit', methods: ['GET', 'POST'])]
public function showAction(CameraType $cameraType): Response public function editAction(Request $request, CameraType $cameraType): RedirectResponse|Response
{ {
return $this->itemView($cameraType, 'cameratype/show.html.twig', 'cameraType'); return $this->itemUpdate($request, $cameraType, 'cameratype/edit.html.twig', 'cameraType', 'camera-type_show');
} }
/** /**
* Displays a form to edit an existing cameraType entity. * Deletes a cameraType entity.
*/ */
#[Route(path: '/{id}/edit', name: 'camera-type_edit', methods: ['GET', 'POST'])] #[Route(path: '/{id}', name: 'camera-type_delete', methods: ['DELETE'])]
public function editAction(Request $request, CameraType $cameraType): RedirectResponse|Response public function deleteAction(Request $request, CameraType $cameraType): RedirectResponse
{ {
return $this->itemUpdate($request, $cameraType, 'cameratype/edit.html.twig', 'cameraType', 'camera-type_show'); return $this->itemDelete($request, $cameraType, 'camera-type_index');
} }
/** /**
* Deletes a cameraType entity. * Creates a form to delete a cameraType entity.
*/ */
#[Route(path: '/{id}', name: 'camera-type_delete', methods: ['DELETE'])] private function createDeleteForm(CameraType $cameraType): FormInterface
public function deleteAction(Request $request, CameraType $cameraType): RedirectResponse {
{ return $this->buildForm($cameraType, 'camera-type_delete', 'DELETE');
return $this->itemDelete($request, $cameraType, 'camera-type_index'); }
}
/**
* Creates a form to delete a cameraType entity.
*/
private function createDeleteForm(CameraType $cameraType): FormInterface
{
return $this->buildForm($cameraType, 'camera-type_delete', 'DELETE');
}
} }

View File

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

View File

@ -2,16 +2,15 @@
namespace App\Controller; namespace App\Controller;
use Doctrine\Persistence\ManagerRegistry;
use LogicException;
use App\Entity\Film; use App\Entity\Film;
use App\Form\FilmType; use App\Form\FilmType;
use Doctrine\Common\Collections\Criteria; use Doctrine\Common\Collections\Criteria;
use Doctrine\Persistence\ManagerRegistry;
use LogicException;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\{RedirectResponse, Request, Response};
use Symfony\Component\Routing\Annotation\Route;
/** /**
* Film controller. * Film controller.
@ -19,93 +18,94 @@ use Symfony\Component\HttpFoundation\Request;
#[Route(path: 'film')] #[Route(path: 'film')]
class FilmController extends AbstractController class FilmController extends AbstractController
{ {
use FormControllerTrait; use FormControllerTrait;
protected const ENTITY = Film::class;
protected const FORM = FilmType::class; protected const ENTITY = Film::class;
protected const FORM = FilmType::class;
public function __construct(private readonly ManagerRegistry $managerRegistry) public function __construct(private readonly ManagerRegistry $managerRegistry)
{ {
} }
/** /**
* Lists all film entities. * Lists all film entities.
*/ */
#[Route(path: '/', name: 'film_index', methods: ['GET'])] #[Route(path: '/', name: 'film_index', methods: ['GET'])]
public function indexAction() : Response public function indexAction(): Response
{ {
$repo = $this->managerRegistry->getManager()->getRepository(self::ENTITY); $repo = $this->managerRegistry->getManager()->getRepository(self::ENTITY);
$criteria = Criteria::create() $criteria = Criteria::create()
->where(Criteria::expr()->gt('rollsInCamera', 0)) ->where(Criteria::expr()->gt('rollsInCamera', 0))
->orderBy([ ->orderBy([
'filmFormat' => Criteria::ASC, 'filmFormat' => Criteria::ASC,
'brand' => Criteria::ASC, 'brand' => Criteria::ASC,
'rollsInCamera' => Criteria::DESC, 'rollsInCamera' => Criteria::DESC,
'productLine' => Criteria::ASC, 'productLine' => Criteria::ASC,
]); ]);
$inCamera = $repo->matching($criteria); $inCamera = $repo->matching($criteria);
$notInCamera = $repo->findBy([ $notInCamera = $repo->findBy([
'rollsInCamera' => 0, 'rollsInCamera' => 0,
], [ ], [
'brand' => 'ASC', 'brand' => 'ASC',
'productLine' => 'ASC', 'productLine' => 'ASC',
'filmFormat' => 'ASC', 'filmFormat' => 'ASC',
]); ]);
return $this->render('film/index.html.twig', [
'in_camera' => $inCamera,
'films' => $notInCamera,
]);
}
/** return $this->render('film/index.html.twig', [
* Creates a new film entity. 'in_camera' => $inCamera,
*/ 'films' => $notInCamera,
#[Route(path: '/new', name: 'film_new', methods: ['GET', 'POST'])] ]);
public function newAction(Request $request) }
{
return $this->itemCreate($request, 'film/new.html.twig', 'film', 'film_show');
}
/** /**
* Finds and displays a film entity. * Creates a new film entity.
*/ */
#[Route(path: '/{id}', name: 'film_show', methods: ['GET'])] #[Route(path: '/new', name: 'film_new', methods: ['GET', 'POST'])]
public function showAction(Film $film) public function newAction(Request $request): RedirectResponse|Response
{ {
return $this->itemView($film, 'film/show.html.twig', 'film'); return $this->itemCreate($request, 'film/new.html.twig', 'film', 'film_show');
} }
/** /**
* Displays a form to edit an existing film entity. * Finds and displays a film entity.
* */
* @throws LogicException #[Route(path: '/{id}', name: 'film_show', methods: ['GET'])]
*/ public function showAction(Film $film): Response
#[Route(path: '/{id}/edit', name: 'film_edit', methods: ['GET', 'POST'])] {
public function editAction(Request $request, Film $film) return $this->itemView($film, 'film/show.html.twig', 'film');
{ }
return $this->itemUpdate($request, $film, 'film/edit.html.twig', 'film', 'film_show');
}
/** /**
* Deletes a film entity. * Displays a form to edit an existing film entity.
* *
* @throws LogicException * @throws LogicException
*/ */
#[Route(path: '/{id}', name: 'film_delete', methods: ['DELETE'])] #[Route(path: '/{id}/edit', name: 'film_edit', methods: ['GET', 'POST'])]
public function deleteAction(Request $request, Film $film) public function editAction(Request $request, Film $film): RedirectResponse|Response
{ {
return $this->itemDelete($request, $film, 'film_index'); return $this->itemUpdate($request, $film, 'film/edit.html.twig', 'film', 'film_show');
} }
/** /**
* Creates a form to delete a film entity. * Deletes a film entity.
* *
* @param Film $film The film entity * @throws LogicException
* */
* @return FormInterface The form #[Route(path: '/{id}', name: 'film_delete', methods: ['DELETE'])]
*/ public function deleteAction(Request $request, Film $film): RedirectResponse
private function createDeleteForm(Film $film): FormInterface {
{ return $this->itemDelete($request, $film, 'film_index');
return $this->buildForm($film, 'film_delete', 'DELETE'); }
}
/**
* Creates a form to delete a film entity.
*
* @param Film $film The film entity
*
* @return FormInterface The form
*/
private function createDeleteForm(Film $film): FormInterface
{
return $this->buildForm($film, 'film_delete', 'DELETE');
}
} }

View File

@ -2,15 +2,13 @@
namespace App\Controller; namespace App\Controller;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Component\Form\FormInterface;
use App\Entity\Flash; use App\Entity\Flash;
use App\Form\FlashType; use App\Form\FlashType;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\{RedirectResponse, Request, Response};
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\Request;
/** /**
* Flash controller. * Flash controller.
@ -18,66 +16,65 @@ use Symfony\Component\HttpFoundation\Request;
#[Route(path: 'flash')] #[Route(path: 'flash')]
class FlashController extends AbstractController class FlashController extends AbstractController
{ {
use FormControllerTrait; use FormControllerTrait;
protected const ENTITY = Flash::class; protected const ENTITY = Flash::class;
protected const FORM = FlashType::class;
protected const FORM = FlashType::class; public function __construct(private readonly ManagerRegistry $managerRegistry)
{
}
public function __construct(private readonly ManagerRegistry $managerRegistry) /**
{ * Lists all flash entities.
} */
#[Route(path: '/', name: 'flash_index', methods: ['GET'])]
public function indexAction(): Response
{
return $this->itemListView('flash/index.html.twig', 'flashes');
}
/** /**
* Lists all flash entities. * Creates a new flash entity.
*/ */
#[Route(path: '/', name: 'flash_index', methods: ['GET'])] #[Route(path: '/new', name: 'flash_new', methods: ['GET', 'POST'])]
public function indexAction(): Response public function newAction(Request $request): RedirectResponse|Response
{ {
return $this->itemListView('flash/index.html.twig', 'flashes'); return $this->itemCreate($request, 'flash/new.html.twig', 'flash', 'flash_show');
} }
/** /**
* Creates a new flash entity. * Finds and displays a flash entity.
*/ */
#[Route(path: '/new', name: 'flash_new', methods: ['GET', 'POST'])] #[Route(path: '/{id}', name: 'flash_show', methods: ['GET'])]
public function newAction(Request $request): RedirectResponse|Response public function showAction(Flash $flash): Response
{ {
return $this->itemCreate($request, 'flash/new.html.twig', 'flash', 'flash_show'); return $this->itemView($flash, 'flash/show.html.twig', 'flash');
} }
/** /**
* Finds and displays a flash entity. * Displays a form to edit an existing flash entity.
*/ */
#[Route(path: '/{id}', name: 'flash_show', methods: ['GET'])] #[Route(path: '/{id}/edit', name: 'flash_edit', methods: ['GET', 'POST'])]
public function showAction(Flash $flash): Response public function editAction(Request $request, Flash $flash): RedirectResponse|Response
{ {
return $this->itemView($flash, 'flash/show.html.twig', 'flash'); return $this->itemUpdate($request, $flash, 'flash/edit.html.twig', 'flash', 'flash_show');
} }
/** /**
* Displays a form to edit an existing flash entity. * Deletes a flash entity.
*/ */
#[Route(path: '/{id}/edit', name: 'flash_edit', methods: ['GET', 'POST'])] #[Route(path: '/{id}', name: 'flash_delete', methods: ['DELETE'])]
public function editAction(Request $request, Flash $flash): RedirectResponse|Response public function deleteAction(Request $request, Flash $flash): RedirectResponse
{ {
return $this->itemUpdate($request, $flash, 'flash/edit.html.twig', 'flash', 'flash_show'); return $this->itemDelete($request, $flash, 'flash_index');
} }
/** /**
* Deletes a flash entity. * Creates a form to delete a flash entity.
*/ */
#[Route(path: '/{id}', name: 'flash_delete', methods: ['DELETE'])] private function createDeleteForm(Flash $flash): FormInterface
public function deleteAction(Request $request, Flash $flash): RedirectResponse {
{ return $this->buildForm($flash, 'flash_delete', 'DELETE');
return $this->itemDelete($request, $flash, 'flash_index'); }
}
/**
* Creates a form to delete a flash entity.
*/
private function createDeleteForm(Flash $flash): FormInterface
{
return $this->buildForm($flash, 'flash_delete', 'DELETE');
}
} }

View File

@ -4,168 +4,175 @@ namespace App\Controller;
use Doctrine\Persistence\ManagerRegistry; use Doctrine\Persistence\ManagerRegistry;
use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\{Request, Response, RedirectResponse}; use Symfony\Component\HttpFoundation\{RedirectResponse, Request, Response};
trait FormControllerTrait { trait FormControllerTrait
private readonly ManagerRegistry $managerRegistry; {
private readonly ManagerRegistry $managerRegistry;
/** /**
* Create a form generator * Create a form generator
*/ *
protected function buildForm($item, string $actionRoute, string $method = 'POST'): FormInterface * @param mixed $item
{ */
return $this->createFormBuilder() protected function buildForm($item, string $actionRoute, string $method = 'POST'): FormInterface
->setAction($this->generateUrl($actionRoute, ['id' => $item->getId()])) {
->setMethod($method) return $this->createFormBuilder()
->getForm(); ->setAction($this->generateUrl($actionRoute, ['id' => $item->getId()]))
} ->setMethod($method)
->getForm();
}
/** /**
* Show create form / create an item * Show create form / create an item
*/ */
protected function itemCreate(Request $request, string $template, string $templateKey, string $redirectRoute) protected function itemCreate(Request $request, string $template, string $templateKey, string $redirectRoute)
{ {
$Entity = self::ENTITY; $Entity = self::ENTITY;
$item = new $Entity; $item = new $Entity();
$form = $this->createForm(self::FORM, $item); $form = $this->createForm(self::FORM, $item);
$form->handleRequest($request); $form->handleRequest($request);
// If creating the item // If creating the item
if ($form->isSubmitted() && $form->isValid()) if ($form->isSubmitted() && $form->isValid()) {
{ $em = $this->getDoctrine()->getManager();
$em = $this->getDoctrine()->getManager(); $em->persist($item);
$em->persist($item); $em->flush();
$em->flush();
return $this->redirectToRoute($redirectRoute, ['id' => $item->getId()]); return $this->redirectToRoute($redirectRoute, ['id' => $item->getId()]);
} }
// If showing the form // If showing the form
return $this->render($template, [ return $this->render($template, [
$templateKey => $item, $templateKey => $item,
'form' => $form->createView(), 'form' => $form->createView(),
]); ]);
} }
/** /**
* List view for the data type * List view for the data type
*/ */
protected function itemListView(string $template, string $templateKey, array $sort = []): Response protected function itemListView(string $template, string $templateKey, array $sort = []): Response
{ {
$em = $this->managerRegistry->getManager(); $em = $this->managerRegistry->getManager();
$items = $em->getRepository(self::ENTITY)->findBy([], $sort); $items = $em->getRepository(self::ENTITY)->findBy([], $sort);
return $this->render($template, [ return $this->render($template, [
$templateKey => $items, $templateKey => $items,
]); ]);
} }
/** /**
* View details for a specific item * View details for a specific item
*/ *
protected function itemView($item, string $template, string $templateKey): Response * @param mixed $item
{ */
$templateData = [ protected function itemView($item, string $template, string $templateKey): Response
$templateKey => $item, {
]; $templateData = [
$templateKey => $item,
];
if (method_exists($this, 'createDeleteForm')) { if (method_exists($this, 'createDeleteForm')) {
$deleteForm = $this->createDeleteForm($item); $deleteForm = $this->createDeleteForm($item);
$templateData['delete_form'] = $deleteForm->createView(); $templateData['delete_form'] = $deleteForm->createView();
} }
return $this->render($template, $templateData); return $this->render($template, $templateData);
} }
/** /**
* Show edit form / update an item * Show edit form / update an item
*/ *
protected function itemUpdate(Request $request, $item, string $template, string $templateKey, string $redirectRoute) * @param mixed $item
{ */
$editForm = $this->createForm(self::FORM, $item); protected function itemUpdate(Request $request, $item, string $template, string $templateKey, string $redirectRoute)
$editForm->handleRequest($request); {
$editForm = $this->createForm(self::FORM, $item);
$editForm->handleRequest($request);
// If updating the item // If updating the item
if ($editForm->isSubmitted() && $editForm->isValid()) if ($editForm->isSubmitted() && $editForm->isValid()) {
{ $em = $this->getDoctrine()->getManager();
$em = $this->getDoctrine()->getManager(); $em->persist($item);
$em->persist($item); $em->flush();
$em->flush();
return $this->redirectToRoute($redirectRoute, ['id' => $item->getId()]); return $this->redirectToRoute($redirectRoute, ['id' => $item->getId()]);
} }
// If showing the edit form // If showing the edit form
$templateData = [ $templateData = [
$templateKey => $item, $templateKey => $item,
'edit_form' => $editForm->createView(), 'edit_form' => $editForm->createView(),
]; ];
if (method_exists($this, 'createDeleteForm')) if (method_exists($this, 'createDeleteForm')) {
{ $deleteForm = $this->createDeleteForm($item);
$deleteForm = $this->createDeleteForm($item); $templateData['delete_form'] = $deleteForm->createView();
$templateData['delete_form'] = $deleteForm->createView(); }
}
if (method_exists($this, 'createDeacquireForm')) if (method_exists($this, 'createDeacquireForm')) {
{ $deacquireForm = $this->createDeacquireForm($item);
$deacquireForm = $this->createDeacquireForm($item); $templateData['deacquire_form'] = $deacquireForm->createView();
$templateData['deacquire_form'] = $deacquireForm->createView(); }
}
if (method_exists($this, 'createReacquireForm')) if (method_exists($this, 'createReacquireForm')) {
{ $reacquireForm = $this->createReacquireForm($item);
$reacquireForm = $this->createReacquireForm($item); $templateData['reacquire_form'] = $reacquireForm->createView();
$templateData['reacquire_form'] = $reacquireForm->createView(); }
}
return $this->render($template, $templateData); return $this->render($template, $templateData);
} }
/** /**
* Move an item to a previously_owned table * Move an item to a previously_owned table
*/ *
protected function itemDeacquire(Request $request, $item, string $redirectRoute): RedirectResponse * @param mixed $item
{ */
$form = $this->createDeacquireForm($item); protected function itemDeacquire(Request $request, $item, string $redirectRoute): RedirectResponse
$form->handleRequest($request); {
$form = $this->createDeacquireForm($item);
$form->handleRequest($request);
$repository = $this->getDoctrine()->getRepository(self::ENTITY); $repository = $this->getDoctrine()->getRepository(self::ENTITY);
$repository->deacquire($item); $repository->deacquire($item);
return $this->redirectToRoute($redirectRoute); return $this->redirectToRoute($redirectRoute);
} }
/** /**
* Move an item from a previously_owned table back to the original table * Move an item from a previously_owned table back to the original table
*/ *
protected function itemReacquire(Request $request, $item, string $redirectRoute): RedirectResponse * @param mixed $item
{ */
$form = $this->createReacquireForm($item); protected function itemReacquire(Request $request, $item, string $redirectRoute): RedirectResponse
$form->handleRequest($request); {
$form = $this->createReacquireForm($item);
$form->handleRequest($request);
$repository = $this->getDoctrine()->getRepository(self::ENTITY); $repository = $this->getDoctrine()->getRepository(self::ENTITY);
$repository->reacquire($item); $repository->reacquire($item);
return $this->redirectToRoute($redirectRoute); return $this->redirectToRoute($redirectRoute);
} }
/** /**
* Actually delete an item * Actually delete an item
*/ *
protected function itemDelete(Request $request, $item, string $redirectRoute): RedirectResponse * @param mixed $item
{ */
$form = $this->createDeleteForm($item); protected function itemDelete(Request $request, $item, string $redirectRoute): RedirectResponse
$form->handleRequest($request); {
$form = $this->createDeleteForm($item);
$form->handleRequest($request);
// if ($form->isSubmitted() && $form->isValid()) // if ($form->isSubmitted() && $form->isValid())
{
$em = $this->getDoctrine()->getManager();
$em->remove($item);
$em->flush();
}
return $this->redirectToRoute($redirectRoute); $em = $this->getDoctrine()->getManager();
} $em->remove($item);
$em->flush();
return $this->redirectToRoute($redirectRoute);
}
} }

View File

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

View File

@ -2,15 +2,16 @@
namespace App\Controller; namespace App\Controller;
use UnexpectedValueException;
use LogicException;
use Doctrine\ORM\ORMInvalidArgumentException;
use App\Entity\PreviouslyOwnedCamera; use App\Entity\PreviouslyOwnedCamera;
use App\Form\PreviouslyOwnedCameraType; use App\Form\PreviouslyOwnedCameraType;
use Doctrine\ORM\ORMInvalidArgumentException;
use Doctrine\Persistence\ManagerRegistry;
use LogicException;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\{RedirectResponse, Request}; use Symfony\Component\HttpFoundation\{RedirectResponse, Request, Response};
use Symfony\Component\Routing\Annotation\Route;
use UnexpectedValueException;
/** /**
* Previouslyownedcamera controller. * Previouslyownedcamera controller.
@ -18,67 +19,73 @@ use Symfony\Component\HttpFoundation\{RedirectResponse, Request};
#[Route(path: 'previously-owned-camera')] #[Route(path: 'previously-owned-camera')]
class PreviouslyOwnedCameraController extends AbstractController class PreviouslyOwnedCameraController extends AbstractController
{ {
use FormControllerTrait; use FormControllerTrait;
protected const ENTITY = PreviouslyOwnedCamera::class;
protected const FORM = PreviouslyOwnedCameraType::class; protected const ENTITY = PreviouslyOwnedCamera::class;
protected const FORM = PreviouslyOwnedCameraType::class;
/** public function __construct(private readonly ManagerRegistry $managerRegistry)
* Lists all previouslyOwnedCamera entities. {
* }
* @throws UnexpectedValueException
*/
#[Route(path: '/', name: 'previously-owned-camera_index', methods: ['GET'])]
public function indexAction()
{
return $this->itemListView('previouslyownedcamera/index.html.twig', 'previouslyOwnedCameras', [
'brand' => 'ASC',
'mount' => 'ASC',
'model' => 'ASC',
]);
}
/** /**
* Finds and displays a previouslyOwnedCamera entity. * Lists all previouslyOwnedCamera entities.
*/ *
#[Route(path: '/{id}', name: 'previously-owned-camera_show', methods: ['GET'])] * @throws UnexpectedValueException
public function showAction(PreviouslyOwnedCamera $previouslyOwnedCamera) */
{ #[Route(path: '/', name: 'previously-owned-camera_index', methods: ['GET'])]
return $this->itemView($previouslyOwnedCamera, 'previouslyownedcamera/show.html.twig', 'previouslyOwnedCamera'); public function indexAction(): Response
} {
return $this->itemListView('previouslyownedcamera/index.html.twig', 'previouslyOwnedCameras', [
'brand' => 'ASC',
'mount' => 'ASC',
'model' => 'ASC',
]);
}
/** /**
* Displays a form to edit an existing previouslyOwnedCamera entity. * Finds and displays a previouslyOwnedCamera entity.
* */
* @throws LogicException #[Route(path: '/{id}', name: 'previously-owned-camera_show', methods: ['GET'])]
*/ public function showAction(PreviouslyOwnedCamera $previouslyOwnedCamera): Response
#[Route(path: '/{id}/edit', name: 'previously-owned-camera_edit', methods: ['GET', 'POST'])] {
public function editAction(Request $request, PreviouslyOwnedCamera $previouslyOwnedCamera) return $this->itemView($previouslyOwnedCamera, 'previouslyownedcamera/show.html.twig', 'previouslyOwnedCamera');
{ }
return $this->itemUpdate($request, $previouslyOwnedCamera, 'previouslyownedcamera/edit.html.twig', 'previouslyOwnedCamera', 'previously-owned-camera_show');
}
/** /**
* Moves a camera to the previouslyOwned table * Displays a form to edit an existing previouslyOwnedCamera entity.
* *
* @param Request $request * @throws LogicException
* @throws LogicException */
* @throws ORMInvalidArgumentException #[Route(path: '/{id}/edit', name: 'previously-owned-camera_edit', methods: ['GET', 'POST'])]
* @return RedirectResponse public function editAction(Request $request, PreviouslyOwnedCamera $previouslyOwnedCamera): RedirectResponse|Response
*/ {
#[Route(path: '/{id}/reacquire', name: 'previously-owned-camera_reacquire', methods: ['POST'])] return $this->itemUpdate($request, $previouslyOwnedCamera, 'previouslyownedcamera/edit.html.twig', 'previouslyOwnedCamera', 'previously-owned-camera_show');
public function reacquireAction(Request $request, PreviouslyOwnedCamera $camera) : RedirectResponse }
{
return $this->itemReacquire($request, $camera, 'camera_index');
}
/** /**
* Creates a form to move * Moves a camera to the previouslyOwned table
* *
* @param PreviouslyOwnedCamera $camera The camera entity * @param Request $request
*/ *
private function createReacquireForm(PreviouslyOwnedCamera $camera): FormInterface * @throws LogicException
{ * @throws ORMInvalidArgumentException
return $this->buildForm($camera, 'previously-owned-camera_reacquire', 'POST'); *
} * @return RedirectResponse
*/
#[Route(path: '/{id}/reacquire', name: 'previously-owned-camera_reacquire', methods: ['POST'])]
public function reacquireAction(Request $request, PreviouslyOwnedCamera $camera): RedirectResponse
{
return $this->itemReacquire($request, $camera, 'camera_index');
}
/**
* Creates a form to move
*
* @param PreviouslyOwnedCamera $camera The camera entity
*/
private function createReacquireForm(PreviouslyOwnedCamera $camera): FormInterface
{
return $this->buildForm($camera, 'previously-owned-camera_reacquire', 'POST');
}
} }

View File

@ -6,10 +6,8 @@ use App\Entity\PreviouslyOwnedFlash;
use App\Form\PreviouslyOwnedFlashType; use App\Form\PreviouslyOwnedFlashType;
use Doctrine\Persistence\ManagerRegistry; use Doctrine\Persistence\ManagerRegistry;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\{RedirectResponse, Request, Response};
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\Request;
/** /**
* Previouslyownedflash controller. * Previouslyownedflash controller.
@ -17,49 +15,48 @@ use Symfony\Component\HttpFoundation\Request;
#[Route(path: 'previously-owned-flash')] #[Route(path: 'previously-owned-flash')]
class PreviouslyOwnedFlashController extends AbstractController class PreviouslyOwnedFlashController extends AbstractController
{ {
use FormControllerTrait; use FormControllerTrait;
protected const ENTITY = PreviouslyOwnedFlash::class; protected const ENTITY = PreviouslyOwnedFlash::class;
protected const FORM = PreviouslyOwnedFlashType::class;
protected const FORM = PreviouslyOwnedFlashType::class; public function __construct(private readonly ManagerRegistry $managerRegistry)
{
}
public function __construct(private readonly ManagerRegistry $managerRegistry) /**
{ * Lists all previouslyOwnedFlash entities.
} */
#[Route(path: '/', name: 'previously-owned-flash_index', methods: ['GET'])]
public function indexAction(): Response
{
return $this->itemListView('previouslyownedflash/index.html.twig', 'previouslyOwnedFlashes');
}
/** /**
* Lists all previouslyOwnedFlash entities. * Creates a new previouslyOwnedFlash entity.
*/ */
#[Route(path: '/', name: 'previously-owned-flash_index', methods: ['GET'])] #[Route(path: '/new', name: 'previously-owned-flash_new', methods: ['GET', 'POST'])]
public function indexAction(): Response public function newAction(Request $request): RedirectResponse|Response
{ {
return $this->itemListView('previouslyownedflash/index.html.twig', 'previouslyOwnedFlashes'); return $this->itemCreate($request, 'previouslyownedflash/new.html.twig', 'previouslyOwnedFlash', 'previously-owned-flash_show');
} }
/** /**
* Creates a new previouslyOwnedFlash entity. * Finds and displays a previouslyOwnedFlash entity.
*/ */
#[Route(path: '/new', name: 'previously-owned-flash_new', methods: ['GET', 'POST'])] #[Route(path: '/{id}', name: 'previously-owned-flash_show', methods: ['GET'])]
public function newAction(Request $request) public function showAction(PreviouslyOwnedFlash $previouslyOwnedFlash): Response
{ {
return $this->itemCreate($request, 'previouslyownedflash/new.html.twig', 'previouslyOwnedFlash', 'previously-owned-flash_show'); return $this->itemView($previouslyOwnedFlash, 'previouslyownedcamera/show.html.twig', 'previouslyOwnedFlash');
} }
/** /**
* Finds and displays a previouslyOwnedFlash entity. * Displays a form to edit an existing previouslyOwnedFlash entity.
*/ */
#[Route(path: '/{id}', name: 'previously-owned-flash_show', methods: ['GET'])] #[Route(path: '/{id}/edit', name: 'previously-owned-flash_edit', methods: ['GET', 'POST'])]
public function showAction(PreviouslyOwnedFlash $previouslyOwnedFlash): Response public function editAction(Request $request, PreviouslyOwnedFlash $previouslyOwnedFlash): RedirectResponse|Response
{ {
return $this->itemView($previouslyOwnedFlash, 'previouslyownedcamera/show.html.twig', 'previouslyOwnedFlash'); return $this->itemUpdate($request, $previouslyOwnedFlash, 'previouslyownedflash/edit.html.twig', 'previouslyOwnedFlash', 'previously-owned-flash_show');
} }
/**
* Displays a form to edit an existing previouslyOwnedFlash entity.
*/
#[Route(path: '/{id}/edit', name: 'previously-owned-flash_edit', methods: ['GET', 'POST'])]
public function editAction(Request $request, PreviouslyOwnedFlash $previouslyOwnedFlash): RedirectResponse|Response
{
return $this->itemUpdate($request, $previouslyOwnedFlash, 'previouslyownedflash/edit.html.twig', 'previouslyOwnedFlash', 'previously-owned-flash_show');
}
} }

View File

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

View File

@ -11,8 +11,8 @@ use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity] #[ORM\Entity]
class BatteryType class BatteryType
{ {
#[ORM\Column(name: 'id', type: 'integer', nullable: false)] #[ORM\Column(name: 'id', type: 'integer', nullable: FALSE)]
#[ORM\Id] #[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')] #[ORM\GeneratedValue(strategy: 'IDENTITY')]
private int $id; private int $id;
} }

View File

@ -13,10 +13,11 @@ use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: CameraRepository::class)] #[ORM\Entity(repositoryClass: CameraRepository::class)]
class Camera class Camera
{ {
use CameraTrait; use CameraTrait;
#[ORM\Column(name: 'id', type: 'integer', nullable: false)]
#[ORM\Id] #[ORM\Column(name: 'id', type: 'integer', nullable: FALSE)]
#[ORM\GeneratedValue(strategy: 'IDENTITY')] #[ORM\Id]
#[ORM\SequenceGenerator(sequenceName: 'camera__id_seq', allocationSize: 1, initialValue: 1)] #[ORM\GeneratedValue(strategy: 'IDENTITY')]
private int $id; #[ORM\SequenceGenerator(sequenceName: 'camera__id_seq', allocationSize: 1, initialValue: 1)]
private int $id;
} }

View File

@ -8,211 +8,209 @@ use Doctrine\ORM\Mapping as ORM;
* Trait CameraTrait * Trait CameraTrait
* *
* Shared columns for camera, and previously_owned_camera tables * Shared columns for camera, and previously_owned_camera tables
*
* @package App\Entity
*/ */
trait CameraTrait trait CameraTrait
{ {
use PurchasePriceTrait; use PurchasePriceTrait;
#[ORM\ManyToOne(targetEntity: 'CameraType')] #[ORM\ManyToOne(targetEntity: 'CameraType')]
#[ORM\JoinColumn(name: 'type_id', referencedColumnName: 'id', nullable: false)] #[ORM\JoinColumn(name: 'type_id', referencedColumnName: 'id', nullable: FALSE)]
private readonly CameraType $type; private readonly CameraType $type;
#[ORM\Column(name: 'brand', type: 'string', length: 64, nullable: false)] #[ORM\Column(name: 'brand', type: 'string', length: 64, nullable: FALSE)]
private readonly string $brand; private readonly string $brand;
#[ORM\Column(name: 'mount', type: 'string', length: 32, nullable: false)] #[ORM\Column(name: 'mount', type: 'string', length: 32, nullable: FALSE)]
private readonly string $mount; private readonly string $mount;
#[ORM\Column(name: 'model', type: 'string', length: 255, nullable: false)] #[ORM\Column(name: 'model', type: 'string', length: 255, nullable: FALSE)]
private readonly string $model; private readonly string $model;
#[ORM\Column(name: 'is_digital', type: 'boolean', nullable: false)] #[ORM\Column(name: 'is_digital', type: 'boolean', nullable: FALSE)]
private readonly bool $isDigital; private readonly bool $isDigital;
#[ORM\Column(name: 'crop_factor', type: 'decimal', precision: 10, scale: 0, nullable: false)] #[ORM\Column(name: 'crop_factor', type: 'decimal', precision: 10, scale: 0, nullable: FALSE)]
private string $cropFactor = '1.0'; private string $cropFactor = '1.0';
#[ORM\Column(name: 'is_working', type: 'boolean', nullable: false)] #[ORM\Column(name: 'is_working', type: 'boolean', nullable: FALSE)]
private readonly bool $isWorking; private readonly bool $isWorking;
#[ORM\Column(name: 'notes', type: 'text', nullable: true)] #[ORM\Column(name: 'notes', type: 'text', nullable: TRUE)]
private readonly ?string $notes; private readonly ?string $notes;
#[ORM\Column(name: 'serial', type: 'string', length: 20, nullable: false)] #[ORM\Column(name: 'serial', type: 'string', length: 20, nullable: FALSE)]
private readonly string $serial; private readonly string $serial;
#[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: false)] #[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: FALSE)]
private bool $formerlyOwned = FALSE; private bool $formerlyOwned = FALSE;
#[ORM\Column(name: 'battery_type', type: 'string', nullable: true)] #[ORM\Column(name: 'battery_type', type: 'string', nullable: TRUE)]
private readonly ?string $batteryType; private readonly ?string $batteryType;
#[ORM\Column(name: 'film_format', type: 'string', nullable: true)] #[ORM\Column(name: 'film_format', type: 'string', nullable: TRUE)]
private ?string $filmFormat = '135'; private ?string $filmFormat = '135';
#[ORM\Column(name: 'received', type: 'boolean', nullable: true)] #[ORM\Column(name: 'received', type: 'boolean', nullable: TRUE)]
private ?bool $received = FALSE; private ?bool $received = FALSE;
public function getId(): int public function getId(): int
{ {
return $this->id; return $this->id;
} }
public function setType(CameraType $type = null): self public function setType(?CameraType $type = NULL): self
{ {
$this->type = $type; $this->type = $type;
return $this; return $this;
} }
public function getType(): CameraType public function getType(): CameraType
{ {
return $this->type; return $this->type;
} }
public function setBrand(string $brand): self public function setBrand(string $brand): self
{ {
$this->brand = $brand; $this->brand = $brand;
return $this; return $this;
} }
public function getBrand(): string public function getBrand(): string
{ {
return $this->brand; return $this->brand;
} }
public function setMount(string $mount): self public function setMount(string $mount): self
{ {
$this->mount = $mount; $this->mount = $mount;
return $this; return $this;
} }
public function getMount(): string public function getMount(): string
{ {
return $this->mount; return $this->mount;
} }
public function setModel(string $model): self public function setModel(string $model): self
{ {
$this->model = $model; $this->model = $model;
return $this; return $this;
} }
public function getModel(): string public function getModel(): string
{ {
return $this->model; return $this->model;
} }
public function setIsDigital(bool $isDigital): self public function setIsDigital(bool $isDigital): self
{ {
$this->isDigital = $isDigital; $this->isDigital = $isDigital;
return $this; return $this;
} }
public function getIsDigital(): bool public function getIsDigital(): bool
{ {
return $this->isDigital; return $this->isDigital;
} }
public function setCropFactor(string $cropFactor): self public function setCropFactor(string $cropFactor): self
{ {
$this->cropFactor = $cropFactor; $this->cropFactor = $cropFactor;
return $this; return $this;
} }
public function getCropFactor(): string public function getCropFactor(): string
{ {
return $this->cropFactor; return $this->cropFactor;
} }
public function setIsWorking(bool $isWorking): self public function setIsWorking(bool $isWorking): self
{ {
$this->isWorking = $isWorking; $this->isWorking = $isWorking;
return $this; return $this;
} }
public function getIsWorking(): bool public function getIsWorking(): bool
{ {
return $this->isWorking; return $this->isWorking;
} }
public function setNotes(string $notes): self public function setNotes(string $notes): self
{ {
$this->notes = $notes; $this->notes = $notes;
return $this; return $this;
} }
public function getNotes(): string public function getNotes(): string
{ {
return $this->notes ?? ''; return $this->notes ?? '';
} }
public function setSerial(string $serial): self public function setSerial(string $serial): self
{ {
$this->serial = $serial; $this->serial = $serial;
return $this; return $this;
} }
public function getSerial(): string public function getSerial(): string
{ {
return $this->serial ?? ''; return $this->serial ?? '';
} }
public function setFormerlyOwned(bool $formerlyOwned): self public function setFormerlyOwned(bool $formerlyOwned): self
{ {
$this->formerlyOwned = $formerlyOwned; $this->formerlyOwned = $formerlyOwned;
return $this; return $this;
} }
public function getFormerlyOwned(): bool public function getFormerlyOwned(): bool
{ {
return $this->formerlyOwned; return $this->formerlyOwned;
} }
public function setBatteryType(string $batteryType): self public function setBatteryType(string $batteryType): self
{ {
$this->batteryType = $batteryType; $this->batteryType = $batteryType;
return $this; return $this;
} }
public function getBatteryType(): string public function getBatteryType(): string
{ {
return $this->batteryType ?? ''; return $this->batteryType ?? '';
} }
public function setFilmFormat(string $filmFormat): self public function setFilmFormat(string $filmFormat): self
{ {
$this->filmFormat = $filmFormat; $this->filmFormat = $filmFormat;
return $this; return $this;
} }
public function getFilmFormat(): string public function getFilmFormat(): string
{ {
return $this->filmFormat ?? ''; return $this->filmFormat ?? '';
} }
public function setReceived(bool $received): self public function setReceived(bool $received): self
{ {
$this->received = $received; $this->received = $received;
return $this; return $this;
} }
public function getReceived(): bool public function getReceived(): bool
{ {
return $this->received; return $this->received;
} }
} }

View File

@ -2,8 +2,8 @@
namespace App\Entity; namespace App\Entity;
use Stringable;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Stringable;
/** /**
* CameraType * CameraType
@ -12,75 +12,71 @@ use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity] #[ORM\Entity]
class CameraType implements Stringable class CameraType implements Stringable
{ {
#[ORM\Column(name: 'id', type: 'integer', nullable: false)] #[ORM\Column(name: 'id', type: 'integer', nullable: FALSE)]
#[ORM\Id] #[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')] #[ORM\GeneratedValue(strategy: 'IDENTITY')]
#[ORM\SequenceGenerator(sequenceName: 'camera.camera_type_id_seq', allocationSize: 1, initialValue: 1)] #[ORM\SequenceGenerator(sequenceName: 'camera.camera_type_id_seq', allocationSize: 1, initialValue: 1)]
private int $id; private int $id;
#[ORM\Column(name: 'type', type: 'string', length: 255, nullable: false)] #[ORM\Column(name: 'type', type: 'string', length: 255, nullable: FALSE)]
private string $type; private string $type;
#[ORM\Column(name: 'description', type: 'text', nullable: true)] #[ORM\Column(name: 'description', type: 'text', nullable: TRUE)]
private ?string $description = null; private ?string $description = NULL;
/** /**
* Value for serialization * Value for serialization
*/ */
public function __toString(): string public function __toString(): string
{ {
return $this->type; return $this->type;
} }
/** /**
* Get id * Get id
*/ */
public function getId(): int public function getId(): int
{ {
return $this->id; return $this->id;
} }
/** /**
* Set type * Set type
* */
* public function setType(string $type): self
*/ {
public function setType(string $type): self $this->type = $type;
{
$this->type = $type;
return $this; return $this;
} }
/** /**
* Set description * Set description
* */
* public function setDescription(string $description): self
*/ {
public function setDescription(string $description): self $this->description = $description;
{
$this->description = $description;
return $this; return $this;
} }
/** /**
* Get type * Get type
* *
* @return string * @return string
*/ */
public function getType(): ?string public function getType(): ?string
{ {
return $this->type; return $this->type;
} }
/** /**
* Get description * Get description
* *
* @return string * @return string
*/ */
public function getDescription(): ?string public function getDescription(): ?string
{ {
return $this->description; return $this->description;
} }
} }

View File

@ -11,237 +11,250 @@ use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity] #[ORM\Entity]
class Film class Film
{ {
#[ORM\Id] #[ORM\Id]
#[ORM\Column(name: 'id', type: 'integer', nullable: false)] #[ORM\Column(name: 'id', type: 'integer', nullable: FALSE)]
#[ORM\GeneratedValue(strategy: 'IDENTITY')] #[ORM\GeneratedValue(strategy: 'IDENTITY')]
private int $id; private int $id;
#[ORM\Column(name: 'brand', type: 'string', nullable: false)] #[ORM\Column(name: 'brand', type: 'string', nullable: FALSE)]
private string $brand; private string $brand;
#[ORM\Column(name: 'product_line', type: 'string', nullable: true)] #[ORM\Column(name: 'product_line', type: 'string', nullable: TRUE)]
private ?string $productLine = null; private ?string $productLine = NULL;
#[ORM\Column(name: 'film_name', type: 'string', nullable: false)] #[ORM\Column(name: 'film_name', type: 'string', nullable: FALSE)]
private string $filmName; private string $filmName;
#[ORM\Column(name: 'film_alias', type: 'string', nullable: true)] #[ORM\Column(name: 'film_alias', type: 'string', nullable: TRUE)]
private ?string $filmAlias = null; private ?string $filmAlias = NULL;
#[ORM\Column(name: 'film_speed_asa', type: 'integer', nullable: false)] #[ORM\Column(name: 'film_speed_asa', type: 'integer', nullable: FALSE)]
private int $filmSpeedAsa; private int $filmSpeedAsa;
#[ORM\Column(name: 'film_speed_din', type: 'integer', nullable: false)] #[ORM\Column(name: 'film_speed_din', type: 'integer', nullable: FALSE)]
private int $filmSpeedDin; private int $filmSpeedDin;
#[ORM\Column(name: 'film_format', type: 'string', nullable: false)] #[ORM\Column(name: 'film_format', type: 'string', nullable: FALSE)]
private string $filmFormat; private string $filmFormat;
#[ORM\Column(name: 'film_base', type: 'string', nullable: false, options: ['default' => 'Cellulose Triacetate'])] #[ORM\Column(name: 'film_base', type: 'string', nullable: FALSE, options: ['default' => 'Cellulose Triacetate'])]
private string $filmBase = 'Cellulose Triacetate'; private string $filmBase = 'Cellulose Triacetate';
#[ORM\Column(name: 'unused_rolls', type: 'integer', nullable: false, options: ['default' => 0])] #[ORM\Column(name: 'unused_rolls', type: 'integer', nullable: FALSE, options: ['default' => 0])]
private int $unusedRolls = 0; private int $unusedRolls = 0;
#[ORM\Column(name: 'rolls_in_camera', type: 'integer', nullable: false, options: ['default' => 0])] #[ORM\Column(name: 'rolls_in_camera', type: 'integer', nullable: FALSE, options: ['default' => 0])]
private int $rollsInCamera = 0; private int $rollsInCamera = 0;
#[ORM\Column(name: 'developed_rolls', type: 'integer', nullable: false, options: ['default' => 0])] #[ORM\Column(name: 'developed_rolls', type: 'integer', nullable: FALSE, options: ['default' => 0])]
private int $developedRolls = 0; private int $developedRolls = 0;
#[ORM\Column(name: 'chemistry', type: 'string', nullable: false, options: ['default' => 'C-41'])] #[ORM\Column(name: 'chemistry', type: 'string', nullable: FALSE, options: ['default' => 'C-41'])]
private string $chemistry = 'C-41'; private string $chemistry = 'C-41';
#[ORM\Column(name: 'notes', type: 'text', nullable: true)] #[ORM\Column(name: 'notes', type: 'text', nullable: TRUE)]
private ?string $notes = null; private ?string $notes = NULL;
public function getId(): int public function getId(): int
{ {
return $this->id; return $this->id;
} }
/** /**
* @return string * @return string
*/ */
public function getBrand(): ?string public function getBrand(): ?string
{ {
return $this->brand; return $this->brand;
} }
public function setBrand(string $brand): self public function setBrand(string $brand): self
{ {
$this->brand = $brand; $this->brand = $brand;
return $this;
}
/** return $this;
* @return string }
*/
public function getProductLine(): ?string
{
return $this->productLine;
}
/** /**
* @param string $productLine * @return string
*/ */
public function setProductLine(?string $productLine): self public function getProductLine(): ?string
{ {
$this->productLine = $productLine; return $this->productLine;
return $this; }
}
/** /**
* @return string * @param string $productLine
*/ */
public function getFilmName(): ?string public function setProductLine(?string $productLine): self
{ {
return $this->filmName; $this->productLine = $productLine;
}
public function setFilmName(string $filmName): self return $this;
{ }
$this->filmName = $filmName;
return $this;
}
/** /**
* @return string * @return string
*/ */
public function getFilmAlias(): ?string public function getFilmName(): ?string
{ {
return $this->filmAlias; return $this->filmName;
} }
public function setFilmAlias(string $filmAlias): self public function setFilmName(string $filmName): self
{ {
$this->filmAlias = $filmAlias; $this->filmName = $filmName;
return $this;
}
/** return $this;
* @return int }
*/
public function getFilmSpeedAsa(): ?int
{
return $this->filmSpeedAsa;
}
public function setFilmSpeedAsa(int $filmSpeedAsa): self /**
{ * @return string
$this->filmSpeedAsa = $filmSpeedAsa; */
return $this; public function getFilmAlias(): ?string
} {
return $this->filmAlias;
}
/** public function setFilmAlias(string $filmAlias): self
* @return int {
*/ $this->filmAlias = $filmAlias;
public function getFilmSpeedDin(): ?int
{
return $this->filmSpeedDin;
}
public function setFilmSpeedDin(int $filmSpeedDin): self return $this;
{ }
$this->filmSpeedDin = $filmSpeedDin;
return $this;
}
/** /**
* @return string * @return int
*/ */
public function getFilmFormat(): ?string public function getFilmSpeedAsa(): ?int
{ {
return $this->filmFormat; return $this->filmSpeedAsa;
} }
public function setFilmFormat(string $filmFormat): self public function setFilmSpeedAsa(int $filmSpeedAsa): self
{ {
$this->filmFormat = $filmFormat; $this->filmSpeedAsa = $filmSpeedAsa;
return $this;
}
/** return $this;
* @return string }
*/
public function getFilmBase(): ?string
{
return $this->filmBase;
}
public function setFilmBase(string $filmBase): self /**
{ * @return int
$this->filmBase = $filmBase; */
return $this; public function getFilmSpeedDin(): ?int
} {
return $this->filmSpeedDin;
}
/** public function setFilmSpeedDin(int $filmSpeedDin): self
* @return int {
*/ $this->filmSpeedDin = $filmSpeedDin;
public function getUnusedRolls(): ?int
{
return $this->unusedRolls;
}
public function setUnusedRolls(int $unusedRolls): self return $this;
{ }
$this->unusedRolls = $unusedRolls;
return $this;
}
/** /**
* @return int * @return string
*/ */
public function getRollsInCamera(): ?int public function getFilmFormat(): ?string
{ {
return $this->rollsInCamera; return $this->filmFormat;
} }
public function setRollsInCamera(int $rollsInCamera): self public function setFilmFormat(string $filmFormat): self
{ {
$this->rollsInCamera = $rollsInCamera; $this->filmFormat = $filmFormat;
return $this;
}
/** return $this;
* @return int }
*/
public function getDevelopedRolls(): ?int
{
return $this->developedRolls;
}
public function setDevelopedRolls(int $developedRolls): self /**
{ * @return string
$this->developedRolls = $developedRolls; */
return $this; public function getFilmBase(): ?string
} {
return $this->filmBase;
}
/** public function setFilmBase(string $filmBase): self
* @return string {
*/ $this->filmBase = $filmBase;
public function getChemistry(): ?string
{
return $this->chemistry;
}
public function setChemistry(string $chemistry): self return $this;
{ }
$this->chemistry = $chemistry;
return $this;
}
/** /**
* @return string * @return int
*/ */
public function getNotes(): ?string public function getUnusedRolls(): ?int
{ {
return $this->notes; return $this->unusedRolls;
} }
public function setNotes(string $notes): self public function setUnusedRolls(int $unusedRolls): self
{ {
$this->notes = $notes; $this->unusedRolls = $unusedRolls;
return $this;
} return $this;
}
/**
* @return int
*/
public function getRollsInCamera(): ?int
{
return $this->rollsInCamera;
}
public function setRollsInCamera(int $rollsInCamera): self
{
$this->rollsInCamera = $rollsInCamera;
return $this;
}
/**
* @return int
*/
public function getDevelopedRolls(): ?int
{
return $this->developedRolls;
}
public function setDevelopedRolls(int $developedRolls): self
{
$this->developedRolls = $developedRolls;
return $this;
}
/**
* @return string
*/
public function getChemistry(): ?string
{
return $this->chemistry;
}
public function setChemistry(string $chemistry): self
{
$this->chemistry = $chemistry;
return $this;
}
/**
* @return string
*/
public function getNotes(): ?string
{
return $this->notes;
}
public function setNotes(string $notes): self
{
$this->notes = $notes;
return $this;
}
} }

View File

@ -8,50 +8,52 @@ use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity] #[ORM\Entity]
class FilmFormat class FilmFormat
{ {
#[ORM\Id] #[ORM\Id]
#[ORM\GeneratedValue] #[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')] #[ORM\Column(type: 'integer')]
private int $id; private int $id;
#[ORM\Column(name: 'number_id', type: 'integer')] #[ORM\Column(name: 'number_id', type: 'integer')]
private int $numberId; private int $numberId;
#[ORM\Column(name: 'name', type: 'string')] #[ORM\Column(name: 'name', type: 'string')]
private string $name; private string $name;
/** /**
* @return int * @return int
*/ */
public function getId(): ?int public function getId(): ?int
{ {
return $this->id; return $this->id;
} }
/** /**
* @return int * @return int
*/ */
public function getNumberId(): ?int public function getNumberId(): ?int
{ {
return $this->numberId; return $this->numberId;
} }
public function setNumberId(int $numberId): self public function setNumberId(int $numberId): self
{ {
$this->numberId = $numberId; $this->numberId = $numberId;
return $this;
}
/** return $this;
* @return string }
*/
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self /**
{ * @return string
$this->name = $name; */
return $this; public function getName(): ?string
} {
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
} }

View File

@ -11,16 +11,17 @@ use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity] #[ORM\Entity]
class Flash class Flash
{ {
use FlashTrait; use FlashTrait;
#[ORM\Column(name: 'id', type: 'integer', nullable: false)]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
#[ORM\SequenceGenerator(sequenceName: 'camera.flash_id_seq', allocationSize: 1, initialValue: 1)]
private int $id;
#[ORM\Column(name: 'received', type: 'boolean', nullable: false, options: ['default' => false])] #[ORM\Column(name: 'id', type: 'integer', nullable: FALSE)]
private bool $received = false; #[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
#[ORM\SequenceGenerator(sequenceName: 'camera.flash_id_seq', allocationSize: 1, initialValue: 1)]
private int $id;
#[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: false, options: ['default' => false])] #[ORM\Column(name: 'received', type: 'boolean', nullable: FALSE, options: ['default' => FALSE])]
private bool $formerlyOwned = false; private bool $received = FALSE;
#[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: FALSE, options: ['default' => FALSE])]
private bool $formerlyOwned = FALSE;
} }

View File

@ -6,351 +6,349 @@ use Doctrine\ORM\Mapping as ORM;
trait FlashTrait trait FlashTrait
{ {
use PurchasePriceTrait; use PurchasePriceTrait;
#[ORM\Column(name: 'brand', type: 'string', nullable: false)] #[ORM\Column(name: 'brand', type: 'string', nullable: FALSE)]
private readonly string $brand; private readonly string $brand;
#[ORM\Column(name: 'model', type: 'string', nullable: false)] #[ORM\Column(name: 'model', type: 'string', nullable: FALSE)]
private readonly string $model; private readonly string $model;
#[ORM\Column(name: 'is_auto_flash', type: 'boolean', nullable: false)] #[ORM\Column(name: 'is_auto_flash', type: 'boolean', nullable: FALSE)]
private bool $isAutoFlash = false; private bool $isAutoFlash = FALSE;
#[ORM\Column(name: 'is_ttl', type: 'boolean', nullable: false)] #[ORM\Column(name: 'is_ttl', type: 'boolean', nullable: FALSE)]
private bool $isTtl = false; private bool $isTtl = FALSE;
#[ORM\Column(name: 'ttl_type', type: 'string', nullable: false)] #[ORM\Column(name: 'ttl_type', type: 'string', nullable: FALSE)]
private string $ttlType = 'N / A'; private string $ttlType = 'N / A';
#[ORM\Column(name: 'is_p_ttl', type: 'boolean', nullable: false)] #[ORM\Column(name: 'is_p_ttl', type: 'boolean', nullable: FALSE)]
private bool $isPTtl = false; private bool $isPTtl = FALSE;
#[ORM\Column(name: 'p_ttl_type', type: 'string', nullable: false)] #[ORM\Column(name: 'p_ttl_type', type: 'string', nullable: FALSE)]
private string $pTtlType = 'N / A'; private string $pTtlType = 'N / A';
#[ORM\Column(name: 'guide_number', type: 'string', nullable: true)] #[ORM\Column(name: 'guide_number', type: 'string', nullable: TRUE)]
private ?string $guideNumber = ''; private ?string $guideNumber = '';
#[ORM\Column(name: 'batteries', type: 'string', nullable: false)] #[ORM\Column(name: 'batteries', type: 'string', nullable: FALSE)]
private string $batteries = '4x AA'; private string $batteries = '4x AA';
#[ORM\Column(name: 'notes', type: 'text', nullable: true)] #[ORM\Column(name: 'notes', type: 'text', nullable: TRUE)]
private readonly ?string $notes; private readonly ?string $notes;
#[ORM\Column(name: 'serial', type: 'string', nullable: true)] #[ORM\Column(name: 'serial', type: 'string', nullable: TRUE)]
private readonly ?string $serial; private readonly ?string $serial;
public function getId(): int public function getId(): int
{ {
return $this->id; return $this->id;
} }
/** /**
* Set brand * Set brand
* */
* public function setBrand(string $brand): self
*/ {
public function setBrand(string $brand): self $this->brand = $brand;
{
$this->brand = $brand;
return $this; return $this;
} }
/** /**
* Get brand * Get brand
* *
* @return string * @return string
*/ */
public function getBrand() public function getBrand()
{ {
return $this->brand; return $this->brand;
} }
/** /**
* Set model * Set model
* *
* @param string $model * @param string $model
* *
* @return Flash * @return Flash
*/ */
public function setModel($model) public function setModel($model)
{ {
$this->model = $model; $this->model = $model;
return $this; return $this;
} }
/** /**
* Get model * Get model
* *
* @return string * @return string
*/ */
public function getModel() public function getModel()
{ {
return $this->model; return $this->model;
} }
/** /**
* Set isAutoFlash * Set isAutoFlash
* *
* @param boolean $isAutoFlash * @param bool $isAutoFlash
* *
* @return Flash * @return Flash
*/ */
public function setIsAutoFlash($isAutoFlash) public function setIsAutoFlash($isAutoFlash)
{ {
$this->isAutoFlash = $isAutoFlash; $this->isAutoFlash = $isAutoFlash;
return $this; return $this;
} }
/** /**
* Get isAutoFlash * Get isAutoFlash
* *
* @return boolean * @return bool
*/ */
public function getIsAutoFlash() public function getIsAutoFlash()
{ {
return $this->isAutoFlash; return $this->isAutoFlash;
} }
/** /**
* Set isTtl * Set isTtl
* *
* @param boolean $isTtl * @param bool $isTtl
* *
* @return Flash * @return Flash
*/ */
public function setIsTtl($isTtl) public function setIsTtl($isTtl)
{ {
$this->isTtl = $isTtl; $this->isTtl = $isTtl;
return $this; return $this;
} }
/** /**
* Get isTtl * Get isTtl
* *
* @return boolean * @return bool
*/ */
public function getIsTtl() public function getIsTtl()
{ {
return $this->isTtl; return $this->isTtl;
} }
/** /**
* Set ttlType * Set ttlType
* *
* @param string $ttlType * @param string $ttlType
* *
* @return Flash * @return Flash
*/ */
public function setTtlType($ttlType) public function setTtlType($ttlType)
{ {
$this->ttlType = $ttlType; $this->ttlType = $ttlType;
return $this; return $this;
} }
/** /**
* Get ttlType * Get ttlType
* *
* @return string * @return string
*/ */
public function getTtlType() public function getTtlType()
{ {
return $this->ttlType; return $this->ttlType;
} }
/** /**
* Set isPTtl * Set isPTtl
* *
* @param boolean $isPTtl * @param bool $isPTtl
* *
* @return Flash * @return Flash
*/ */
public function setIsPTtl($isPTtl) public function setIsPTtl($isPTtl)
{ {
$this->isPTtl = $isPTtl; $this->isPTtl = $isPTtl;
return $this; return $this;
} }
/** /**
* Get isPTtl * Get isPTtl
* *
* @return boolean * @return bool
*/ */
public function getIsPTtl() public function getIsPTtl()
{ {
return $this->isPTtl; return $this->isPTtl;
} }
/** /**
* Set pTtlType * Set pTtlType
* *
* @param string $pTtlType * @param string $pTtlType
*/ */
public function setPTtlType($pTtlType): self public function setPTtlType($pTtlType): self
{ {
$this->pTtlType = $pTtlType; $this->pTtlType = $pTtlType;
return $this; return $this;
} }
/** /**
* Get pTtlType * Get pTtlType
* *
* @return string * @return string
*/ */
public function getPTtlType() public function getPTtlType()
{ {
return $this->pTtlType; return $this->pTtlType;
} }
/** /**
* Set guideNumber * Set guideNumber
* *
* @param string $guideNumber * @param string $guideNumber
* *
* @return self * @return self
*/ */
public function setGuideNumber($guideNumber) public function setGuideNumber($guideNumber)
{ {
$this->guideNumber = $guideNumber; $this->guideNumber = $guideNumber;
return $this; return $this;
} }
/** /**
* Get guideNumber * Get guideNumber
* *
* @return string * @return string
*/ */
public function getGuideNumber() public function getGuideNumber()
{ {
return $this->guideNumber; return $this->guideNumber;
} }
/** /**
* Set batteries * Set batteries
* *
* @param string $batteries * @param string $batteries
* *
* @return Flash * @return Flash
*/ */
public function setBatteries($batteries): self public function setBatteries($batteries): self
{ {
$this->batteries = $batteries; $this->batteries = $batteries;
return $this; return $this;
} }
/** /**
* Get batteries * Get batteries
* *
* @return string * @return string
*/ */
public function getBatteries() public function getBatteries()
{ {
return $this->batteries; return $this->batteries;
} }
/** /**
* Set notes * Set notes
* *
* @param string $notes * @param string $notes
* *
* @return Flash * @return Flash
*/ */
public function setNotes($notes): self public function setNotes($notes): self
{ {
$this->notes = $notes; $this->notes = $notes;
return $this; return $this;
} }
/** /**
* Get notes * Get notes
* *
* @return string * @return string
*/ */
public function getNotes() public function getNotes()
{ {
return $this->notes; return $this->notes;
} }
/** /**
* Set serial * Set serial
* *
* @param string $serial * @param string $serial
* *
* @return Flash * @return Flash
*/ */
public function setSerial($serial): self public function setSerial($serial): self
{ {
$this->serial = $serial; $this->serial = $serial;
return $this; return $this;
} }
/** /**
* Get serial * Get serial
* *
* @return string * @return string
*/ */
public function getSerial() public function getSerial()
{ {
return $this->serial; return $this->serial;
} }
/** /**
* Set formerlyOwned * Set formerlyOwned
* *
* @param boolean $formerlyOwned * @param bool $formerlyOwned
* *
* @return Flash * @return Flash
*/ */
public function setFormerlyOwned($formerlyOwned): self public function setFormerlyOwned($formerlyOwned): self
{ {
$this->formerlyOwned = $formerlyOwned; $this->formerlyOwned = $formerlyOwned;
return $this; return $this;
} }
/** /**
* Get formerlyOwned * Get formerlyOwned
* *
* @return boolean * @return bool
*/ */
public function getFormerlyOwned() public function getFormerlyOwned()
{ {
return $this->formerlyOwned; return $this->formerlyOwned;
} }
/** /**
* Set received * Set received
* *
* @param boolean $received * @param bool $received
* *
* @return Flash * @return Flash
*/ */
public function setReceived($received): self public function setReceived($received): self
{ {
$this->received = $received; $this->received = $received;
return $this; return $this;
} }
/** /**
* Get received * Get received
* *
* @return boolean * @return bool
*/ */
public function getReceived() public function getReceived()
{ {
return $this->received; return $this->received;
} }
} }

View File

@ -6,499 +6,499 @@ use Doctrine\ORM\Mapping as ORM;
trait LensTrait trait LensTrait
{ {
use PurchasePriceTrait; use PurchasePriceTrait;
#[ORM\Column(name: 'brand', type: 'string', length: 64, nullable: true)] #[ORM\Column(name: 'brand', type: 'string', length: 64, nullable: TRUE)]
private readonly ?string $brand; private readonly ?string $brand;
#[ORM\Column(name: 'coatings', type: 'string', length: 64, nullable: true)] #[ORM\Column(name: 'coatings', type: 'string', length: 64, nullable: TRUE)]
private readonly ?string $coatings; private readonly ?string $coatings;
#[ORM\Column(name: 'product_line', type: 'string', length: 64, nullable: true)] #[ORM\Column(name: 'product_line', type: 'string', length: 64, nullable: TRUE)]
private readonly ?string $productLine; private readonly ?string $productLine;
#[ORM\Column(name: 'model', type: 'string', length: 64, nullable: true)] #[ORM\Column(name: 'model', type: 'string', length: 64, nullable: TRUE)]
private readonly ?string $model; private readonly ?string $model;
#[ORM\Column(name: 'min_f_stop', type: 'string', length: 10, nullable: true)] #[ORM\Column(name: 'min_f_stop', type: 'string', length: 10, nullable: TRUE)]
private readonly ?string $minFStop; private readonly ?string $minFStop;
#[ORM\Column(name: 'max_f_stop', type: 'float', precision: 10, scale: 0, nullable: true)] #[ORM\Column(name: 'max_f_stop', type: 'float', precision: 10, scale: 0, nullable: TRUE)]
private readonly ?float $maxFStop; private readonly ?float $maxFStop;
#[ORM\Column(name: 'min_focal_length', type: 'integer', nullable: true)] #[ORM\Column(name: 'min_focal_length', type: 'integer', nullable: TRUE)]
private readonly ?int $minFocalLength; private readonly ?int $minFocalLength;
#[ORM\Column(name: 'max_focal_length', type: 'integer', nullable: true)] #[ORM\Column(name: 'max_focal_length', type: 'integer', nullable: TRUE)]
private readonly ?int $maxFocalLength; private readonly ?int $maxFocalLength;
#[ORM\Column(name: 'serial', type: 'string', length: 10, nullable: true)] #[ORM\Column(name: 'serial', type: 'string', length: 10, nullable: TRUE)]
private readonly ?string $serial; private readonly ?string $serial;
#[ORM\Column(name: 'notes', type: 'text', nullable: true)] #[ORM\Column(name: 'notes', type: 'text', nullable: TRUE)]
private readonly ?string $notes; private readonly ?string $notes;
#[ORM\Column(name: 'image_size', type: 'string', nullable: false, options: ['default' => '35mm'])] #[ORM\Column(name: 'image_size', type: 'string', nullable: FALSE, options: ['default' => '35mm'])]
private string $imageSize = '35mm'; private string $imageSize = '35mm';
#[ORM\Column(name: 'mount', type: 'string', length: 40, nullable: true)] #[ORM\Column(name: 'mount', type: 'string', length: 40, nullable: TRUE)]
private readonly ?string $mount; private readonly ?string $mount;
#[ORM\Column(name: 'front_filter_size', type: 'decimal', precision: 10, scale: 0, nullable: true)] #[ORM\Column(name: 'front_filter_size', type: 'decimal', precision: 10, scale: 0, nullable: TRUE)]
private readonly ?string $frontFilterSize; private readonly ?string $frontFilterSize;
#[ORM\Column(name: 'rear_filter_size', type: 'decimal', precision: 10, scale: 0, nullable: true)] #[ORM\Column(name: 'rear_filter_size', type: 'decimal', precision: 10, scale: 0, nullable: TRUE)]
private readonly ? string $rearFilterSize; private readonly ?string $rearFilterSize;
#[ORM\Column(name: 'is_teleconverter', type: 'boolean', nullable: false)] #[ORM\Column(name: 'is_teleconverter', type: 'boolean', nullable: FALSE)]
private bool $isTeleconverter = false; private bool $isTeleconverter = FALSE;
#[ORM\Column(name: 'design_elements', type: 'smallint', nullable: true)] #[ORM\Column(name: 'design_elements', type: 'smallint', nullable: TRUE)]
private readonly ?int $designElements; private readonly ?int $designElements;
#[ORM\Column(name: 'design_groups', type: 'smallint', nullable: true)] #[ORM\Column(name: 'design_groups', type: 'smallint', nullable: TRUE)]
private readonly ?int $designGroups; private readonly ?int $designGroups;
#[ORM\Column(name: 'aperture_blades', type: 'smallint', nullable: true)] #[ORM\Column(name: 'aperture_blades', type: 'smallint', nullable: TRUE)]
private readonly ?int $apertureBlades; private readonly ?int $apertureBlades;
/**
/** * Get id
* Get id */
*/ public function getId(): int
public function getId(): int {
{ return $this->id;
return $this->id; }
}
/**
/** * Set brand
* Set brand *
* * @param string $brand
* @param string $brand */
*/ public function setBrand($brand): self
public function setBrand($brand): self {
{ $this->brand = $brand;
$this->brand = $brand;
return $this;
return $this; }
}
/**
/** * Get brand
* Get brand *
* * @return string
* @return string */
*/ public function getBrand()
public function getBrand() {
{ return $this->brand;
return $this->brand; }
}
/**
/** * Set coatings
* Set coatings *
* * @param string $coatings
* @param string $coatings */
*/ public function setCoatings($coatings): self
public function setCoatings($coatings): self {
{ $this->coatings = $coatings;
$this->coatings = $coatings;
return $this;
return $this; }
}
/**
/** * Get coatings
* Get coatings *
* * @return string
* @return string */
*/ public function getCoatings()
public function getCoatings() {
{ return $this->coatings;
return $this->coatings; }
}
/**
/** * Set productLine
* Set productLine *
* * @param string $productLine
* @param string $productLine */
*/ public function setProductLine($productLine): self
public function setProductLine($productLine): self {
{ $this->productLine = $productLine;
$this->productLine = $productLine;
return $this;
return $this; }
}
/**
/** * Get productLine
* Get productLine *
* * @return string
* @return string */
*/ public function getProductLine()
public function getProductLine() {
{ return $this->productLine;
return $this->productLine; }
}
/**
/** * Set model
* Set model *
* * @param string $model
* @param string $model */
*/ public function setModel($model): self
public function setModel($model): self {
{ $this->model = $model;
$this->model = $model;
return $this;
return $this; }
}
/**
/** * Get model
* Get model *
* * @return string
* @return string */
*/ public function getModel()
public function getModel() {
{ return $this->model;
return $this->model; }
}
/**
/** * Set minFStop
* Set minFStop *
* * @param string $minFStop
* @param string $minFStop */
*/ public function setMinFStop($minFStop): self
public function setMinFStop($minFStop): self {
{ $this->minFStop = $minFStop;
$this->minFStop = $minFStop;
return $this;
return $this; }
}
/**
/** * Get minFStop
* Get minFStop *
* * @return string
* @return string */
*/ public function getMinFStop()
public function getMinFStop() {
{ return $this->minFStop;
return $this->minFStop; }
}
/**
/** * Set maxFStop
* Set maxFStop *
* * @param float $maxFStop
* @param float $maxFStop */
*/ public function setMaxFStop($maxFStop): self
public function setMaxFStop($maxFStop): self {
{ $this->maxFStop = $maxFStop;
$this->maxFStop = $maxFStop;
return $this;
return $this; }
}
/**
/** * Get maxFStop
* Get maxFStop *
* * @return float
* @return float */
*/ public function getMaxFStop()
public function getMaxFStop() {
{ return $this->maxFStop;
return $this->maxFStop; }
}
/**
/** * Set minFocalLength
* Set minFocalLength *
* * @param int $minFocalLength
* @param integer $minFocalLength */
*/ public function setMinFocalLength($minFocalLength): self
public function setMinFocalLength($minFocalLength): self {
{ $this->minFocalLength = $minFocalLength;
$this->minFocalLength = $minFocalLength;
return $this;
return $this; }
}
/**
/** * Get minFocalLength
* Get minFocalLength *
* * @return int
* @return integer */
*/ public function getMinFocalLength()
public function getMinFocalLength() {
{ return $this->minFocalLength;
return $this->minFocalLength; }
}
/**
/** * Set maxFocalLength
* Set maxFocalLength *
* * @param int $maxFocalLength
* @param integer $maxFocalLength */
*/ public function setMaxFocalLength($maxFocalLength): self
public function setMaxFocalLength($maxFocalLength): self {
{ $this->maxFocalLength = $maxFocalLength;
$this->maxFocalLength = $maxFocalLength;
return $this;
return $this; }
}
/**
/** * Get maxFocalLength
* Get maxFocalLength *
* * @return int
* @return integer */
*/ public function getMaxFocalLength()
public function getMaxFocalLength() {
{ return $this->maxFocalLength;
return $this->maxFocalLength; }
}
/**
/** * Set serial
* Set serial *
* * @param string $serial
* @param string $serial */
*/ public function setSerial($serial): self
public function setSerial($serial): self {
{ $this->serial = $serial;
$this->serial = $serial;
return $this;
return $this; }
}
/**
/** * Get serial
* Get serial */
*/ public function getSerial(): string
public function getSerial(): string {
{ return $this->serial ?? '';
return $this->serial ?? ''; }
}
/**
/** * Set notes
* Set notes *
* * @param string $notes
* @param string $notes */
*/ public function setNotes(?string $notes): self
public function setNotes(?string $notes): self {
{ $this->notes = $notes;
$this->notes = $notes;
return $this;
return $this; }
}
/**
/** * Get notes
* Get notes */
*/ public function getNotes(): string
public function getNotes(): string {
{ return $this->notes ?? '';
return $this->notes ?? ''; }
}
/**
/** * Get image size
* Get image size */
*/ public function getImageSize(): string
public function getImageSize(): string {
{ return $this->imageSize;
return $this->imageSize; }
}
/**
/** * Set image size
* Set image size */
*/ public function setImageSize(string $imageSize): self
public function setImageSize(string $imageSize): self {
{ $this->imageSize = $imageSize;
$this->imageSize = $imageSize;
return $this; return $this;
} }
/** /**
* Set mount * Set mount
* *
* @param string $mount * @param string $mount
*/ */
public function setMount($mount): self public function setMount($mount): self
{ {
$this->mount = $mount; $this->mount = $mount;
return $this; return $this;
} }
/** /**
* Get mount * Get mount
* *
* @return string * @return string
*/ */
public function getMount() public function getMount()
{ {
return $this->mount; return $this->mount;
} }
/** /**
* Set received * Set received
* *
* @param boolean $received * @param bool $received
*/ */
public function setReceived($received): self public function setReceived($received): self
{ {
$this->received = $received; $this->received = $received;
return $this; return $this;
} }
/** /**
* Get received * Get received
* *
* @return boolean * @return bool
*/ */
public function getReceived() public function getReceived()
{ {
return $this->received; return $this->received;
} }
/** /**
* Set formerlyOwned * Set formerlyOwned
* *
* @param boolean $formerlyOwned * @param bool $formerlyOwned
*/ */
public function setFormerlyOwned($formerlyOwned): self public function setFormerlyOwned($formerlyOwned): self
{ {
$this->formerlyOwned = $formerlyOwned; $this->formerlyOwned = $formerlyOwned;
return $this; return $this;
} }
/** /**
* Get formerlyOwned * Get formerlyOwned
* *
* @return boolean * @return bool
*/ */
public function getFormerlyOwned() public function getFormerlyOwned()
{ {
return $this->formerlyOwned; return $this->formerlyOwned;
} }
/** /**
* Set frontFilterSize * Set frontFilterSize
* *
* @param string $frontFilterSize * @param string $frontFilterSize
*/ */
public function setFrontFilterSize($frontFilterSize): self public function setFrontFilterSize($frontFilterSize): self
{ {
$this->frontFilterSize = $frontFilterSize; $this->frontFilterSize = $frontFilterSize;
return $this; return $this;
} }
/** /**
* Get frontFilterSize * Get frontFilterSize
* *
* @return string * @return string
*/ */
public function getFrontFilterSize() public function getFrontFilterSize()
{ {
return $this->frontFilterSize; return $this->frontFilterSize;
} }
/** /**
* Set rearFilterSize * Set rearFilterSize
* *
* @param string $rearFilterSize * @param string $rearFilterSize
*/ */
public function setRearFilterSize($rearFilterSize): self public function setRearFilterSize($rearFilterSize): self
{ {
$this->rearFilterSize = $rearFilterSize; $this->rearFilterSize = $rearFilterSize;
return $this; return $this;
} }
/** /**
* Get rearFilterSize * Get rearFilterSize
* *
* @return string * @return string
*/ */
public function getRearFilterSize() public function getRearFilterSize()
{ {
return $this->rearFilterSize; return $this->rearFilterSize;
} }
/** /**
* Set isTeleconverter * Set isTeleconverter
* *
* @param boolean $isTeleconverter * @param bool $isTeleconverter
*/ */
public function setIsTeleconverter($isTeleconverter): self public function setIsTeleconverter($isTeleconverter): self
{ {
$this->isTeleconverter = $isTeleconverter; $this->isTeleconverter = $isTeleconverter;
return $this; return $this;
} }
/** /**
* Get isTeleconverter * Get isTeleconverter
* *
* @return boolean * @return bool
*/ */
public function getIsTeleconverter() public function getIsTeleconverter()
{ {
return $this->isTeleconverter; return $this->isTeleconverter;
} }
/** /**
* Set designElements * Set designElements
* *
* @param integer $designElements * @param int $designElements
*/ */
public function setDesignElements($designElements): self public function setDesignElements($designElements): self
{ {
$this->designElements = $designElements; $this->designElements = $designElements;
return $this; return $this;
} }
/** /**
* Get designElements * Get designElements
* *
* @return integer * @return int
*/ */
public function getDesignElements() public function getDesignElements()
{ {
return $this->designElements; return $this->designElements;
} }
/** /**
* Set designGroups * Set designGroups
* *
* @param integer $designGroups * @param int $designGroups
*/ */
public function setDesignGroups($designGroups): self public function setDesignGroups($designGroups): self
{ {
$this->designGroups = $designGroups; $this->designGroups = $designGroups;
return $this; return $this;
} }
/** /**
* Get designGroups * Get designGroups
* *
* @return integer * @return int
*/ */
public function getDesignGroups() public function getDesignGroups()
{ {
return $this->designGroups; return $this->designGroups;
} }
/** /**
* Set apertureBlades * Set apertureBlades
* *
* @param integer $apertureBlades * @param int $apertureBlades
*/ */
public function setApertureBlades($apertureBlades): self public function setApertureBlades($apertureBlades): self
{ {
$this->apertureBlades = $apertureBlades; $this->apertureBlades = $apertureBlades;
return $this; return $this;
} }
/** /**
* Get apertureBlades * Get apertureBlades
* *
* @return integer * @return int
*/ */
public function getApertureBlades(): ?int public function getApertureBlades(): ?int
{ {
return $this->apertureBlades; return $this->apertureBlades;
} }
} }

View File

@ -12,16 +12,17 @@ use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: LensesRepository::class)] #[ORM\Entity(repositoryClass: LensesRepository::class)]
class Lenses class Lenses
{ {
use LensTrait; use LensTrait;
#[ORM\Column(name: 'id', type: 'integer', nullable: false)]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
#[ORM\SequenceGenerator(sequenceName: 'camera.lenses_id_seq', allocationSize: 1, initialValue: 1)]
private int $id;
#[ORM\Column(name: 'received', type: 'boolean', nullable: false)] #[ORM\Column(name: 'id', type: 'integer', nullable: FALSE)]
private bool $received = false; #[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
#[ORM\SequenceGenerator(sequenceName: 'camera.lenses_id_seq', allocationSize: 1, initialValue: 1)]
private int $id;
#[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: false)] #[ORM\Column(name: 'received', type: 'boolean', nullable: FALSE)]
private bool $formerlyOwned = false; private bool $received = FALSE;
#[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: FALSE)]
private bool $formerlyOwned = FALSE;
} }

View File

@ -13,10 +13,11 @@ use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: CameraRepository::class)] #[ORM\Entity(repositoryClass: CameraRepository::class)]
class PreviouslyOwnedCamera class PreviouslyOwnedCamera
{ {
use CameraTrait; use CameraTrait;
#[ORM\Column(name: 'id', type: 'integer', nullable: false)]
#[ORM\Id] #[ORM\Column(name: 'id', type: 'integer', nullable: FALSE)]
#[ORM\GeneratedValue(strategy: 'IDENTITY')] #[ORM\Id]
#[ORM\SequenceGenerator(sequenceName: 'prevously_owned_camera_id_seq', allocationSize: 1, initialValue: 1)] #[ORM\GeneratedValue(strategy: 'IDENTITY')]
private int $id; #[ORM\SequenceGenerator(sequenceName: 'prevously_owned_camera_id_seq', allocationSize: 1, initialValue: 1)]
private int $id;
} }

View File

@ -11,16 +11,16 @@ use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity] #[ORM\Entity]
class PreviouslyOwnedFlash class PreviouslyOwnedFlash
{ {
use FlashTrait; use FlashTrait;
#[ORM\Column(name: 'id', type: 'integer', nullable: false)] #[ORM\Column(name: 'id', type: 'integer', nullable: FALSE)]
#[ORM\Id] #[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')] #[ORM\GeneratedValue(strategy: 'IDENTITY')]
private int $id; private int $id;
#[ORM\Column(name: 'received', type: 'boolean', nullable: false, options: ['default' => true])] #[ORM\Column(name: 'received', type: 'boolean', nullable: FALSE, options: ['default' => TRUE])]
private bool $received = true; private bool $received = TRUE;
#[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: false, options: ['default' => true])] #[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: FALSE, options: ['default' => TRUE])]
private bool $formerlyOwned = true; private bool $formerlyOwned = TRUE;
} }

View File

@ -12,15 +12,16 @@ use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: LensesRepository::class)] #[ORM\Entity(repositoryClass: LensesRepository::class)]
class PreviouslyOwnedLenses class PreviouslyOwnedLenses
{ {
use LensTrait; use LensTrait;
#[ORM\Column(name: 'id', type: 'integer', nullable: false)]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
private int $id;
#[ORM\Column(name: 'received', type: 'boolean', nullable: false)] #[ORM\Column(name: 'id', type: 'integer', nullable: FALSE)]
private bool $received = true; #[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
private int $id;
#[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: false)] #[ORM\Column(name: 'received', type: 'boolean', nullable: FALSE)]
private bool $formerlyOwned = true; private bool $received = TRUE;
#[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: FALSE)]
private bool $formerlyOwned = TRUE;
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -18,20 +18,20 @@ use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
class Kernel extends BaseKernel class Kernel extends BaseKernel
{ {
use MicroKernelTrait; use MicroKernelTrait;
protected function configureContainer(ContainerConfigurator $container): void protected function configureContainer(ContainerConfigurator $container): void
{ {
$container->import('../config/{packages}/*.yaml'); $container->import('../config/{packages}/*.yaml');
$container->import('../config/{packages}/'.$this->environment.'/*.yaml'); $container->import('../config/{packages}/' . $this->environment . '/*.yaml');
$container->import('../config/{services}.yaml'); $container->import('../config/{services}.yaml');
$container->import('../config/{services}_'.$this->environment.'.yaml'); $container->import('../config/{services}_' . $this->environment . '.yaml');
} }
protected function configureRoutes(RoutingConfigurator $routes): void protected function configureRoutes(RoutingConfigurator $routes): void
{ {
$routes->import('../config/{routes}/'.$this->environment.'/*.yaml'); $routes->import('../config/{routes}/' . $this->environment . '/*.yaml');
$routes->import('../config/{routes}/*.yaml'); $routes->import('../config/{routes}/*.yaml');
$routes->import('../config/{routes}.yaml'); $routes->import('../config/{routes}.yaml');
} }
} }

View File

@ -4,41 +4,39 @@ namespace App\Repository;
use ReflectionObject; use ReflectionObject;
use Throwable; use Throwable;
trait AcquireTrait {
/** trait AcquireTrait
* Move a record from the table represented by $currentRecord {
* into the table represented by $newRecord /**
* * Move a record from the table represented by $currentRecord
* @param mixed $currentRecord * into the table represented by $newRecord
* @param mixed $newRecord *
*/ * @param mixed $currentRecord
protected function moveRecord($currentRecord, $newRecord): void * @param mixed $newRecord
{ */
$em = $this->getEntityManager(); protected function moveRecord($currentRecord, $newRecord): void
{
$em = $this->getEntityManager();
$old = new ReflectionObject($currentRecord); $old = new ReflectionObject($currentRecord);
$new = new ReflectionObject($newRecord); $new = new ReflectionObject($newRecord);
foreach ($old->getProperties() as $property) { foreach ($old->getProperties() as $property) {
$propertyName = $property->getName(); $propertyName = $property->getName();
if ($new->hasProperty($propertyName)) { if ($new->hasProperty($propertyName)) {
$newProperty = $new->getProperty($propertyName); $newProperty = $new->getProperty($propertyName);
$newProperty->setAccessible(true); $newProperty->setAccessible(TRUE);
$property->setAccessible(true); $property->setAccessible(TRUE);
$newProperty->setValue($newRecord, $property->getValue($currentRecord)); $newProperty->setValue($newRecord, $property->getValue($currentRecord));
} }
} }
try try {
{ $em->persist($newRecord);
$em->persist($newRecord); $em->remove($currentRecord);
$em->remove($currentRecord); $em->flush();
$em->flush(); } catch (Throwable) {
} dump($newRecord);
catch (Throwable) }
{ }
dump($newRecord);
}
}
} }

View File

@ -3,34 +3,30 @@
namespace App\Repository; namespace App\Repository;
use App\Entity\{Camera, PreviouslyOwnedCamera}; use App\Entity\{Camera, PreviouslyOwnedCamera};
use Doctrine\ORM\{ use Doctrine\ORM\{EntityRepository, ORMInvalidArgumentException};
EntityRepository, ORMInvalidArgumentException
};
class CameraRepository extends EntityRepository { class CameraRepository extends EntityRepository
{
use AcquireTrait;
use AcquireTrait; /**
* @throws ORMInvalidArgumentException
*/
public function deacquire(Camera $currentRecord): void
{
$currentRecord->setFormerlyOwned(TRUE)
->setReceived(TRUE);
/** $this->moveRecord($currentRecord, new PreviouslyOwnedCamera());
* @param Camera $currentRecord }
* @throws ORMInvalidArgumentException
*/
public function deacquire(Camera $currentRecord): void
{
$currentRecord->setFormerlyOwned(true)
->setReceived(true);
$this->moveRecord($currentRecord, new PreviouslyOwnedCamera()); /**
} * @throws ORMInvalidArgumentException
*/
public function reacquire(PreviouslyOwnedCamera $currentRecord): void
{
$currentRecord->setFormerlyOwned(FALSE);
/** $this->moveRecord($currentRecord, new Camera());
* @param PreviouslyOwnedCamera $currentRecord }
* @throws ORMInvalidArgumentException
*/
public function reacquire(PreviouslyOwnedCamera $currentRecord): void
{
$currentRecord->setFormerlyOwned(false);
$this->moveRecord($currentRecord, new Camera());
}
} }

View File

@ -3,34 +3,30 @@
namespace App\Repository; namespace App\Repository;
use App\Entity\{Flash, PreviouslyOwnedFlash}; use App\Entity\{Flash, PreviouslyOwnedFlash};
use Doctrine\ORM\{ use Doctrine\ORM\{EntityRepository, ORMInvalidArgumentException};
EntityRepository, ORMInvalidArgumentException
};
class FlashRepository extends EntityRepository { class FlashRepository extends EntityRepository
{
use AcquireTrait;
use AcquireTrait; /**
* @throws ORMInvalidArgumentException
*/
public function deacquire(Flash $currentRecord): void
{
$currentRecord->setFormerlyOwned(TRUE)
->setReceived(TRUE);
/** $this->moveRecord($currentRecord, new PreviouslyOwnedFlash());
* @param Flash $currentRecord }
* @throws ORMInvalidArgumentException
*/
public function deacquire(Flash $currentRecord): void
{
$currentRecord->setFormerlyOwned(true)
->setReceived(true);
$this->moveRecord($currentRecord, new PreviouslyOwnedFlash()); /**
} * @throws ORMInvalidArgumentException
*/
public function reacquire(PreviouslyOwnedFlash $currentRecord): void
{
$currentRecord->setFormerlyOwned(FALSE);
/** $this->moveRecord($currentRecord, new Flash());
* @param PreviouslyOwnedFlash $currentRecord }
* @throws ORMInvalidArgumentException
*/
public function reacquire(PreviouslyOwnedFlash $currentRecord): void
{
$currentRecord->setFormerlyOwned(false);
$this->moveRecord($currentRecord, new Flash());
}
} }

View File

@ -7,26 +7,20 @@ use Doctrine\ORM\EntityRepository;
class LensesRepository extends EntityRepository class LensesRepository extends EntityRepository
{ {
use AcquireTrait; use AcquireTrait;
/** public function deacquire(Lenses $currentRecord): void
* @param Lenses $currentRecord {
*/ $currentRecord->setFormerlyOwned(TRUE)
public function deacquire(Lenses $currentRecord): void ->setReceived(TRUE);
{
$currentRecord->setFormerlyOwned(true)
->setReceived(true);
$this->moveRecord($currentRecord, new PreviouslyOwnedLenses()); $this->moveRecord($currentRecord, new PreviouslyOwnedLenses());
} }
/** public function reacquire(PreviouslyOwnedLenses $currentRecord): void
* @param PreviouslyOwnedLenses $currentRecord {
*/ $currentRecord->setFormerlyOwned(FALSE);
public function reacquire(PreviouslyOwnedLenses $currentRecord): void
{
$currentRecord->setFormerlyOwned(false);
$this->moveRecord($currentRecord, new Lenses()); $this->moveRecord($currentRecord, new Lenses());
} }
} }

View File

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

View File

@ -1,23 +1,25 @@
<?php <?php declare(strict_types=1);
namespace App\ValueObject; namespace App\ValueObject;
use Stringable; use Stringable;
class Money implements Stringable {
private readonly float $value;
public function __construct($value) class Money implements Stringable
{ {
$this->value = (float)str_replace(['$',','], '', $value); private readonly float $value;
}
public function getValue(): float public function __construct($value)
{ {
return (float)str_replace(['$',','], '', $this->value); $this->value = (float) str_replace(['$', ','], '', $value);
} }
public function __toString(): string public function getValue(): float
{ {
return (string)$this->getValue(); return (float) str_replace(['$', ','], '', $this->value);
} }
public function __toString(): string
{
return (string) $this->getValue();
}
} }

View File

@ -114,9 +114,6 @@
"phpspec/prophecy": { "phpspec/prophecy": {
"version": "v1.15.0" "version": "v1.15.0"
}, },
"phpstan/phpstan": {
"version": "1.4.6"
},
"phpunit/php-code-coverage": { "phpunit/php-code-coverage": {
"version": "9.2.10" "version": "9.2.10"
}, },
@ -158,9 +155,6 @@
"psr/log": { "psr/log": {
"version": "1.1.3" "version": "1.1.3"
}, },
"rector/rector": {
"version": "0.12.16"
},
"roave/security-advisories": { "roave/security-advisories": {
"version": "dev-master" "version": "dev-master"
}, },
@ -245,21 +239,6 @@
"bin/console" "bin/console"
] ]
}, },
"symfony/debug": {
"version": "v4.4.19"
},
"symfony/debug-bundle": {
"version": "4.1",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "master",
"version": "4.1",
"ref": "f8863cbad2f2e58c4b65fa1eac892ab189971bea"
},
"files": [
"config/packages/dev/debug.yaml"
]
},
"symfony/dependency-injection": { "symfony/dependency-injection": {
"version": "v5.2.3" "version": "v5.2.3"
}, },
@ -480,9 +459,6 @@
"symfony/yaml": { "symfony/yaml": {
"version": "v5.2.3" "version": "v5.2.3"
}, },
"symplify/easy-coding-standard": {
"version": "10.0.21"
},
"theseer/tokenizer": { "theseer/tokenizer": {
"version": "1.2.1" "version": "1.2.1"
}, },

View File

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

8
tools/common.inc.php Normal file
View File

@ -0,0 +1,8 @@
<?php declare(strict_types=1);
function walk_array(callable $method, array $items): void
{
foreach ($items as $item) {
$method($item);
}
}

6
tools/composer.json Normal file
View File

@ -0,0 +1,6 @@
{
"require": {
"friendsofphp/php-cs-fixer": "^3.6",
"rector/rector": "^0.12.16"
}
}

2149
tools/composer.lock generated Normal file

File diff suppressed because it is too large Load Diff

85
tools/rector.php Normal file
View File

@ -0,0 +1,85 @@
<?php declare(strict_types=1);
use Rector\CodeQuality\Rector\BooleanNot\SimplifyDeMorganBinaryRector;
use Rector\CodeQuality\Rector\Class_\CompleteDynamicPropertiesRector;
use Rector\CodeQuality\Rector\For_\{ForRepeatedCountToOwnVariableRector, ForToForeachRector};
use Rector\CodeQuality\Rector\If_\{ConsecutiveNullCompareReturnsToNullCoalesceQueueRector, SimplifyIfElseToTernaryRector, SimplifyIfReturnBoolRector};
use Rector\CodeQuality\Rector\Ternary\{SimplifyDuplicatedTernaryRector, SimplifyTautologyTernaryRector, SwitchNegatedTernaryRector};
use Rector\CodingStyle\Rector\Class_\AddArrayDefaultToArrayPropertyRector;
use Rector\CodingStyle\Rector\ClassConst\RemoveFinalFromConstRector;
use Rector\CodingStyle\Rector\ClassMethod\NewlineBeforeNewAssignSetRector;
use Rector\CodingStyle\Rector\Encapsed\WrapEncapsedVariableInCurlyBracesRector;
use Rector\CodingStyle\Rector\FuncCall\{CallUserFuncArrayToVariadicRector, CallUserFuncToMethodCallRector, CountArrayToEmptyArrayComparisonRector};
use Rector\CodingStyle\Rector\Stmt\NewlineAfterStatementRector;
use Rector\Core\Configuration\Option;
use Rector\DeadCode\Rector\ClassMethod\{RemoveUselessParamTagRector, RemoveUselessReturnTagRector};
use Rector\DeadCode\Rector\Foreach_\RemoveUnusedForeachKeyRector;
use Rector\DeadCode\Rector\Property\RemoveUselessVarTagRector;
use Rector\DeadCode\Rector\Switch_\RemoveDuplicatedCaseInSwitchRector;
use Rector\Doctrine\Set\DoctrineSetList;
use Rector\EarlyReturn\Rector\Foreach_\ChangeNestedForeachIfsToEarlyContinueRector;
use Rector\EarlyReturn\Rector\If_\{ChangeIfElseValueAssignToEarlyReturnRector, RemoveAlwaysElseRector};
use Rector\Php81\Rector\Property\ReadOnlyPropertyRector;
use Rector\Restoration\Rector\Property\MakeTypedPropertyNullableIfCheckedRector;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Symfony\Set\{SymfonyLevelSetList, SymfonySetList};
use Rector\TypeDeclaration\Rector\ClassMethod\{AddArrayParamDocTypeRector, AddArrayReturnDocTypeRector, AddMethodCallBasedStrictParamTypeRector, ParamTypeByMethodCallTypeRector, ParamTypeByParentCallTypeRector};
use Rector\TypeDeclaration\Rector\Closure\AddClosureReturnTypeRector;
use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
require_once __DIR__ . '/common.inc.php';
return static function (ContainerConfigurator $config): void {
$parameters = $config->parameters();
$parameters->set(Option::AUTO_IMPORT_NAMES, TRUE);
$parameters->set(Option::IMPORT_SHORT_CLASSES, TRUE);
$parameters->set(Option::SKIP, [
ReadOnlyPropertyRector::class,
]);
walk_array([$config, 'import'], [
DoctrineSetList::ANNOTATIONS_TO_ATTRIBUTES,
LevelSetList::UP_TO_PHP_81,
SymfonyLevelSetList::UP_TO_SYMFONY_60,
SymfonySetList::ANNOTATIONS_TO_ATTRIBUTES,
]);
$services = $config->services();
walk_array([$services, 'set'], [
SimplifyDeMorganBinaryRector::class,
CompleteDynamicPropertiesRector::class,
ForRepeatedCountToOwnVariableRector::class,
ForToForeachRector::class,
ConsecutiveNullCompareReturnsToNullCoalesceQueueRector::class,
SimplifyIfElseToTernaryRector::class,
SimplifyIfReturnBoolRector::class,
SimplifyDuplicatedTernaryRector::class,
SimplifyTautologyTernaryRector::class,
SwitchNegatedTernaryRector::class,
AddArrayDefaultToArrayPropertyRector::class,
RemoveFinalFromConstRector::class,
NewlineBeforeNewAssignSetRector::class,
WrapEncapsedVariableInCurlyBracesRector::class,
CallUserFuncArrayToVariadicRector::class,
CallUserFuncToMethodCallRector::class,
CountArrayToEmptyArrayComparisonRector::class,
NewlineAfterStatementRector::class,
RemoveUselessParamTagRector::class,
RemoveUselessReturnTagRector::class,
RemoveUnusedForeachKeyRector::class,
RemoveUselessVarTagRector::class,
RemoveDuplicatedCaseInSwitchRector::class,
ChangeNestedForeachIfsToEarlyContinueRector::class,
ChangeIfElseValueAssignToEarlyReturnRector::class,
RemoveAlwaysElseRector::class,
MakeTypedPropertyNullableIfCheckedRector::class,
AddArrayParamDocTypeRector::class,
AddArrayReturnDocTypeRector::class,
AddMethodCallBasedStrictParamTypeRector::class,
ParamTypeByMethodCallTypeRector::class,
ParamTypeByParentCallTypeRector::class,
AddClosureReturnTypeRector::class,
TypedPropertyFromAssignsRector::class,
]);
};

View File

@ -1,68 +1,68 @@
<?php <?php declare(strict_types=1);
return [ return [
'' => '', '' => '',
'4x4' => '4x4cm', '4x4' => '4x4cm',
'6x4.5' => '6x4.5cm', '6x4.5' => '6x4.5cm',
'6x6' => '6x6cm', '6x6' => '6x6cm',
'35mm' => '35mm', '35mm' => '35mm',
'110' => '110', '110' => '110',
'120' => '120', '120' => '120',
'127' => '127', '127' => '127',
'620' => '620', '620' => '620',
'Aperture blades' => '# of Aperture Blades', 'Aperture blades' => '# of Aperture Blades',
'APS-C' => 'APS-C', 'APS-C' => 'APS-C',
'B & W' => 'B & W', 'B & W' => 'B & W',
'Batteries' => 'Batteries', 'Batteries' => 'Batteries',
'Battery type' => 'Battery Type', 'Battery type' => 'Battery Type',
'Brand' => 'Brand', 'Brand' => 'Brand',
'C-41' => 'C-41', 'C-41' => 'C-41',
'Cellulose Triacetate' => 'Cellulose Triacetate', 'Cellulose Triacetate' => 'Cellulose Triacetate',
'Chemistry' => 'Film Chemistry', 'Chemistry' => 'Film Chemistry',
'Coatings' => 'Coatings', 'Coatings' => 'Coatings',
'Crop factor' => 'Crop Factor', 'Crop factor' => 'Crop Factor',
'Description' => 'Description', 'Description' => 'Description',
'Design elements' => '# of Design Elements', 'Design elements' => '# of Design Elements',
'Design groups' => '# of Design Groups', 'Design groups' => '# of Design Groups',
'Developed rolls' => '# of Developed Rolls', 'Developed rolls' => '# of Developed Rolls',
'E-6' => 'E-6', 'E-6' => 'E-6',
'Film alias' => 'Film Alias', 'Film alias' => 'Film Alias',
'Film base' => 'Film Base', 'Film base' => 'Film Base',
'Film format' => 'Film Format', 'Film format' => 'Film Format',
'Film name' => 'Film Name', 'Film name' => 'Film Name',
'Film speed asa' => 'Film Speed (ASA)', 'Film speed asa' => 'Film Speed (ASA)',
'Film speed din' => 'Film Speed (DIN)', 'Film speed din' => 'Film Speed (DIN)',
'Formerly owned' => 'Formerly Owned', 'Formerly owned' => 'Formerly Owned',
'Front filter size' => 'Front filter size (mm)', 'Front filter size' => 'Front filter size (mm)',
'Guide number' => 'Guide Number', 'Guide number' => 'Guide Number',
'Image size' => 'Image Size', 'Image size' => 'Image Size',
'Is auto flash' => 'Is auto flash', 'Is auto flash' => 'Is auto flash',
'Is digital' => 'Is Digital', 'Is digital' => 'Is Digital',
'Is p ttl' => 'Is P-TTL', 'Is p ttl' => 'Is P-TTL',
'Is teleconverter' => 'Is teleconverter', 'Is teleconverter' => 'Is teleconverter',
'Is ttl' => 'Is TTL', 'Is ttl' => 'Is TTL',
'Is working' => 'Is Working', 'Is working' => 'Is Working',
'Max f stop' => 'Max aperture (smallest f number)', 'Max f stop' => 'Max aperture (smallest f number)',
'Max focal length' => 'Max focal length (mm)', 'Max focal length' => 'Max focal length (mm)',
'Medium Format' => 'Medium Format', 'Medium Format' => 'Medium Format',
'Micro 4/3' => 'μ 4/3', 'Micro 4/3' => 'μ 4/3',
'Min f stop' => 'Min aperture (largest f number)', 'Min f stop' => 'Min aperture (largest f number)',
'Min focal length' => 'Min focal length (mm)', 'Min focal length' => 'Min focal length (mm)',
'Model' => 'Model', 'Model' => 'Model',
'Mount' => 'Mount', 'Mount' => 'Mount',
'Notes' => 'Notes', 'Notes' => 'Notes',
'Other' => 'Other', 'Other' => 'Other',
'P ttl type' => 'P-TTL Type', 'P ttl type' => 'P-TTL Type',
'Polyester' => 'Polyester', 'Polyester' => 'Polyester',
'Polyethylene Naphtalate' => 'Polyethylene Naphtalate', 'Polyethylene Naphtalate' => 'Polyethylene Naphtalate',
'Product line' => 'Product Line', 'Product line' => 'Product Line',
'Purchase price' => 'Purchase Price', 'Purchase price' => 'Purchase Price',
'Rear filter size' => 'Rear filter size (mm)', 'Rear filter size' => 'Rear filter size (mm)',
'Received' => 'Received', 'Received' => 'Received',
'Rolls in camera' => '# of Rolls in a Camera', 'Rolls in camera' => '# of Rolls in a Camera',
'Serial' => 'Serial', 'Serial' => 'Serial',
'Small Format' => 'Small Format', 'Small Format' => 'Small Format',
'Ttl type' => 'TTL Type', 'Ttl type' => 'TTL Type',
'Type' => 'Type', 'Type' => 'Type',
'Unused rolls' => '# of Unused Rolls', 'Unused rolls' => '# of Unused Rolls',
]; ];

View File

@ -1,97 +1,97 @@
<?php <?php declare(strict_types=1);
return [ return [
'This value should be false.' => 'This value should be false.', 'This value should be false.' => 'This value should be false.',
'This value should be true.' => 'This value should be true.', 'This value should be true.' => 'This value should be true.',
'This value should be of type {{ type }}.' => 'This value should be of type {{ type }}.', 'This value should be of type {{ type }}.' => 'This value should be of type {{ type }}.',
'This value should be blank.' => 'This value should be blank.', 'This value should be blank.' => 'This value should be blank.',
'The value you selected is not a valid choice.' => 'The value you selected is not a valid choice.', 'The value you selected is not a valid choice.' => 'The value you selected is not a valid choice.',
'You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices.' => 'You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices.', 'You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices.' => 'You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices.',
'You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices.' => 'You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices.', 'You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices.' => 'You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices.',
'One or more of the given values is invalid.' => 'One or more of the given values is invalid.', 'One or more of the given values is invalid.' => 'One or more of the given values is invalid.',
'This field was not expected.' => 'This field was not expected.', 'This field was not expected.' => 'This field was not expected.',
'This field is missing.' => 'This field is missing.', 'This field is missing.' => 'This field is missing.',
'This value is not a valid date.' => 'This value is not a valid date.', 'This value is not a valid date.' => 'This value is not a valid date.',
'This value is not a valid datetime.' => 'This value is not a valid datetime.', 'This value is not a valid datetime.' => 'This value is not a valid datetime.',
'This value is not a valid email address.' => 'This value is not a valid email address.', 'This value is not a valid email address.' => 'This value is not a valid email address.',
'The file could not be found.' => 'The file could not be found.', 'The file could not be found.' => 'The file could not be found.',
'The file is not readable.' => 'The file is not readable.', 'The file is not readable.' => 'The file is not readable.',
'The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}.' => 'The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}.', 'The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}.' => 'The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}.',
'The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}.' => 'The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}.', 'The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}.' => 'The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}.',
'This value should be {{ limit }} or less.' => 'This value should be {{ limit }} or less.', 'This value should be {{ limit }} or less.' => 'This value should be {{ limit }} or less.',
'This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less.' => 'This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less.', 'This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less.' => 'This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less.',
'This value should be {{ limit }} or more.' => 'This value should be {{ limit }} or more.', 'This value should be {{ limit }} or more.' => 'This value should be {{ limit }} or more.',
'This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more.' => 'This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more.', 'This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more.' => 'This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more.',
'This value should not be blank.' => 'This value should not be blank.', 'This value should not be blank.' => 'This value should not be blank.',
'This value should not be null.' => 'This value should not be null.', 'This value should not be null.' => 'This value should not be null.',
'This value should be null.' => 'This value should be null.', 'This value should be null.' => 'This value should be null.',
'This value is not valid.' => 'This value is not valid.', 'This value is not valid.' => 'This value is not valid.',
'This value is not a valid time.' => 'This value is not a valid time.', 'This value is not a valid time.' => 'This value is not a valid time.',
'This value is not a valid URL.' => 'This value is not a valid URL.', 'This value is not a valid URL.' => 'This value is not a valid URL.',
'The two values should be equal.' => 'The two values should be equal.', 'The two values should be equal.' => 'The two values should be equal.',
'The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}.' => 'The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}.', 'The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}.' => 'The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}.',
'The file is too large.' => 'The file is too large.', 'The file is too large.' => 'The file is too large.',
'The file could not be uploaded.' => 'The file could not be uploaded.', 'The file could not be uploaded.' => 'The file could not be uploaded.',
'This value should be a valid number.' => 'This value should be a valid number.', 'This value should be a valid number.' => 'This value should be a valid number.',
'This file is not a valid image.' => 'This file is not a valid image.', 'This file is not a valid image.' => 'This file is not a valid image.',
'This is not a valid IP address.' => 'This is not a valid IP address.', 'This is not a valid IP address.' => 'This is not a valid IP address.',
'This value is not a valid language.' => 'This value is not a valid language.', 'This value is not a valid language.' => 'This value is not a valid language.',
'This value is not a valid locale.' => 'This value is not a valid locale.', 'This value is not a valid locale.' => 'This value is not a valid locale.',
'This value is not a valid country.' => 'This value is not a valid country.', 'This value is not a valid country.' => 'This value is not a valid country.',
'This value is already used.' => 'This value is already used.', 'This value is already used.' => 'This value is already used.',
'The size of the image could not be detected.' => 'The size of the image could not be detected.', 'The size of the image could not be detected.' => 'The size of the image could not be detected.',
'The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px.' => 'The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px.', 'The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px.' => 'The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px.',
'The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px.' => 'The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px.', 'The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px.' => 'The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px.',
'The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px.' => 'The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px.', 'The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px.' => 'The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px.',
'The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px.' => 'The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px.', 'The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px.' => 'The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px.',
'This value should be the user\'s current password.' => 'This value should be the user\'s current password.', 'This value should be the user\'s current password.' => 'This value should be the user\'s current password.',
'This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters.' => 'This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters.', 'This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters.' => 'This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters.',
'The file was only partially uploaded.' => 'The file was only partially uploaded.', 'The file was only partially uploaded.' => 'The file was only partially uploaded.',
'No file was uploaded.' => 'No file was uploaded.', 'No file was uploaded.' => 'No file was uploaded.',
'No temporary folder was configured in php.ini.' => 'No temporary folder was configured in php.ini, or the configured folder does not exist.', 'No temporary folder was configured in php.ini.' => 'No temporary folder was configured in php.ini, or the configured folder does not exist.',
'Cannot write temporary file to disk.' => 'Cannot write temporary file to disk.', 'Cannot write temporary file to disk.' => 'Cannot write temporary file to disk.',
'A PHP extension caused the upload to fail.' => 'A PHP extension caused the upload to fail.', 'A PHP extension caused the upload to fail.' => 'A PHP extension caused the upload to fail.',
'This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more.' => 'This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more.', 'This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more.' => 'This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more.',
'This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less.' => 'This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less.', 'This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less.' => 'This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less.',
'This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements.' => 'This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements.', 'This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements.' => 'This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements.',
'Invalid card number.' => 'Invalid card number.', 'Invalid card number.' => 'Invalid card number.',
'Unsupported card type or invalid card number.' => 'Unsupported card type or invalid card number.', 'Unsupported card type or invalid card number.' => 'Unsupported card type or invalid card number.',
'This is not a valid International Bank Account Number (IBAN).' => 'This is not a valid International Bank Account Number (IBAN).', 'This is not a valid International Bank Account Number (IBAN).' => 'This is not a valid International Bank Account Number (IBAN).',
'This value is not a valid ISBN-10.' => 'This value is not a valid ISBN-10.', 'This value is not a valid ISBN-10.' => 'This value is not a valid ISBN-10.',
'This value is not a valid ISBN-13.' => 'This value is not a valid ISBN-13.', 'This value is not a valid ISBN-13.' => 'This value is not a valid ISBN-13.',
'This value is neither a valid ISBN-10 nor a valid ISBN-13.' => 'This value is neither a valid ISBN-10 nor a valid ISBN-13.', 'This value is neither a valid ISBN-10 nor a valid ISBN-13.' => 'This value is neither a valid ISBN-10 nor a valid ISBN-13.',
'This value is not a valid ISSN.' => 'This value is not a valid ISSN.', 'This value is not a valid ISSN.' => 'This value is not a valid ISSN.',
'This value is not a valid currency.' => 'This value is not a valid currency.', 'This value is not a valid currency.' => 'This value is not a valid currency.',
'This value should be equal to {{ compared_value }}.' => 'This value should be equal to {{ compared_value }}.', 'This value should be equal to {{ compared_value }}.' => 'This value should be equal to {{ compared_value }}.',
'This value should be greater than {{ compared_value }}.' => 'This value should be greater than {{ compared_value }}.', 'This value should be greater than {{ compared_value }}.' => 'This value should be greater than {{ compared_value }}.',
'This value should be greater than or equal to {{ compared_value }}.' => 'This value should be greater than or equal to {{ compared_value }}.', 'This value should be greater than or equal to {{ compared_value }}.' => 'This value should be greater than or equal to {{ compared_value }}.',
'This value should be identical to {{ compared_value_type }} {{ compared_value }}.' => 'This value should be identical to {{ compared_value_type }} {{ compared_value }}.', 'This value should be identical to {{ compared_value_type }} {{ compared_value }}.' => 'This value should be identical to {{ compared_value_type }} {{ compared_value }}.',
'This value should be less than {{ compared_value }}.' => 'This value should be less than {{ compared_value }}.', 'This value should be less than {{ compared_value }}.' => 'This value should be less than {{ compared_value }}.',
'This value should be less than or equal to {{ compared_value }}.' => 'This value should be less than or equal to {{ compared_value }}.', 'This value should be less than or equal to {{ compared_value }}.' => 'This value should be less than or equal to {{ compared_value }}.',
'This value should not be equal to {{ compared_value }}.' => 'This value should not be equal to {{ compared_value }}.', 'This value should not be equal to {{ compared_value }}.' => 'This value should not be equal to {{ compared_value }}.',
'This value should not be identical to {{ compared_value_type }} {{ compared_value }}.' => 'This value should not be identical to {{ compared_value_type }} {{ compared_value }}.', 'This value should not be identical to {{ compared_value_type }} {{ compared_value }}.' => 'This value should not be identical to {{ compared_value_type }} {{ compared_value }}.',
'The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}.' => 'The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}.', 'The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}.' => 'The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}.',
'The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}.' => 'The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}.', 'The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}.' => 'The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}.',
'The image is square ({{ width }}x{{ height }}px). Square images are not allowed.' => 'The image is square ({{ width }}x{{ height }}px). Square images are not allowed.', 'The image is square ({{ width }}x{{ height }}px). Square images are not allowed.' => 'The image is square ({{ width }}x{{ height }}px). Square images are not allowed.',
'The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed.' => 'The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed.', 'The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed.' => 'The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed.',
'The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed.' => 'The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed.', 'The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed.' => 'The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed.',
'An empty file is not allowed.' => 'An empty file is not allowed.', 'An empty file is not allowed.' => 'An empty file is not allowed.',
'The host could not be resolved.' => 'The host could not be resolved.', 'The host could not be resolved.' => 'The host could not be resolved.',
'This value does not match the expected {{ charset }} charset.' => 'This value does not match the expected {{ charset }} charset.', 'This value does not match the expected {{ charset }} charset.' => 'This value does not match the expected {{ charset }} charset.',
'This is not a valid Business Identifier Code (BIC).' => 'This is not a valid Business Identifier Code (BIC).', 'This is not a valid Business Identifier Code (BIC).' => 'This is not a valid Business Identifier Code (BIC).',
'Error' => 'Error', 'Error' => 'Error',
'This is not a valid UUID.' => 'This is not a valid UUID.', 'This is not a valid UUID.' => 'This is not a valid UUID.',
'This value should be a multiple of {{ compared_value }}.' => 'This value should be a multiple of {{ compared_value }}.', 'This value should be a multiple of {{ compared_value }}.' => 'This value should be a multiple of {{ compared_value }}.',
'This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.' => 'This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.', 'This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.' => 'This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.',
'This value should be valid JSON.' => 'This value should be valid JSON.', 'This value should be valid JSON.' => 'This value should be valid JSON.',
'This collection should contain only unique elements.' => 'This collection should contain only unique elements.', 'This collection should contain only unique elements.' => 'This collection should contain only unique elements.',
'This value should be positive.' => 'This value should be positive.', 'This value should be positive.' => 'This value should be positive.',
'This value should be either positive or zero.' => 'This value should be either positive or zero.', 'This value should be either positive or zero.' => 'This value should be either positive or zero.',
'This value should be negative.' => 'This value should be negative.', 'This value should be negative.' => 'This value should be negative.',
'This value should be either negative or zero.' => 'This value should be either negative or zero.', 'This value should be either negative or zero.' => 'This value should be either negative or zero.',
'This value is not a valid timezone.' => 'This value is not a valid timezone.', 'This value is not a valid timezone.' => 'This value is not a valid timezone.',
'This password has been leaked in a data breach, it must not be used. Please use another password.' => 'This password has been leaked in a data breach, it must not be used. Please use another password.', 'This password has been leaked in a data breach, it must not be used. Please use another password.' => 'This password has been leaked in a data breach, it must not be used. Please use another password.',
'This form should not contain extra fields.' => 'This form should not contain extra fields.', 'This form should not contain extra fields.' => 'This form should not contain extra fields.',
'The uploaded file was too large. Please try to upload a smaller file.' => 'The uploaded file was too large. Please try to upload a smaller file.', 'The uploaded file was too large. Please try to upload a smaller file.' => 'The uploaded file was too large. Please try to upload a smaller file.',
'The CSRF token is invalid. Please try to resubmit the form.' => 'The CSRF token is invalid. Please try to resubmit the form.', 'The CSRF token is invalid. Please try to resubmit the form.' => 'The CSRF token is invalid. Please try to resubmit the form.',
]; ];