From 81e471a76062b1f4464c38db1dbfe8bc09a95f51 Mon Sep 17 00:00:00 2001 From: Marijn Doeve Date: Sun, 28 Sep 2025 18:14:58 +0200 Subject: [PATCH] Change namespace to Tvdt --- .devcontainer/devcontainer.json | 6 -- .editorconfig | 3 + .env.test | 2 +- .idea/TijdVoorDeTest.iml | 4 +- bin/console | 2 +- composer.json | 4 +- config/packages/asset_mapper.yaml | 22 ++-- config/packages/doctrine.yaml | 98 ++++++++--------- config/packages/doctrine_migrations.yaml | 10 +- config/packages/framework.yaml | 36 +++---- config/packages/mailer.yaml | 12 +-- config/packages/routing.yaml | 14 +-- config/packages/security.yaml | 100 +++++++++--------- config/packages/sentry.yaml | 24 ++--- config/packages/translation.yaml | 12 +-- config/packages/twig.yaml | 8 +- config/packages/twig_component.yaml | 8 +- config/packages/uid.yaml | 6 +- config/packages/validator.yaml | 16 +-- config/packages/web_profiler.yaml | 28 ++--- config/routes.yaml | 8 +- config/routes/attributes.yaml | 4 +- config/routes/easyadmin.yaml | 4 +- config/routes/framework.yaml | 6 +- config/routes/security.yaml | 4 +- config/routes/web_profiler.yaml | 14 +-- config/services.yaml | 32 +++--- public/index.php | 2 +- src/Command/AddSettingsCommand.php | 8 +- src/Command/ClaimSeasonCommand.php | 8 +- src/Command/MakeAdminCommand.php | 6 +- src/Controller/AbstractController.php | 4 +- src/Controller/Admin/AnswerCrudController.php | 4 +- .../Admin/CandidateCrudController.php | 4 +- src/Controller/Admin/DashboardController.php | 18 ++-- .../Admin/GivenAnswerCrudController.php | 4 +- .../Admin/QuestionCrudController.php | 4 +- .../Admin/QuizCorrectionCrudController.php | 4 +- src/Controller/Admin/QuizCrudController.php | 4 +- src/Controller/Admin/SeasonCrudController.php | 4 +- src/Controller/Admin/UserCrudController.php | 4 +- .../Backoffice/BackofficeController.php | 22 ++-- .../PrepareEliminationController.php | 20 ++-- src/Controller/Backoffice/QuizController.php | 40 +++---- .../Backoffice/SeasonController.php | 32 +++--- src/Controller/EliminationController.php | 26 ++--- src/Controller/LoginController.php | 8 +- src/Controller/QuizController.php | 54 +++++----- src/Controller/RegistrationController.php | 24 ++--- src/DataFixtures/KrtekFixtures.php | 12 +-- src/Entity/Answer.php | 4 +- src/Entity/Candidate.php | 6 +- src/Entity/Elimination.php | 4 +- src/Entity/GivenAnswer.php | 4 +- src/Entity/Question.php | 4 +- src/Entity/Quiz.php | 4 +- src/Entity/QuizCandidate.php | 4 +- src/Entity/Season.php | 4 +- src/Entity/SeasonSettings.php | 4 +- src/Entity/User.php | 4 +- src/Enum/FlashType.php | 2 +- src/Exception/ErrorClearingQuizException.php | 2 +- src/Exception/SpreadsheetDataException.php | 2 +- src/Exception/SpreadsheetException.php | 2 +- src/Factory/EliminationFactory.php | 8 +- src/Form/AddCandidatesFormType.php | 2 +- src/Form/CreateSeasonFormType.php | 4 +- src/Form/EliminationEnterNameType.php | 2 +- src/Form/EnterNameType.php | 2 +- src/Form/RegistrationFormType.php | 4 +- src/Form/SelectSeasonType.php | 2 +- src/Form/SettingsForm.php | 4 +- src/Form/UploadQuizFormType.php | 4 +- src/Helpers/Base64.php | 2 +- src/Kernel.php | 2 +- src/Repository/AnswerRepository.php | 4 +- src/Repository/CandidateRepository.php | 14 +-- src/Repository/EliminationRepository.php | 4 +- src/Repository/GivenAnswerRepository.php | 4 +- src/Repository/QuestionRepository.php | 10 +- src/Repository/QuizCandidateRepository.php | 8 +- src/Repository/QuizRepository.php | 12 +-- src/Repository/SeasonRepository.php | 8 +- src/Repository/SeasonSettingsRepository.php | 4 +- src/Repository/UserRepository.php | 4 +- src/Security/EmailVerifier.php | 4 +- src/Security/Voter/SeasonVoter.php | 16 +-- src/Service/EliminationService.php | 4 +- src/Service/QuizSpreadsheetService.php | 10 +- templates/backoffice/index.html.twig | 6 +- templates/backoffice/login/login.html.twig | 4 +- templates/backoffice/nav.html.twig | 10 +- .../prepare_elimination/index.html.twig | 8 +- templates/backoffice/quiz.html.twig | 14 +-- .../registration/register.html.twig | 2 +- templates/backoffice/season.html.twig | 6 +- templates/quiz/select_season.html.twig | 2 +- tests/Security/Voter/SeasonVoterTest.php | 18 ++-- 98 files changed, 531 insertions(+), 534 deletions(-) delete mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json deleted file mode 100644 index 7a75371..0000000 --- a/.devcontainer/devcontainer.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "image": "mcr.microsoft.com/devcontainers/universal:2", - "features": {"ghcr.io/devcontainers/features/php:1": { - "version": "8.3" - }} -} diff --git a/.editorconfig b/.editorconfig index c6937a4..1e53c89 100644 --- a/.editorconfig +++ b/.editorconfig @@ -35,6 +35,9 @@ indent_size = 4 trim_trailing_whitespace = false indent_size = 2 +[config/**/*.{yaml,yml}] +indent_size = 4 + [.github/workflows/*.yml] indent_size = 2 diff --git a/.env.test b/.env.test index 24a43c0..52a25f1 100644 --- a/.env.test +++ b/.env.test @@ -1,4 +1,4 @@ # define your env variables for the test env here -KERNEL_CLASS='App\Kernel' +KERNEL_CLASS='Tvdt\Kernel' APP_SECRET='$ecretf0rt3st' SYMFONY_DEPRECATIONS_HELPER=999999 diff --git a/.idea/TijdVoorDeTest.iml b/.idea/TijdVoorDeTest.iml index 3b16971..264161a 100644 --- a/.idea/TijdVoorDeTest.iml +++ b/.idea/TijdVoorDeTest.iml @@ -2,8 +2,8 @@ - - + + diff --git a/bin/console b/bin/console index f3afd27..839623e 100755 --- a/bin/console +++ b/bin/console @@ -3,7 +3,7 @@ declare(strict_types=1); -use App\Kernel; +use Tvdt\Kernel; use Symfony\Bundle\FrameworkBundle\Console\Application; if (!is_dir(dirname(__DIR__).'/vendor')) { diff --git a/composer.json b/composer.json index 9e0c9d7..f6d27d2 100644 --- a/composer.json +++ b/composer.json @@ -76,12 +76,12 @@ }, "autoload": { "psr-4": { - "App\\": "src/" + "Tvdt\\": "src/" } }, "autoload-dev": { "psr-4": { - "App\\Tests\\": "tests/" + "Tvdt\\Tests\\": "tests/" } }, "replace": { diff --git a/config/packages/asset_mapper.yaml b/config/packages/asset_mapper.yaml index 1c08eb8..5fb548c 100644 --- a/config/packages/asset_mapper.yaml +++ b/config/packages/asset_mapper.yaml @@ -1,15 +1,15 @@ framework: - asset_mapper: - # The paths to make available to the asset mapper. - paths: - - assets/ - excluded_patterns: - - '*/assets/styles/_*.scss' - - '*/assets/styles/**/_*.scss' - missing_import_mode: strict + asset_mapper: + # The paths to make available to the asset mapper. + paths: + - assets/ + excluded_patterns: + - '*/assets/styles/_*.scss' + - '*/assets/styles/**/_*.scss' + missing_import_mode: strict when@prod: - framework: - asset_mapper: - missing_import_mode: warn + framework: + asset_mapper: + missing_import_mode: warn diff --git a/config/packages/doctrine.yaml b/config/packages/doctrine.yaml index 8c34687..58601be 100644 --- a/config/packages/doctrine.yaml +++ b/config/packages/doctrine.yaml @@ -1,54 +1,54 @@ doctrine: - dbal: - url: '%env(resolve:DATABASE_URL)%' - - # IMPORTANT: You MUST configure your server version, - # either here or in the DATABASE_URL env var (see .env file) - #server_version: '16' - - profiling_collect_backtrace: '%kernel.debug%' - use_savepoints: true - orm: - auto_generate_proxy_classes: true - enable_lazy_ghost_objects: true - report_fields_where_declared: true - validate_xml_mapping: true - naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware - identity_generation_preferences: - Doctrine\DBAL\Platforms\PostgreSQLPlatform: identity - auto_mapping: true - mappings: - App: - type: attribute - is_bundle: false - dir: '%kernel.project_dir%/src/Entity' - prefix: 'App\Entity' - alias: App - controller_resolver: - auto_mapping: false + dbal: + url: '%env(resolve:DATABASE_URL)%' + + # IMPORTANT: You MUST configure your server version, + # either here or in the DATABASE_URL env var (see .env file) + #server_version: '16' + + profiling_collect_backtrace: '%kernel.debug%' + use_savepoints: true + orm: + auto_generate_proxy_classes: true + enable_lazy_ghost_objects: true + report_fields_where_declared: true + validate_xml_mapping: true + naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware + identity_generation_preferences: + Doctrine\DBAL\Platforms\PostgreSQLPlatform: identity + auto_mapping: true + mappings: + Tvdt: + type: attribute + is_bundle: false + dir: '%kernel.project_dir%/src/Entity' + prefix: 'Tvdt\Entity' + alias: Tvdt + controller_resolver: + auto_mapping: false when@test: - doctrine: - dbal: - # "TEST_TOKEN" is typically set by ParaTest - dbname_suffix: '_test%env(default::TEST_TOKEN)%' + doctrine: + dbal: + # "TEST_TOKEN" is typically set by ParaTest + dbname_suffix: '_test%env(default::TEST_TOKEN)%' when@prod: - doctrine: - orm: - auto_generate_proxy_classes: false - proxy_dir: '%kernel.build_dir%/doctrine/orm/Proxies' - query_cache_driver: - type: pool - pool: doctrine.system_cache_pool - result_cache_driver: - type: pool - pool: doctrine.result_cache_pool - - framework: - cache: - pools: - doctrine.result_cache_pool: - adapter: cache.app - doctrine.system_cache_pool: - adapter: cache.system + doctrine: + orm: + auto_generate_proxy_classes: false + proxy_dir: '%kernel.build_dir%/doctrine/orm/Proxies' + query_cache_driver: + type: pool + pool: doctrine.system_cache_pool + result_cache_driver: + type: pool + pool: doctrine.result_cache_pool + + framework: + cache: + pools: + doctrine.result_cache_pool: + adapter: cache.app + doctrine.system_cache_pool: + adapter: cache.system diff --git a/config/packages/doctrine_migrations.yaml b/config/packages/doctrine_migrations.yaml index 6b500cb..d7ed38c 100644 --- a/config/packages/doctrine_migrations.yaml +++ b/config/packages/doctrine_migrations.yaml @@ -1,6 +1,6 @@ doctrine_migrations: - migrations_paths: - # namespace is arbitrary but should be different from App\Migrations - # as migrations classes should NOT be autoloaded - 'DoctrineMigrations': '%kernel.project_dir%/migrations' - enable_profiler: false + migrations_paths: + # namespace is arbitrary but should be different from Tvdt\Migrations + # as migrations classes should NOT be autoloaded + 'DoctrineMigrations': '%kernel.project_dir%/migrations' + enable_profiler: false diff --git a/config/packages/framework.yaml b/config/packages/framework.yaml index 74b269a..d9a67d4 100644 --- a/config/packages/framework.yaml +++ b/config/packages/framework.yaml @@ -1,23 +1,23 @@ # see https://symfony.com/doc/current/reference/configuration/framework.html framework: - secret: '%env(APP_SECRET)%' - - # Note that the session will be started ONLY if you read or write from it. - session: true - form: - csrf_protection: - enabled: true - #esi: true - #fragments: true + secret: '%env(APP_SECRET)%' + + # Note that the session will be started ONLY if you read or write from it. + session: true + form: + csrf_protection: + enabled: true + #esi: true + #fragments: true when@prod: - framework: - # shortcut for private IP address ranges of your proxy - trusted_proxies: 'private_ranges' - # or, if your proxy instead uses the "Forwarded" header - trusted_headers: [ 'forwarded' ] + framework: + # shortcut for private IP address ranges of your proxy + trusted_proxies: 'private_ranges' + # or, if your proxy instead uses the "Forwarded" header + trusted_headers: [ 'forwarded' ] when@test: - framework: - test: true - session: - storage_factory_id: session.storage.factory.mock_file + framework: + test: true + session: + storage_factory_id: session.storage.factory.mock_file diff --git a/config/packages/mailer.yaml b/config/packages/mailer.yaml index 4759f62..23a206f 100644 --- a/config/packages/mailer.yaml +++ b/config/packages/mailer.yaml @@ -1,7 +1,7 @@ framework: - mailer: - dsn: '%env(MAILER_DSN)%' - envelope: - sender: '%env(MAILER_SENDER)%' - headers: - From: 'Tijd voor de test <%env(MAILER_SENDER)%>' + mailer: + dsn: '%env(MAILER_DSN)%' + envelope: + sender: '%env(MAILER_SENDER)%' + headers: + From: 'Tijd voor de test <%env(MAILER_SENDER)%>' diff --git a/config/packages/routing.yaml b/config/packages/routing.yaml index 9f82b97..423e6d9 100644 --- a/config/packages/routing.yaml +++ b/config/packages/routing.yaml @@ -1,10 +1,10 @@ framework: - router: - # Configure how to generate URLs in non-HTTP contexts, such as CLI commands. - # See https://symfony.com/doc/current/routing.html#generating-urls-in-commands - #default_uri: http://localhost + router: + # Configure how to generate URLs in non-HTTP contexts, such as CLI commands. + # See https://symfony.com/doc/current/routing.html#generating-urls-in-commands + #default_uri: http://localhost when@prod: - framework: - router: - strict_requirements: null + framework: + router: + strict_requirements: null diff --git a/config/packages/security.yaml b/config/packages/security.yaml index 7f5b574..625c05c 100644 --- a/config/packages/security.yaml +++ b/config/packages/security.yaml @@ -1,53 +1,53 @@ security: - # https://symfony.com/doc/current/security.html#registering-the-user-hashing-passwords - password_hashers: - Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto' - # https://symfony.com/doc/current/security.html#loading-the-user-the-user-provider - providers: - # used to reload user from session & other features (e.g. switch_user) - app_user_provider: - entity: - class: App\Entity\User - property: email - # used to reload user from session & other features (e.g. switch_user) - firewalls: - dev: - pattern: ^/(_(profiler|wdt)|css|images|js)/ - security: false - main: - lazy: true - provider: app_user_provider - form_login: - login_path: app_login_login - check_path: app_login_login - enable_csrf: true - default_target_path: app_backoffice_index - logout: - path: app_login_logout - # where to redirect after logout - # target: app_any_route - - # activate different ways to authenticate - # https://symfony.com/doc/current/security.html#the-firewall - - # https://symfony.com/doc/current/security/impersonating_user.html - # switch_user: true - - # Easy way to control access for large sections of your site - # Note: Only the *first* access control that matches will be used - access_control: - - { path: ^/admin, roles: ROLE_ADMIN } - - { path: ^/backoffice, roles: ROLE_USER } + # https://symfony.com/doc/current/security.html#registering-the-user-hashing-passwords + password_hashers: + Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto' + # https://symfony.com/doc/current/security.html#loading-the-user-the-user-provider + providers: + # used to reload user from session & other features (e.g. switch_user) + tvdt_user_provider: + entity: + class: Tvdt\Entity\User + property: email + # used to reload user from session & other features (e.g. switch_user) + firewalls: + dev: + pattern: ^/(_(profiler|wdt)|css|images|js)/ + security: false + main: + lazy: true + provider: tvdt_user_provider + form_login: + login_path: tvdt_login_login + check_path: tvdt_login_login + enable_csrf: true + default_target_path: tvdt_backoffice_index + logout: + path: tvdt_login_logout + # where to redirect after logout + # target: tvdt_any_route + + # activate different ways to authenticate + # https://symfony.com/doc/current/security.html#the-firewall + + # https://symfony.com/doc/current/security/impersonating_user.html + # switch_user: true + + # Easy way to control access for large sections of your site + # Note: Only the *first* access control that matches will be used + access_control: + - { path: ^/admin, roles: ROLE_ADMIN } + - { path: ^/backoffice, roles: ROLE_USER } when@test: - security: - password_hashers: - # By default, password hashers are resource intensive and take time. This is - # important to generate secure password hashes. In tests however, secure hashes - # are not important, waste resources and increase test times. The following - # reduces the work factor to the lowest possible values. - Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: - algorithm: auto - cost: 4 # Lowest possible value for bcrypt - time_cost: 3 # Lowest possible value for argon - memory_cost: 10 # Lowest possible value for argon + security: + password_hashers: + # By default, password hashers are resource intensive and take time. This is + # important to generate secure password hashes. In tests however, secure hashes + # are not important, waste resources and increase test times. The following + # reduces the work factor to the lowest possible values. + Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: + algorithm: auto + cost: 4 # Lowest possible value for bcrypt + time_cost: 3 # Lowest possible value for argon + memory_cost: 10 # Lowest possible value for argon diff --git a/config/packages/sentry.yaml b/config/packages/sentry.yaml index 1420237..5d398b7 100644 --- a/config/packages/sentry.yaml +++ b/config/packages/sentry.yaml @@ -1,16 +1,16 @@ when@prod: - sentry: - dsn: '%env(SENTRY_DSN)%' - # Add request headers, cookies, IP address and the authenticated user - # see https://docs.sentry.io/platforms/php/data-management/data-collected/ for more info - # send_default_pii: true - - options: - traces_sample_rate: 1.0 - profiles_sample_rate: 1.0 - ignore_exceptions: - - 'Symfony\Component\ErrorHandler\Error\FatalError' - - 'Symfony\Component\Debug\Exception\FatalErrorException' + sentry: + dsn: '%env(SENTRY_DSN)%' + # Add request headers, cookies, IP address and the authenticated user + # see https://docs.sentry.io/platforms/php/data-management/data-collected/ for more info + # send_default_pii: true + + options: + traces_sample_rate: 1.0 + profiles_sample_rate: 1.0 + ignore_exceptions: + - 'Symfony\Component\ErrorHandler\Error\FatalError' + - 'Symfony\Component\Debug\Exception\FatalErrorException' # If you are using Monolog, you also need this additional configuration to log the errors correctly: # https://docs.sentry.io/platforms/php/guides/symfony/#monolog-integration diff --git a/config/packages/translation.yaml b/config/packages/translation.yaml index 94b1c4d..a1df4db 100644 --- a/config/packages/translation.yaml +++ b/config/packages/translation.yaml @@ -1,7 +1,7 @@ framework: - default_locale: nl - translator: - default_path: '%kernel.project_dir%/translations' - fallbacks: - - en - providers: + default_locale: nl + translator: + default_path: '%kernel.project_dir%/translations' + fallbacks: + - en + providers: diff --git a/config/packages/twig.yaml b/config/packages/twig.yaml index f9ebcf0..eb82507 100644 --- a/config/packages/twig.yaml +++ b/config/packages/twig.yaml @@ -1,7 +1,7 @@ twig: - file_name_pattern: '*.twig' - form_themes: [ 'bootstrap_5_layout.html.twig' ] + file_name_pattern: '*.twig' + form_themes: [ 'bootstrap_5_layout.html.twig' ] when@test: - twig: - strict_variables: true + twig: + strict_variables: true diff --git a/config/packages/twig_component.yaml b/config/packages/twig_component.yaml index 1d7b9c4..824390d 100644 --- a/config/packages/twig_component.yaml +++ b/config/packages/twig_component.yaml @@ -1,5 +1,5 @@ twig_component: - anonymous_template_directory: 'components/' - defaults: - # Namespace & directory for components - App\Twig\Components\: 'components/' + anonymous_template_directory: 'components/' + defaults: + # Namespace & directory for components + Tvdt\Twig\Components\: 'components/' diff --git a/config/packages/uid.yaml b/config/packages/uid.yaml index e3f20fa..0152094 100644 --- a/config/packages/uid.yaml +++ b/config/packages/uid.yaml @@ -1,4 +1,4 @@ framework: - uid: - default_uuid_version: 7 - time_based_uuid_version: 7 + uid: + default_uuid_version: 7 + time_based_uuid_version: 7 diff --git a/config/packages/validator.yaml b/config/packages/validator.yaml index d13c8ea..545ecaa 100644 --- a/config/packages/validator.yaml +++ b/config/packages/validator.yaml @@ -1,11 +1,11 @@ framework: - validation: - # Enables validator auto-mapping support. - # For instance, basic validation constraints will be inferred from Doctrine's metadata. - #auto_mapping: - # App\Entity\: [] + validation: + # Enables validator auto-mapping support. + # For instance, basic validation constraints will be inferred from Doctrine's metadata. + #auto_mapping: + # Tvdt\Entity\: [] when@test: - framework: - validation: - not_compromised_password: false + framework: + validation: + not_compromised_password: false diff --git a/config/packages/web_profiler.yaml b/config/packages/web_profiler.yaml index 26a374a..7f32f21 100644 --- a/config/packages/web_profiler.yaml +++ b/config/packages/web_profiler.yaml @@ -1,17 +1,17 @@ when@dev: - web_profiler: - toolbar: true - intercept_redirects: false - - framework: - profiler: - only_exceptions: false - collect_serializer_data: true + web_profiler: + toolbar: true + intercept_redirects: false + + framework: + profiler: + only_exceptions: false + collect_serializer_data: true when@test: - web_profiler: - toolbar: false - intercept_redirects: false - - framework: - profiler: { collect: false } + web_profiler: + toolbar: false + intercept_redirects: false + + framework: + profiler: { collect: false } diff --git a/config/routes.yaml b/config/routes.yaml index 2d0ef99..dfbec3c 100644 --- a/config/routes.yaml +++ b/config/routes.yaml @@ -1,5 +1,5 @@ controllers: - resource: - path: ../src/Controller/ - namespace: App\Controller - type: attribute + resource: + path: ../src/Controller/ + namespace: Tvdt\Controller + type: attribute diff --git a/config/routes/attributes.yaml b/config/routes/attributes.yaml index 718128b..f01054d 100644 --- a/config/routes/attributes.yaml +++ b/config/routes/attributes.yaml @@ -1,9 +1,9 @@ controllers: resource: path: ../../src/Controller/ - namespace: App\Controller + namespace: Tvdt\Controller type: attribute kernel: - resource: App\Kernel + resource: Tvdt\Kernel type: attribute diff --git a/config/routes/easyadmin.yaml b/config/routes/easyadmin.yaml index f409de2..083ca15 100644 --- a/config/routes/easyadmin.yaml +++ b/config/routes/easyadmin.yaml @@ -1,3 +1,3 @@ easyadmin: - resource: . - type: easyadmin.routes + resource: . + type: easyadmin.routes diff --git a/config/routes/framework.yaml b/config/routes/framework.yaml index aa5c3c4..bc1feac 100644 --- a/config/routes/framework.yaml +++ b/config/routes/framework.yaml @@ -1,4 +1,4 @@ when@dev: - _errors: - resource: '@FrameworkBundle/Resources/config/routing/errors.php' - prefix: /_error + _errors: + resource: '@FrameworkBundle/Resources/config/routing/errors.php' + prefix: /_error diff --git a/config/routes/security.yaml b/config/routes/security.yaml index 3cb5ef0..f853be1 100644 --- a/config/routes/security.yaml +++ b/config/routes/security.yaml @@ -1,3 +1,3 @@ _security_logout: - resource: security.route_loader.logout - type: service + resource: security.route_loader.logout + type: service diff --git a/config/routes/web_profiler.yaml b/config/routes/web_profiler.yaml index d4787db..73bf949 100644 --- a/config/routes/web_profiler.yaml +++ b/config/routes/web_profiler.yaml @@ -1,8 +1,8 @@ when@dev: - web_profiler_wdt: - resource: '@WebProfilerBundle/Resources/config/routing/wdt.php' - prefix: /_wdt - - web_profiler_profiler: - resource: '@WebProfilerBundle/Resources/config/routing/profiler.php' - prefix: /_profiler + web_profiler_wdt: + resource: '@WebProfilerBundle/Resources/config/routing/wdt.php' + prefix: /_wdt + + web_profiler_profiler: + resource: '@WebProfilerBundle/Resources/config/routing/profiler.php' + prefix: /_profiler diff --git a/config/services.yaml b/config/services.yaml index ac3863c..42179f2 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -6,19 +6,19 @@ parameters: services: - # default configuration for services in *this* file - _defaults: - autowire: true # Automatically injects dependencies in your services. - autoconfigure: true # Automatically registers your services as commands, event subscribers, etc. - - # makes classes in src/ available to be used as services - # this creates a service per class whose id is the fully-qualified class name - App\: - resource: '../src/' - exclude: - - '../src/DependencyInjection/' - - '../src/Entity/' - - '../src/Kernel.php' - - # add more service definitions when explicit configuration is needed - # please note that last definitions always *replace* previous ones + # default configuration for services in *this* file + _defaults: + autowire: true # Automatically injects dependencies in your services. + autoconfigure: true # Automatically registers your services as commands, event subscribers, etc. + + # makes classes in src/ available to be used as services + # this creates a service per class whose id is the fully-qualified class name + Tvdt\: + resource: '../src/' + exclude: + - '../src/DependencyInjection/' + - '../src/Entity/' + - '../src/Kernel.php' + + # add more service definitions when explicit configuration is needed + # please note that last definitions always *replace* previous ones diff --git a/public/index.php b/public/index.php index 3555cc2..1a26b7f 100644 --- a/public/index.php +++ b/public/index.php @@ -2,7 +2,7 @@ declare(strict_types=1); -use App\Kernel; +use Tvdt\Kernel; require_once dirname(__DIR__).'/vendor/autoload_runtime.php'; diff --git a/src/Command/AddSettingsCommand.php b/src/Command/AddSettingsCommand.php index 104a0a3..8d85360 100644 --- a/src/Command/AddSettingsCommand.php +++ b/src/Command/AddSettingsCommand.php @@ -2,19 +2,19 @@ declare(strict_types=1); -namespace App\Command; +namespace Tvdt\Command; -use App\Entity\SeasonSettings; -use App\Repository\SeasonRepository; use Doctrine\ORM\EntityManagerInterface; use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; +use Tvdt\Entity\SeasonSettings; +use Tvdt\Repository\SeasonRepository; #[AsCommand( - name: 'app:add-settings', + name: 'tvdt:add-settings', description: 'Add a short description for your command', )] readonly class AddSettingsCommand diff --git a/src/Command/ClaimSeasonCommand.php b/src/Command/ClaimSeasonCommand.php index 5f151d5..42a8897 100644 --- a/src/Command/ClaimSeasonCommand.php +++ b/src/Command/ClaimSeasonCommand.php @@ -2,10 +2,8 @@ declare(strict_types=1); -namespace App\Command; +namespace Tvdt\Command; -use App\Repository\SeasonRepository; -use App\Repository\UserRepository; use Doctrine\ORM\EntityManagerInterface; use Symfony\Component\Console\Attribute\Argument; use Symfony\Component\Console\Attribute\AsCommand; @@ -13,9 +11,11 @@ use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; +use Tvdt\Repository\SeasonRepository; +use Tvdt\Repository\UserRepository; #[AsCommand( - name: 'app:claim-season', + name: 'tvdt:claim-season', description: 'Give a user owner rights on a season', )] readonly class ClaimSeasonCommand diff --git a/src/Command/MakeAdminCommand.php b/src/Command/MakeAdminCommand.php index 74036d4..ca66b67 100644 --- a/src/Command/MakeAdminCommand.php +++ b/src/Command/MakeAdminCommand.php @@ -2,18 +2,18 @@ declare(strict_types=1); -namespace App\Command; +namespace Tvdt\Command; -use App\Repository\UserRepository; use Symfony\Component\Console\Attribute\Argument; use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; +use Tvdt\Repository\UserRepository; #[AsCommand( - name: 'app:make-admin', + name: 'tvdt:make-admin', description: 'Give a user the role admin', )] readonly class MakeAdminCommand diff --git a/src/Controller/AbstractController.php b/src/Controller/AbstractController.php index 417a4b0..d59329f 100644 --- a/src/Controller/AbstractController.php +++ b/src/Controller/AbstractController.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace App\Controller; +namespace Tvdt\Controller; -use App\Enum\FlashType; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController as AbstractBaseController; +use Tvdt\Enum\FlashType; abstract class AbstractController extends AbstractBaseController { diff --git a/src/Controller/Admin/AnswerCrudController.php b/src/Controller/Admin/AnswerCrudController.php index 1d2f683..a21d6d6 100644 --- a/src/Controller/Admin/AnswerCrudController.php +++ b/src/Controller/Admin/AnswerCrudController.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace App\Controller\Admin; +namespace Tvdt\Controller\Admin; -use App\Entity\Answer; use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController; +use Tvdt\Entity\Answer; /** @extends AbstractCrudController */ class AnswerCrudController extends AbstractCrudController diff --git a/src/Controller/Admin/CandidateCrudController.php b/src/Controller/Admin/CandidateCrudController.php index 9d4dfbe..8e0b860 100644 --- a/src/Controller/Admin/CandidateCrudController.php +++ b/src/Controller/Admin/CandidateCrudController.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace App\Controller\Admin; +namespace Tvdt\Controller\Admin; -use App\Entity\Candidate; use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController; +use Tvdt\Entity\Candidate; /** @extends AbstractCrudController */ class CandidateCrudController extends AbstractCrudController diff --git a/src/Controller/Admin/DashboardController.php b/src/Controller/Admin/DashboardController.php index 97bb080..9561e32 100644 --- a/src/Controller/Admin/DashboardController.php +++ b/src/Controller/Admin/DashboardController.php @@ -2,22 +2,22 @@ declare(strict_types=1); -namespace App\Controller\Admin; +namespace Tvdt\Controller\Admin; -use App\Entity\Answer; -use App\Entity\Candidate; -use App\Entity\GivenAnswer; -use App\Entity\Question; -use App\Entity\Quiz; -use App\Entity\QuizCandidate; -use App\Entity\Season; -use App\Entity\User; use EasyCorp\Bundle\EasyAdminBundle\Attribute\AdminDashboard; use EasyCorp\Bundle\EasyAdminBundle\Config\Dashboard; use EasyCorp\Bundle\EasyAdminBundle\Config\MenuItem; use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractDashboardController; use EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator; use Symfony\Component\HttpFoundation\Response; +use Tvdt\Entity\Answer; +use Tvdt\Entity\Candidate; +use Tvdt\Entity\GivenAnswer; +use Tvdt\Entity\Question; +use Tvdt\Entity\Quiz; +use Tvdt\Entity\QuizCandidate; +use Tvdt\Entity\Season; +use Tvdt\Entity\User; #[AdminDashboard(routePath: '/admin', routeName: 'admin')] class DashboardController extends AbstractDashboardController diff --git a/src/Controller/Admin/GivenAnswerCrudController.php b/src/Controller/Admin/GivenAnswerCrudController.php index c7b1357..08eb451 100644 --- a/src/Controller/Admin/GivenAnswerCrudController.php +++ b/src/Controller/Admin/GivenAnswerCrudController.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace App\Controller\Admin; +namespace Tvdt\Controller\Admin; -use App\Entity\GivenAnswer; use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController; +use Tvdt\Entity\GivenAnswer; /** @extends AbstractCrudController */ class GivenAnswerCrudController extends AbstractCrudController diff --git a/src/Controller/Admin/QuestionCrudController.php b/src/Controller/Admin/QuestionCrudController.php index 374a82e..74ac70c 100644 --- a/src/Controller/Admin/QuestionCrudController.php +++ b/src/Controller/Admin/QuestionCrudController.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace App\Controller\Admin; +namespace Tvdt\Controller\Admin; -use App\Entity\Question; use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController; +use Tvdt\Entity\Question; /** @extends AbstractCrudController */ class QuestionCrudController extends AbstractCrudController diff --git a/src/Controller/Admin/QuizCorrectionCrudController.php b/src/Controller/Admin/QuizCorrectionCrudController.php index 0166920..313f4fb 100644 --- a/src/Controller/Admin/QuizCorrectionCrudController.php +++ b/src/Controller/Admin/QuizCorrectionCrudController.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace App\Controller\Admin; +namespace Tvdt\Controller\Admin; -use App\Entity\QuizCandidate; use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController; +use Tvdt\Entity\QuizCandidate; /** @extends AbstractCrudController */ class QuizCorrectionCrudController extends AbstractCrudController diff --git a/src/Controller/Admin/QuizCrudController.php b/src/Controller/Admin/QuizCrudController.php index f8f5cbb..61c8839 100644 --- a/src/Controller/Admin/QuizCrudController.php +++ b/src/Controller/Admin/QuizCrudController.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace App\Controller\Admin; +namespace Tvdt\Controller\Admin; -use App\Entity\Quiz; use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController; +use Tvdt\Entity\Quiz; /** @extends AbstractCrudController */ class QuizCrudController extends AbstractCrudController diff --git a/src/Controller/Admin/SeasonCrudController.php b/src/Controller/Admin/SeasonCrudController.php index 6ff16a1..dc07a4f 100644 --- a/src/Controller/Admin/SeasonCrudController.php +++ b/src/Controller/Admin/SeasonCrudController.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace App\Controller\Admin; +namespace Tvdt\Controller\Admin; -use App\Entity\Season; use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController; +use Tvdt\Entity\Season; /** @extends AbstractCrudController */ class SeasonCrudController extends AbstractCrudController diff --git a/src/Controller/Admin/UserCrudController.php b/src/Controller/Admin/UserCrudController.php index 7e868d0..e135072 100644 --- a/src/Controller/Admin/UserCrudController.php +++ b/src/Controller/Admin/UserCrudController.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace App\Controller\Admin; +namespace Tvdt\Controller\Admin; -use App\Entity\User; use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController; +use Tvdt\Entity\User; /** @extends AbstractCrudController */ class UserCrudController extends AbstractCrudController diff --git a/src/Controller/Backoffice/BackofficeController.php b/src/Controller/Backoffice/BackofficeController.php index 3521714..0fc7ffc 100644 --- a/src/Controller/Backoffice/BackofficeController.php +++ b/src/Controller/Backoffice/BackofficeController.php @@ -2,14 +2,8 @@ declare(strict_types=1); -namespace App\Controller\Backoffice; +namespace Tvdt\Controller\Backoffice; -use App\Controller\AbstractController; -use App\Entity\Season; -use App\Entity\User; -use App\Form\CreateSeasonFormType; -use App\Repository\SeasonRepository; -use App\Service\QuizSpreadsheetService; use Doctrine\ORM\EntityManagerInterface; use Symfony\Bundle\SecurityBundle\Security; use Symfony\Component\HttpFoundation\Request; @@ -18,6 +12,12 @@ use Symfony\Component\HttpFoundation\StreamedResponse; use Symfony\Component\HttpKernel\Attribute\AsController; use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Security\Http\Attribute\IsGranted; +use Tvdt\Controller\AbstractController; +use Tvdt\Entity\Season; +use Tvdt\Entity\User; +use Tvdt\Form\CreateSeasonFormType; +use Tvdt\Repository\SeasonRepository; +use Tvdt\Service\QuizSpreadsheetService; #[AsController] #[IsGranted('ROLE_USER')] @@ -28,7 +28,7 @@ final class BackofficeController extends AbstractController private readonly Security $security, ) {} - #[Route('/backoffice/', name: 'app_backoffice_index')] + #[Route('/backoffice/', name: 'tvdt_backoffice_index')] public function index(): Response { $user = $this->getUser(); @@ -43,7 +43,7 @@ final class BackofficeController extends AbstractController ]); } - #[Route('/backoffice/season/add', name: 'app_backoffice_season_add', priority: 10)] + #[Route('/backoffice/season/add', name: 'tvdt_backoffice_season_add', priority: 10)] public function addSeason(Request $request, EntityManagerInterface $em): Response { $season = new Season(); @@ -61,13 +61,13 @@ final class BackofficeController extends AbstractController $em->persist($season); $em->flush(); - return $this->redirectToRoute('app_backoffice_season', ['seasonCode' => $season->getSeasonCode()]); + return $this->redirectToRoute('tvdt_backoffice_season', ['seasonCode' => $season->getSeasonCode()]); } return $this->render('backoffice/season_add.html.twig', ['form' => $form]); } - #[Route('/backoffice/template', name: 'app_backoffice_template', priority: 10)] + #[Route('/backoffice/template', name: 'tvdt_backoffice_template', priority: 10)] public function getTemplate(QuizSpreadsheetService $excel): Response { $response = new StreamedResponse($excel->generateTemplate()); diff --git a/src/Controller/Backoffice/PrepareEliminationController.php b/src/Controller/Backoffice/PrepareEliminationController.php index f9847e6..90a4af1 100644 --- a/src/Controller/Backoffice/PrepareEliminationController.php +++ b/src/Controller/Backoffice/PrepareEliminationController.php @@ -2,36 +2,36 @@ declare(strict_types=1); -namespace App\Controller\Backoffice; +namespace Tvdt\Controller\Backoffice; -use App\Controller\AbstractController; -use App\Entity\Elimination; -use App\Entity\Quiz; -use App\Entity\Season; -use App\Factory\EliminationFactory; use Doctrine\ORM\EntityManagerInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Routing\Requirement\Requirement; +use Tvdt\Controller\AbstractController; +use Tvdt\Entity\Elimination; +use Tvdt\Entity\Quiz; +use Tvdt\Entity\Season; +use Tvdt\Factory\EliminationFactory; final class PrepareEliminationController extends AbstractController { #[Route( '/backoffice/season/{seasonCode:season}/quiz/{quiz}/elimination/prepare', - name: 'app_prepare_elimination', + name: 'tvdt_prepare_elimination', requirements: ['seasonCode' => self::SEASON_CODE_REGEX, 'quiz' => Requirement::UUID], )] public function index(Season $season, Quiz $quiz, EliminationFactory $eliminationFactory): Response { $elimination = $eliminationFactory->createEliminationFromQuiz($quiz); - return $this->redirectToRoute('app_prepare_elimination_view', ['elimination' => $elimination->getId()]); + return $this->redirectToRoute('tvdt_prepare_elimination_view', ['elimination' => $elimination->getId()]); } #[Route( '/backoffice/elimination/{elimination}', - name: 'app_prepare_elimination_view', + name: 'tvdt_prepare_elimination_view', requirements: ['elimination' => Requirement::UUID], )] public function viewElimination(Elimination $elimination, Request $request, EntityManagerInterface $em): Response @@ -41,7 +41,7 @@ final class PrepareEliminationController extends AbstractController $em->flush(); if ($request->request->getBoolean('start')) { - return $this->redirectToRoute('app_elimination', ['elimination' => $elimination->getId()]); + return $this->redirectToRoute('tvdt_elimination', ['elimination' => $elimination->getId()]); } $this->addFlash('success', 'Elimination updated'); diff --git a/src/Controller/Backoffice/QuizController.php b/src/Controller/Backoffice/QuizController.php index c3bac3b..0bb1e88 100644 --- a/src/Controller/Backoffice/QuizController.php +++ b/src/Controller/Backoffice/QuizController.php @@ -2,17 +2,8 @@ declare(strict_types=1); -namespace App\Controller\Backoffice; +namespace Tvdt\Controller\Backoffice; -use App\Controller\AbstractController; -use App\Entity\Candidate; -use App\Entity\Quiz; -use App\Entity\Season; -use App\Exception\ErrorClearingQuizException; -use App\Repository\CandidateRepository; -use App\Repository\QuizCandidateRepository; -use App\Repository\QuizRepository; -use App\Security\Voter\SeasonVoter; use Doctrine\ORM\EntityManagerInterface; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; @@ -23,6 +14,15 @@ use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Routing\Requirement\Requirement; use Symfony\Component\Security\Http\Attribute\IsGranted; use Symfony\Contracts\Translation\TranslatorInterface; +use Tvdt\Controller\AbstractController; +use Tvdt\Entity\Candidate; +use Tvdt\Entity\Quiz; +use Tvdt\Entity\Season; +use Tvdt\Exception\ErrorClearingQuizException; +use Tvdt\Repository\CandidateRepository; +use Tvdt\Repository\QuizCandidateRepository; +use Tvdt\Repository\QuizRepository; +use Tvdt\Security\Voter\SeasonVoter; #[AsController] #[IsGranted('ROLE_USER')] @@ -35,7 +35,7 @@ class QuizController extends AbstractController #[Route( '/backoffice/season/{seasonCode:season}/quiz/{quiz}', - name: 'app_backoffice_quiz', + name: 'tvdt_backoffice_quiz', requirements: ['seasonCode' => self::SEASON_CODE_REGEX, 'quiz' => Requirement::UUID], )] #[IsGranted(SeasonVoter::EDIT, subject: 'season')] @@ -50,7 +50,7 @@ class QuizController extends AbstractController #[Route( '/backoffice/season/{seasonCode:season}/quiz/{quiz}/enable', - name: 'app_backoffice_enable', + name: 'tvdt_backoffice_enable', requirements: ['seasonCode' => self::SEASON_CODE_REGEX, 'quiz' => Requirement::UUID.'|null'], )] #[IsGranted(SeasonVoter::EDIT, subject: 'season')] @@ -60,15 +60,15 @@ class QuizController extends AbstractController $em->flush(); if ($quiz instanceof Quiz) { - return $this->redirectToRoute('app_backoffice_quiz', ['seasonCode' => $season->getSeasonCode(), 'quiz' => $quiz->getId()]); + return $this->redirectToRoute('tvdt_backoffice_quiz', ['seasonCode' => $season->getSeasonCode(), 'quiz' => $quiz->getId()]); } - return $this->redirectToRoute('app_backoffice_season', ['seasonCode' => $season->getSeasonCode()]); + return $this->redirectToRoute('tvdt_backoffice_season', ['seasonCode' => $season->getSeasonCode()]); } #[Route( '/backoffice/quiz/{quiz}/clear', - name: 'app_backoffice_quiz_clear', + name: 'tvdt_backoffice_quiz_clear', requirements: ['quiz' => Requirement::UUID], )] #[IsGranted(SeasonVoter::EDIT, subject: 'quiz')] @@ -81,12 +81,12 @@ class QuizController extends AbstractController $this->addFlash('error', $this->translator->trans('Error clearing quiz')); } - return $this->redirectToRoute('app_backoffice_quiz', ['seasonCode' => $quiz->getSeason()->getSeasonCode(), 'quiz' => $quiz->getId()]); + return $this->redirectToRoute('tvdt_backoffice_quiz', ['seasonCode' => $quiz->getSeason()->getSeasonCode(), 'quiz' => $quiz->getId()]); } #[Route( '/backoffice/quiz/{quiz}/delete', - name: 'app_backoffice_quiz_delete', + name: 'tvdt_backoffice_quiz_delete', requirements: ['quiz' => Requirement::UUID], )] #[IsGranted(SeasonVoter::DELETE, subject: 'quiz')] @@ -96,12 +96,12 @@ class QuizController extends AbstractController $this->addFlash('success', $this->translator->trans('Quiz deleted')); - return $this->redirectToRoute('app_backoffice_season', ['seasonCode' => $quiz->getSeason()->getSeasonCode()]); + return $this->redirectToRoute('tvdt_backoffice_season', ['seasonCode' => $quiz->getSeason()->getSeasonCode()]); } #[Route( '/backoffice/quiz/{quiz}/candidate/{candidate}/modify_correction', - name: 'app_backoffice_modify_correction', + name: 'tvdt_backoffice_modify_correction', requirements: ['quiz' => Requirement::UUID, 'candidate' => Requirement::UUID], )] #[IsGranted(SeasonVoter::EDIT, subject: 'quiz')] @@ -115,6 +115,6 @@ class QuizController extends AbstractController $quizCandidateRepository->setCorrectionsForCandidate($quiz, $candidate, $corrections); - return $this->redirectToRoute('app_backoffice_quiz', ['seasonCode' => $quiz->getSeason()->getSeasonCode(), 'quiz' => $quiz->getId()]); + return $this->redirectToRoute('tvdt_backoffice_quiz', ['seasonCode' => $quiz->getSeason()->getSeasonCode(), 'quiz' => $quiz->getId()]); } } diff --git a/src/Controller/Backoffice/SeasonController.php b/src/Controller/Backoffice/SeasonController.php index f250ee7..862db9e 100644 --- a/src/Controller/Backoffice/SeasonController.php +++ b/src/Controller/Backoffice/SeasonController.php @@ -2,18 +2,8 @@ declare(strict_types=1); -namespace App\Controller\Backoffice; +namespace Tvdt\Controller\Backoffice; -use App\Controller\AbstractController; -use App\Entity\Candidate; -use App\Entity\Quiz; -use App\Entity\Season; -use App\Enum\FlashType; -use App\Form\AddCandidatesFormType; -use App\Form\SettingsForm; -use App\Form\UploadQuizFormType; -use App\Security\Voter\SeasonVoter; -use App\Service\QuizSpreadsheetService; use Doctrine\ORM\EntityManagerInterface; use Symfony\Component\HttpFoundation\File\UploadedFile; use Symfony\Component\HttpFoundation\Request; @@ -22,6 +12,16 @@ use Symfony\Component\HttpKernel\Attribute\AsController; use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Security\Http\Attribute\IsGranted; use Symfony\Contracts\Translation\TranslatorInterface; +use Tvdt\Controller\AbstractController; +use Tvdt\Entity\Candidate; +use Tvdt\Entity\Quiz; +use Tvdt\Entity\Season; +use Tvdt\Enum\FlashType; +use Tvdt\Form\AddCandidatesFormType; +use Tvdt\Form\SettingsForm; +use Tvdt\Form\UploadQuizFormType; +use Tvdt\Security\Voter\SeasonVoter; +use Tvdt\Service\QuizSpreadsheetService; #[AsController] #[IsGranted('ROLE_USER')] @@ -34,7 +34,7 @@ class SeasonController extends AbstractController #[Route( '/backoffice/season/{seasonCode:season}', - name: 'app_backoffice_season', + name: 'tvdt_backoffice_season', requirements: ['seasonCode' => self::SEASON_CODE_REGEX], )] #[IsGranted(SeasonVoter::EDIT, subject: 'season')] @@ -56,7 +56,7 @@ class SeasonController extends AbstractController #[Route( '/backoffice/season/{seasonCode:season}/add-candidate', - name: 'app_backoffice_add_candidates', + name: 'tvdt_backoffice_add_candidates', requirements: ['seasonCode' => self::SEASON_CODE_REGEX], priority: 10, )] @@ -74,7 +74,7 @@ class SeasonController extends AbstractController $this->em->flush(); - return $this->redirectToRoute('app_backoffice_season', ['seasonCode' => $season->getSeasonCode()]); + return $this->redirectToRoute('tvdt_backoffice_season', ['seasonCode' => $season->getSeasonCode()]); } return $this->render('backoffice/season_add_candidates.html.twig', ['form' => $form]); @@ -82,7 +82,7 @@ class SeasonController extends AbstractController #[Route( '/backoffice/season/{seasonCode:season}/add-quiz', - name: 'app_backoffice_quiz_add', + name: 'tvdt_backoffice_quiz_add', requirements: ['seasonCode' => self::SEASON_CODE_REGEX], priority: 10, )] @@ -106,7 +106,7 @@ class SeasonController extends AbstractController $this->addFlash(FlashType::Success, $this->translator->trans('Quiz Added!')); - return $this->redirectToRoute('app_backoffice_season', ['seasonCode' => $season->getSeasonCode()]); + return $this->redirectToRoute('tvdt_backoffice_season', ['seasonCode' => $season->getSeasonCode()]); } return $this->render('/backoffice/quiz_add.html.twig', ['form' => $form, 'season' => $season]); diff --git a/src/Controller/EliminationController.php b/src/Controller/EliminationController.php index e4a8686..1573b5c 100644 --- a/src/Controller/EliminationController.php +++ b/src/Controller/EliminationController.php @@ -2,15 +2,8 @@ declare(strict_types=1); -namespace App\Controller; +namespace Tvdt\Controller; -use App\Entity\Candidate; -use App\Entity\Elimination; -use App\Enum\FlashType; -use App\Form\EliminationEnterNameType; -use App\Helpers\Base64; -use App\Repository\CandidateRepository; -use App\Security\Voter\SeasonVoter; use Symfony\Bridge\Doctrine\Attribute\MapEntity; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -19,6 +12,13 @@ use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Routing\Requirement\Requirement; use Symfony\Component\Security\Http\Attribute\IsGranted; use Symfony\Contracts\Translation\TranslatorInterface; +use Tvdt\Entity\Candidate; +use Tvdt\Entity\Elimination; +use Tvdt\Enum\FlashType; +use Tvdt\Form\EliminationEnterNameType; +use Tvdt\Helpers\Base64; +use Tvdt\Repository\CandidateRepository; +use Tvdt\Security\Voter\SeasonVoter; use function Symfony\Component\Translation\t; @@ -28,7 +28,7 @@ final class EliminationController extends AbstractController { public function __construct(private readonly TranslatorInterface $translator) {} - #[Route('/elimination/{elimination}', name: 'app_elimination', requirements: ['elimination' => Requirement::UUID])] + #[Route('/elimination/{elimination}', name: 'tvdt_elimination', requirements: ['elimination' => Requirement::UUID])] #[IsGranted(SeasonVoter::ELIMINATION, 'elimination')] public function index(#[MapEntity] Elimination $elimination, Request $request): Response { @@ -39,7 +39,7 @@ final class EliminationController extends AbstractController if ($form->isSubmitted() && $form->isValid()) { $name = $form->get('name')->getData(); - return $this->redirectToRoute('app_elimination_candidate', ['elimination' => $elimination->getId(), 'candidateHash' => Base64::base64UrlEncode($name)]); + return $this->redirectToRoute('tvdt_elimination_candidate', ['elimination' => $elimination->getId(), 'candidateHash' => Base64::base64UrlEncode($name)]); } return $this->render('quiz/elimination/index.html.twig', [ @@ -48,7 +48,7 @@ final class EliminationController extends AbstractController ]); } - #[Route('/elimination/{elimination}/{candidateHash}', name: 'app_elimination_candidate', requirements: ['elimination' => Requirement::UUID, 'candidateHash' => self::CANDIDATE_HASH_REGEX])] + #[Route('/elimination/{elimination}/{candidateHash}', name: 'tvdt_elimination_candidate', requirements: ['elimination' => Requirement::UUID, 'candidateHash' => self::CANDIDATE_HASH_REGEX])] #[IsGranted(SeasonVoter::ELIMINATION, 'elimination')] public function candidateScreen(Elimination $elimination, string $candidateHash, CandidateRepository $candidateRepository): Response { @@ -58,7 +58,7 @@ final class EliminationController extends AbstractController t('Cound not find candidate with name %name%', ['%name%' => Base64::base64UrlDecode($candidateHash)])->trans($this->translator), ); - return $this->redirectToRoute('app_elimination', ['elimination' => $elimination->getId()]); + return $this->redirectToRoute('tvdt_elimination', ['elimination' => $elimination->getId()]); } $screenColour = $elimination->getScreenColour($candidate->getName()); @@ -66,7 +66,7 @@ final class EliminationController extends AbstractController if (null === $screenColour) { $this->addFlash(FlashType::Warning, $this->translator->trans('Cound not find candidate with name %name% in elimination.', ['%name%' => $candidate->getName()])); - return $this->redirectToRoute('app_elimination', ['elimination' => $elimination->getId()]); + return $this->redirectToRoute('tvdt_elimination', ['elimination' => $elimination->getId()]); } return $this->render('quiz/elimination/candidate.html.twig', [ diff --git a/src/Controller/LoginController.php b/src/Controller/LoginController.php index a9a9057..65a8661 100644 --- a/src/Controller/LoginController.php +++ b/src/Controller/LoginController.php @@ -2,20 +2,20 @@ declare(strict_types=1); -namespace App\Controller; +namespace Tvdt\Controller; -use App\Enum\FlashType; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Attribute\AsController; use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Security\Core\Exception\AuthenticationException; use Symfony\Component\Security\Http\Authentication\AuthenticationUtils; use Symfony\Contracts\Translation\TranslatorInterface; +use Tvdt\Enum\FlashType; #[AsController] final class LoginController extends AbstractController { - #[Route(path: '/login', name: 'app_login_login')] + #[Route(path: '/login', name: 'tvdt_login_login')] public function login(AuthenticationUtils $authenticationUtils, TranslatorInterface $translator): Response { // get the login error if there is one @@ -34,7 +34,7 @@ final class LoginController extends AbstractController ]); } - #[Route(path: '/logout', name: 'app_login_logout')] + #[Route(path: '/logout', name: 'tvdt_login_logout')] public function logout(): never { throw new \LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.'); diff --git a/src/Controller/QuizController.php b/src/Controller/QuizController.php index 590ba8d..5009441 100644 --- a/src/Controller/QuizController.php +++ b/src/Controller/QuizController.php @@ -2,37 +2,37 @@ declare(strict_types=1); -namespace App\Controller; +namespace Tvdt\Controller; -use App\Entity\Answer; -use App\Entity\Candidate; -use App\Entity\GivenAnswer; -use App\Entity\Question; -use App\Entity\Quiz; -use App\Entity\Season; -use App\Enum\FlashType; -use App\Form\EnterNameType; -use App\Form\SelectSeasonType; -use App\Helpers\Base64; -use App\Repository\AnswerRepository; -use App\Repository\CandidateRepository; -use App\Repository\GivenAnswerRepository; -use App\Repository\QuestionRepository; -use App\Repository\QuizCandidateRepository; -use App\Repository\SeasonRepository; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Attribute\AsController; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; use Symfony\Component\Routing\Attribute\Route; use Symfony\Contracts\Translation\TranslatorInterface; +use Tvdt\Entity\Answer; +use Tvdt\Entity\Candidate; +use Tvdt\Entity\GivenAnswer; +use Tvdt\Entity\Question; +use Tvdt\Entity\Quiz; +use Tvdt\Entity\Season; +use Tvdt\Enum\FlashType; +use Tvdt\Form\EnterNameType; +use Tvdt\Form\SelectSeasonType; +use Tvdt\Helpers\Base64; +use Tvdt\Repository\AnswerRepository; +use Tvdt\Repository\CandidateRepository; +use Tvdt\Repository\GivenAnswerRepository; +use Tvdt\Repository\QuestionRepository; +use Tvdt\Repository\QuizCandidateRepository; +use Tvdt\Repository\SeasonRepository; #[AsController] final class QuizController extends AbstractController { public function __construct(private readonly TranslatorInterface $translator) {} - #[Route(path: '/', name: 'app_quiz_select_season', methods: ['GET', 'POST'])] + #[Route(path: '/', name: 'tvdt_quiz_select_season', methods: ['GET', 'POST'])] public function selectSeason(Request $request, SeasonRepository $seasonRepository): Response { $form = $this->createForm(SelectSeasonType::class); @@ -44,16 +44,16 @@ final class QuizController extends AbstractController if ([] === $seasonRepository->findBy(['seasonCode' => $seasonCode])) { $this->addFlash(FlashType::Warning, $this->translator->trans('Invalid season code')); - return $this->redirectToRoute('app_quiz_select_season'); + return $this->redirectToRoute('tvdt_quiz_select_season'); } - return $this->redirectToRoute('app_quiz_enter_name', ['seasonCode' => $seasonCode]); + return $this->redirectToRoute('tvdt_quiz_enter_name', ['seasonCode' => $seasonCode]); } return $this->render('quiz/select_season.html.twig', ['form' => $form]); } - #[Route(path: '/{seasonCode:season}', name: 'app_quiz_enter_name', requirements: ['seasonCode' => self::SEASON_CODE_REGEX])] + #[Route(path: '/{seasonCode:season}', name: 'tvdt_quiz_enter_name', requirements: ['seasonCode' => self::SEASON_CODE_REGEX])] public function enterName( Request $request, Season $season, @@ -65,7 +65,7 @@ final class QuizController extends AbstractController if ($form->isSubmitted() && $form->isValid()) { $name = $form->get('name')->getData(); - return $this->redirectToRoute('app_quiz_quiz_page', ['seasonCode' => $season->getSeasonCode(), 'nameHash' => Base64::base64UrlEncode($name)]); + return $this->redirectToRoute('tvdt_quiz_quiz_page', ['seasonCode' => $season->getSeasonCode(), 'nameHash' => Base64::base64UrlEncode($name)]); } return $this->render('quiz/enter_name.twig', ['season' => $season, 'form' => $form]); @@ -73,7 +73,7 @@ final class QuizController extends AbstractController #[Route( path: '/{seasonCode:season}/{nameHash}', - name: 'app_quiz_quiz_page', + name: 'tvdt_quiz_quiz_page', requirements: ['seasonCode' => self::SEASON_CODE_REGEX, 'nameHash' => self::CANDIDATE_HASH_REGEX], )] public function quizPage( @@ -91,7 +91,7 @@ final class QuizController extends AbstractController if (!$candidate instanceof Candidate) { $this->addFlash(FlashType::Danger, $this->translator->trans('Candidate not found')); - return $this->redirectToRoute('app_quiz_enter_name', ['seasonCode' => $season->getSeasonCode()]); + return $this->redirectToRoute('tvdt_quiz_enter_name', ['seasonCode' => $season->getSeasonCode()]); } $quiz = $season->getActiveQuiz(); @@ -99,7 +99,7 @@ final class QuizController extends AbstractController if (!$quiz instanceof Quiz) { $this->addFlash(FlashType::Warning, $this->translator->trans('There is no active quiz')); - return $this->redirectToRoute('app_quiz_enter_name', ['seasonCode' => $season->getSeasonCode()]); + return $this->redirectToRoute('tvdt_quiz_enter_name', ['seasonCode' => $season->getSeasonCode()]); } if ('POST' === $request->getMethod()) { @@ -112,7 +112,7 @@ final class QuizController extends AbstractController $givenAnswer = new GivenAnswer($candidate, $answer->getQuestion()->getQuiz(), $answer); $givenAnswerRepository->save($givenAnswer); - return $this->redirectToRoute('app_quiz_quiz_page', ['seasonCode' => $season->getSeasonCode(), 'nameHash' => $nameHash]); + return $this->redirectToRoute('tvdt_quiz_quiz_page', ['seasonCode' => $season->getSeasonCode(), 'nameHash' => $nameHash]); } $question = $questionRepository->findNextQuestionForCandidate($candidate); @@ -120,7 +120,7 @@ final class QuizController extends AbstractController if (!$question instanceof Question) { $this->addFlash(FlashType::Success, $this->translator->trans('Quiz completed')); - return $this->redirectToRoute('app_quiz_enter_name', ['seasonCode' => $season->getSeasonCode()]); + return $this->redirectToRoute('tvdt_quiz_enter_name', ['seasonCode' => $season->getSeasonCode()]); } $quizCandidateRepository->createIfNotExist($quiz, $candidate); diff --git a/src/Controller/RegistrationController.php b/src/Controller/RegistrationController.php index 8b86ceb..27df44c 100644 --- a/src/Controller/RegistrationController.php +++ b/src/Controller/RegistrationController.php @@ -2,12 +2,8 @@ declare(strict_types=1); -namespace App\Controller; +namespace Tvdt\Controller; -use App\Entity\User; -use App\Form\RegistrationFormType; -use App\Repository\UserRepository; -use App\Security\EmailVerifier; use Doctrine\ORM\EntityManagerInterface; use Psr\Log\LoggerInterface; use Symfony\Bridge\Twig\Mime\TemplatedEmail; @@ -20,12 +16,16 @@ use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface; use Symfony\Component\Routing\Attribute\Route; use Symfony\Contracts\Translation\TranslatorInterface; use SymfonyCasts\Bundle\VerifyEmail\Exception\VerifyEmailExceptionInterface; +use Tvdt\Entity\User; +use Tvdt\Form\RegistrationFormType; +use Tvdt\Repository\UserRepository; +use Tvdt\Security\EmailVerifier; final class RegistrationController extends AbstractController { public function __construct(private readonly EmailVerifier $emailVerifier, private readonly TranslatorInterface $translator) {} - #[Route('/register', name: 'app_register')] + #[Route('/register', name: 'tvdt_register')] public function register( Request $request, UserPasswordHasherInterface $userPasswordHasher, @@ -48,7 +48,7 @@ final class RegistrationController extends AbstractController try { // generate a signed url and email it to the user - $this->emailVerifier->sendEmailConfirmation('app_verify_email', $user, + $this->emailVerifier->sendEmailConfirmation('tvdt_verify_email', $user, new TemplatedEmail() ->to((string) $user->getEmail()) ->subject($this->translator->trans('Please Confirm your Email')) @@ -69,19 +69,19 @@ final class RegistrationController extends AbstractController ]); } - #[Route('/verify/email', name: 'app_verify_email')] + #[Route('/verify/email', name: 'tvdt_verify_email')] public function verifyUserEmail(Request $request, TranslatorInterface $translator, UserRepository $userRepository): Response { $id = $request->query->get('id'); if (null === $id) { - return $this->redirectToRoute('app_register'); + return $this->redirectToRoute('tvdt_register'); } $user = $userRepository->find($id); if (null === $user) { - return $this->redirectToRoute('app_register'); + return $this->redirectToRoute('tvdt_register'); } // validate email confirmation link, sets User::isVerified=true and persists @@ -90,11 +90,11 @@ final class RegistrationController extends AbstractController } catch (VerifyEmailExceptionInterface $verifyEmailException) { $this->addFlash('verify_email_error', $translator->trans($verifyEmailException->getReason(), [], 'VerifyEmailBundle')); - return $this->redirectToRoute('app_register'); + return $this->redirectToRoute('tvdt_register'); } $this->addFlash('success', $this->translator->trans('Your email address has been verified.')); - return $this->redirectToRoute('app_backoffice_index'); + return $this->redirectToRoute('tvdt_backoffice_index'); } } diff --git a/src/DataFixtures/KrtekFixtures.php b/src/DataFixtures/KrtekFixtures.php index 2932678..ad6b812 100644 --- a/src/DataFixtures/KrtekFixtures.php +++ b/src/DataFixtures/KrtekFixtures.php @@ -2,15 +2,15 @@ declare(strict_types=1); -namespace App\DataFixtures; +namespace Tvdt\DataFixtures; -use App\Entity\Answer; -use App\Entity\Candidate; -use App\Entity\Question; -use App\Entity\Quiz; -use App\Entity\Season; use Doctrine\Bundle\FixturesBundle\Fixture; use Doctrine\Persistence\ObjectManager; +use Tvdt\Entity\Answer; +use Tvdt\Entity\Candidate; +use Tvdt\Entity\Question; +use Tvdt\Entity\Quiz; +use Tvdt\Entity\Season; class KrtekFixtures extends Fixture { diff --git a/src/Entity/Answer.php b/src/Entity/Answer.php index 2d96e15..ba5d93e 100644 --- a/src/Entity/Answer.php +++ b/src/Entity/Answer.php @@ -2,9 +2,8 @@ declare(strict_types=1); -namespace App\Entity; +namespace Tvdt\Entity; -use App\Repository\AnswerRepository; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\DBAL\Types\Types; @@ -12,6 +11,7 @@ use Doctrine\ORM\Mapping as ORM; use Symfony\Bridge\Doctrine\IdGenerator\UuidGenerator; use Symfony\Bridge\Doctrine\Types\UuidType; use Symfony\Component\Uid\Uuid; +use Tvdt\Repository\AnswerRepository; #[ORM\Entity(repositoryClass: AnswerRepository::class)] class Answer diff --git a/src/Entity/Candidate.php b/src/Entity/Candidate.php index ddd35fb..558deea 100644 --- a/src/Entity/Candidate.php +++ b/src/Entity/Candidate.php @@ -2,16 +2,16 @@ declare(strict_types=1); -namespace App\Entity; +namespace Tvdt\Entity; -use App\Helpers\Base64; -use App\Repository\CandidateRepository; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; use Symfony\Bridge\Doctrine\IdGenerator\UuidGenerator; use Symfony\Bridge\Doctrine\Types\UuidType; use Symfony\Component\Uid\Uuid; +use Tvdt\Helpers\Base64; +use Tvdt\Repository\CandidateRepository; #[ORM\Entity(repositoryClass: CandidateRepository::class)] #[ORM\UniqueConstraint(fields: ['name', 'season'])] diff --git a/src/Entity/Elimination.php b/src/Entity/Elimination.php index a316471..521ce36 100644 --- a/src/Entity/Elimination.php +++ b/src/Entity/Elimination.php @@ -2,9 +2,8 @@ declare(strict_types=1); -namespace App\Entity; +namespace Tvdt\Entity; -use App\Repository\EliminationRepository; use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use Safe\DateTimeImmutable; @@ -12,6 +11,7 @@ use Symfony\Bridge\Doctrine\IdGenerator\UuidGenerator; use Symfony\Bridge\Doctrine\Types\UuidType; use Symfony\Component\HttpFoundation\InputBag; use Symfony\Component\Uid\Uuid; +use Tvdt\Repository\EliminationRepository; #[ORM\Entity(repositoryClass: EliminationRepository::class)] #[ORM\HasLifecycleCallbacks] diff --git a/src/Entity/GivenAnswer.php b/src/Entity/GivenAnswer.php index b7c0fc3..f0c3fec 100644 --- a/src/Entity/GivenAnswer.php +++ b/src/Entity/GivenAnswer.php @@ -2,15 +2,15 @@ declare(strict_types=1); -namespace App\Entity; +namespace Tvdt\Entity; -use App\Repository\GivenAnswerRepository; use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use Safe\DateTimeImmutable; use Symfony\Bridge\Doctrine\IdGenerator\UuidGenerator; use Symfony\Bridge\Doctrine\Types\UuidType; use Symfony\Component\Uid\Uuid; +use Tvdt\Repository\GivenAnswerRepository; #[ORM\Entity(repositoryClass: GivenAnswerRepository::class)] #[ORM\HasLifecycleCallbacks] diff --git a/src/Entity/Question.php b/src/Entity/Question.php index faeb83f..6ca43a0 100644 --- a/src/Entity/Question.php +++ b/src/Entity/Question.php @@ -2,9 +2,8 @@ declare(strict_types=1); -namespace App\Entity; +namespace Tvdt\Entity; -use App\Repository\QuestionRepository; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\DBAL\Types\Types; @@ -12,6 +11,7 @@ use Doctrine\ORM\Mapping as ORM; use Symfony\Bridge\Doctrine\IdGenerator\UuidGenerator; use Symfony\Bridge\Doctrine\Types\UuidType; use Symfony\Component\Uid\Uuid; +use Tvdt\Repository\QuestionRepository; #[ORM\Entity(repositoryClass: QuestionRepository::class)] class Question diff --git a/src/Entity/Quiz.php b/src/Entity/Quiz.php index 958876d..49848e3 100644 --- a/src/Entity/Quiz.php +++ b/src/Entity/Quiz.php @@ -2,15 +2,15 @@ declare(strict_types=1); -namespace App\Entity; +namespace Tvdt\Entity; -use App\Repository\QuizRepository; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; use Symfony\Bridge\Doctrine\IdGenerator\UuidGenerator; use Symfony\Bridge\Doctrine\Types\UuidType; use Symfony\Component\Uid\Uuid; +use Tvdt\Repository\QuizRepository; #[ORM\Entity(repositoryClass: QuizRepository::class)] #[ORM\UniqueConstraint(fields: ['name', 'season'])] diff --git a/src/Entity/QuizCandidate.php b/src/Entity/QuizCandidate.php index ff1c41a..3873133 100644 --- a/src/Entity/QuizCandidate.php +++ b/src/Entity/QuizCandidate.php @@ -2,15 +2,15 @@ declare(strict_types=1); -namespace App\Entity; +namespace Tvdt\Entity; -use App\Repository\QuizCandidateRepository; use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use Safe\DateTimeImmutable; use Symfony\Bridge\Doctrine\IdGenerator\UuidGenerator; use Symfony\Bridge\Doctrine\Types\UuidType; use Symfony\Component\Uid\Uuid; +use Tvdt\Repository\QuizCandidateRepository; #[ORM\Entity(repositoryClass: QuizCandidateRepository::class)] #[ORM\UniqueConstraint(columns: ['candidate_id', 'quiz_id'])] diff --git a/src/Entity/Season.php b/src/Entity/Season.php index e135a06..6911d7c 100644 --- a/src/Entity/Season.php +++ b/src/Entity/Season.php @@ -2,15 +2,15 @@ declare(strict_types=1); -namespace App\Entity; +namespace Tvdt\Entity; -use App\Repository\SeasonRepository; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; use Symfony\Bridge\Doctrine\IdGenerator\UuidGenerator; use Symfony\Bridge\Doctrine\Types\UuidType; use Symfony\Component\Uid\Uuid; +use Tvdt\Repository\SeasonRepository; #[ORM\Entity(repositoryClass: SeasonRepository::class)] class Season diff --git a/src/Entity/SeasonSettings.php b/src/Entity/SeasonSettings.php index cb1a262..e5bee3f 100644 --- a/src/Entity/SeasonSettings.php +++ b/src/Entity/SeasonSettings.php @@ -2,14 +2,14 @@ declare(strict_types=1); -namespace App\Entity; +namespace Tvdt\Entity; -use App\Repository\SeasonSettingsRepository; use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use Symfony\Bridge\Doctrine\IdGenerator\UuidGenerator; use Symfony\Bridge\Doctrine\Types\UuidType; use Symfony\Component\Uid\Uuid; +use Tvdt\Repository\SeasonSettingsRepository; #[ORM\Entity(repositoryClass: SeasonSettingsRepository::class)] class SeasonSettings diff --git a/src/Entity/User.php b/src/Entity/User.php index 2c20f09..87e9f2d 100644 --- a/src/Entity/User.php +++ b/src/Entity/User.php @@ -2,9 +2,8 @@ declare(strict_types=1); -namespace App\Entity; +namespace Tvdt\Entity; -use App\Repository\UserRepository; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\DBAL\Types\Types; @@ -15,6 +14,7 @@ use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface; use Symfony\Component\Security\Core\User\UserInterface; use Symfony\Component\Uid\Uuid; +use Tvdt\Repository\UserRepository; #[ORM\Entity(repositoryClass: UserRepository::class)] #[ORM\Table(name: '`user`')] diff --git a/src/Enum/FlashType.php b/src/Enum/FlashType.php index 6ed9ae8..8f93f73 100644 --- a/src/Enum/FlashType.php +++ b/src/Enum/FlashType.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Enum; +namespace Tvdt\Enum; enum FlashType: string { diff --git a/src/Exception/ErrorClearingQuizException.php b/src/Exception/ErrorClearingQuizException.php index 67521ff..3ae4065 100644 --- a/src/Exception/ErrorClearingQuizException.php +++ b/src/Exception/ErrorClearingQuizException.php @@ -2,6 +2,6 @@ declare(strict_types=1); -namespace App\Exception; +namespace Tvdt\Exception; class ErrorClearingQuizException extends \Exception {} diff --git a/src/Exception/SpreadsheetDataException.php b/src/Exception/SpreadsheetDataException.php index 9b35dfd..f32e8ed 100644 --- a/src/Exception/SpreadsheetDataException.php +++ b/src/Exception/SpreadsheetDataException.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Exception; +namespace Tvdt\Exception; class SpreadsheetDataException extends SpreadsheetException { diff --git a/src/Exception/SpreadsheetException.php b/src/Exception/SpreadsheetException.php index 33f01f0..be56c20 100644 --- a/src/Exception/SpreadsheetException.php +++ b/src/Exception/SpreadsheetException.php @@ -2,6 +2,6 @@ declare(strict_types=1); -namespace App\Exception; +namespace Tvdt\Exception; class SpreadsheetException extends \Exception {} diff --git a/src/Factory/EliminationFactory.php b/src/Factory/EliminationFactory.php index 773fad3..e512707 100644 --- a/src/Factory/EliminationFactory.php +++ b/src/Factory/EliminationFactory.php @@ -2,12 +2,12 @@ declare(strict_types=1); -namespace App\Factory; +namespace Tvdt\Factory; -use App\Entity\Elimination; -use App\Entity\Quiz; -use App\Repository\CandidateRepository; use Doctrine\ORM\EntityManagerInterface; +use Tvdt\Entity\Elimination; +use Tvdt\Entity\Quiz; +use Tvdt\Repository\CandidateRepository; final readonly class EliminationFactory { diff --git a/src/Form/AddCandidatesFormType.php b/src/Form/AddCandidatesFormType.php index dbb952b..a75823d 100644 --- a/src/Form/AddCandidatesFormType.php +++ b/src/Form/AddCandidatesFormType.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Form; +namespace Tvdt\Form; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\TextareaType; diff --git a/src/Form/CreateSeasonFormType.php b/src/Form/CreateSeasonFormType.php index 7a0ca2e..b98ac3b 100644 --- a/src/Form/CreateSeasonFormType.php +++ b/src/Form/CreateSeasonFormType.php @@ -2,14 +2,14 @@ declare(strict_types=1); -namespace App\Form; +namespace Tvdt\Form; -use App\Entity\Season; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Contracts\Translation\TranslatorInterface; +use Tvdt\Entity\Season; /** @extends AbstractType */ class CreateSeasonFormType extends AbstractType diff --git a/src/Form/EliminationEnterNameType.php b/src/Form/EliminationEnterNameType.php index 52cd20a..2ccde94 100644 --- a/src/Form/EliminationEnterNameType.php +++ b/src/Form/EliminationEnterNameType.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Form; +namespace Tvdt\Form; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\TextType; diff --git a/src/Form/EnterNameType.php b/src/Form/EnterNameType.php index ac73e45..d275591 100644 --- a/src/Form/EnterNameType.php +++ b/src/Form/EnterNameType.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Form; +namespace Tvdt\Form; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\TextType; diff --git a/src/Form/RegistrationFormType.php b/src/Form/RegistrationFormType.php index 276ee83..f6f32ed 100644 --- a/src/Form/RegistrationFormType.php +++ b/src/Form/RegistrationFormType.php @@ -2,9 +2,8 @@ declare(strict_types=1); -namespace App\Form; +namespace Tvdt\Form; -use App\Entity\User; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\EmailType; use Symfony\Component\Form\Extension\Core\Type\PasswordType; @@ -14,6 +13,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Validator\Constraints\Length; use Symfony\Component\Validator\Constraints\NotBlank; use Symfony\Contracts\Translation\TranslatorInterface; +use Tvdt\Entity\User; /** * @extends AbstractType diff --git a/src/Form/SelectSeasonType.php b/src/Form/SelectSeasonType.php index cdf4a7f..1eca167 100644 --- a/src/Form/SelectSeasonType.php +++ b/src/Form/SelectSeasonType.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Form; +namespace Tvdt\Form; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\TextType; diff --git a/src/Form/SettingsForm.php b/src/Form/SettingsForm.php index 36acb18..c274979 100644 --- a/src/Form/SettingsForm.php +++ b/src/Form/SettingsForm.php @@ -2,13 +2,13 @@ declare(strict_types=1); -namespace App\Form; +namespace Tvdt\Form; -use App\Entity\SeasonSettings; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; +use Tvdt\Entity\SeasonSettings; /** @extends AbstractType */ class SettingsForm extends AbstractType diff --git a/src/Form/UploadQuizFormType.php b/src/Form/UploadQuizFormType.php index ecebf50..71a163f 100644 --- a/src/Form/UploadQuizFormType.php +++ b/src/Form/UploadQuizFormType.php @@ -2,9 +2,8 @@ declare(strict_types=1); -namespace App\Form; +namespace Tvdt\Form; -use App\Entity\Quiz; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\FileType; use Symfony\Component\Form\Extension\Core\Type\TextType; @@ -12,6 +11,7 @@ use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Validator\Constraints\File; use Symfony\Contracts\Translation\TranslatorInterface; +use Tvdt\Entity\Quiz; /** @extends AbstractType */ class UploadQuizFormType extends AbstractType diff --git a/src/Helpers/Base64.php b/src/Helpers/Base64.php index 40463bc..647ca68 100644 --- a/src/Helpers/Base64.php +++ b/src/Helpers/Base64.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Helpers; +namespace Tvdt\Helpers; use Safe\Exceptions\UrlException; diff --git a/src/Kernel.php b/src/Kernel.php index ad0fb48..07640ed 100644 --- a/src/Kernel.php +++ b/src/Kernel.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App; +namespace Tvdt; use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; use Symfony\Component\HttpKernel\Kernel as BaseKernel; diff --git a/src/Repository/AnswerRepository.php b/src/Repository/AnswerRepository.php index 43a1d55..c9f9e06 100644 --- a/src/Repository/AnswerRepository.php +++ b/src/Repository/AnswerRepository.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace App\Repository; +namespace Tvdt\Repository; -use App\Entity\Answer; use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; use Doctrine\Persistence\ManagerRegistry; +use Tvdt\Entity\Answer; /** * @extends ServiceEntityRepository diff --git a/src/Repository/CandidateRepository.php b/src/Repository/CandidateRepository.php index 462048a..c385a3d 100644 --- a/src/Repository/CandidateRepository.php +++ b/src/Repository/CandidateRepository.php @@ -2,16 +2,16 @@ declare(strict_types=1); -namespace App\Repository; +namespace Tvdt\Repository; -use App\Entity\Candidate; -use App\Entity\Quiz; -use App\Entity\Season; -use App\Helpers\Base64; use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; use Doctrine\Persistence\ManagerRegistry; use Safe\Exceptions\UrlException; use Symfony\Component\Uid\Uuid; +use Tvdt\Entity\Candidate; +use Tvdt\Entity\Quiz; +use Tvdt\Entity\Season; +use Tvdt\Helpers\Base64; /** * @extends ServiceEntityRepository @@ -35,7 +35,7 @@ class CandidateRepository extends ServiceEntityRepository } return $this->getEntityManager()->createQuery(<< diff --git a/src/Repository/GivenAnswerRepository.php b/src/Repository/GivenAnswerRepository.php index 3e9423f..b8a13df 100644 --- a/src/Repository/GivenAnswerRepository.php +++ b/src/Repository/GivenAnswerRepository.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace App\Repository; +namespace Tvdt\Repository; -use App\Entity\GivenAnswer; use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; use Doctrine\Persistence\ManagerRegistry; +use Tvdt\Entity\GivenAnswer; /** * @extends ServiceEntityRepository diff --git a/src/Repository/QuestionRepository.php b/src/Repository/QuestionRepository.php index 77bbd0a..64610fb 100644 --- a/src/Repository/QuestionRepository.php +++ b/src/Repository/QuestionRepository.php @@ -2,12 +2,12 @@ declare(strict_types=1); -namespace App\Repository; +namespace Tvdt\Repository; -use App\Entity\Candidate; -use App\Entity\Question; use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; use Doctrine\Persistence\ManagerRegistry; +use Tvdt\Entity\Candidate; +use Tvdt\Entity\Question; /** * @extends ServiceEntityRepository @@ -22,10 +22,10 @@ class QuestionRepository extends ServiceEntityRepository public function findNextQuestionForCandidate(Candidate $candidate): ?Question { return $this->getEntityManager()->createQuery(<< diff --git a/src/Repository/QuizRepository.php b/src/Repository/QuizRepository.php index 7d1904c..2f72807 100644 --- a/src/Repository/QuizRepository.php +++ b/src/Repository/QuizRepository.php @@ -2,16 +2,16 @@ declare(strict_types=1); -namespace App\Repository; +namespace Tvdt\Repository; -use App\Entity\Elimination; -use App\Entity\GivenAnswer; -use App\Entity\Quiz; -use App\Entity\QuizCandidate; -use App\Exception\ErrorClearingQuizException; use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; use Doctrine\Persistence\ManagerRegistry; use Psr\Log\LoggerInterface; +use Tvdt\Entity\Elimination; +use Tvdt\Entity\GivenAnswer; +use Tvdt\Entity\Quiz; +use Tvdt\Entity\QuizCandidate; +use Tvdt\Exception\ErrorClearingQuizException; /** * @extends ServiceEntityRepository diff --git a/src/Repository/SeasonRepository.php b/src/Repository/SeasonRepository.php index 6ae3c7f..b12d493 100644 --- a/src/Repository/SeasonRepository.php +++ b/src/Repository/SeasonRepository.php @@ -2,12 +2,12 @@ declare(strict_types=1); -namespace App\Repository; +namespace Tvdt\Repository; -use App\Entity\Season; -use App\Entity\User; use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; use Doctrine\Persistence\ManagerRegistry; +use Tvdt\Entity\Season; +use Tvdt\Entity\User; /** * @extends ServiceEntityRepository @@ -23,7 +23,7 @@ class SeasonRepository extends ServiceEntityRepository public function getSeasonsForUser(User $user): array { return $this->getEntityManager()->createQuery(<<setParameter('user', $user)->getResult(); } diff --git a/src/Repository/SeasonSettingsRepository.php b/src/Repository/SeasonSettingsRepository.php index b0fb073..5b1d063 100644 --- a/src/Repository/SeasonSettingsRepository.php +++ b/src/Repository/SeasonSettingsRepository.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace App\Repository; +namespace Tvdt\Repository; -use App\Entity\SeasonSettings; use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; use Doctrine\Persistence\ManagerRegistry; +use Tvdt\Entity\SeasonSettings; /** * @extends ServiceEntityRepository diff --git a/src/Repository/UserRepository.php b/src/Repository/UserRepository.php index 1de1324..cf670c1 100644 --- a/src/Repository/UserRepository.php +++ b/src/Repository/UserRepository.php @@ -2,13 +2,13 @@ declare(strict_types=1); -namespace App\Repository; +namespace Tvdt\Repository; -use App\Entity\User; use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; use Doctrine\Persistence\ManagerRegistry; use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface; use Symfony\Component\Security\Core\User\PasswordUpgraderInterface; +use Tvdt\Entity\User; /** @extends ServiceEntityRepository */ class UserRepository extends ServiceEntityRepository implements PasswordUpgraderInterface diff --git a/src/Security/EmailVerifier.php b/src/Security/EmailVerifier.php index efac43a..880de09 100644 --- a/src/Security/EmailVerifier.php +++ b/src/Security/EmailVerifier.php @@ -2,15 +2,15 @@ declare(strict_types=1); -namespace App\Security; +namespace Tvdt\Security; -use App\Entity\User; use Doctrine\ORM\EntityManagerInterface; use Symfony\Bridge\Twig\Mime\TemplatedEmail; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Mailer\Exception\TransportExceptionInterface; use Symfony\Component\Mailer\MailerInterface; use SymfonyCasts\Bundle\VerifyEmail\VerifyEmailHelperInterface; +use Tvdt\Entity\User; readonly class EmailVerifier { diff --git a/src/Security/Voter/SeasonVoter.php b/src/Security/Voter/SeasonVoter.php index 7e3fefe..0d9fa4e 100644 --- a/src/Security/Voter/SeasonVoter.php +++ b/src/Security/Voter/SeasonVoter.php @@ -2,18 +2,18 @@ declare(strict_types=1); -namespace App\Security\Voter; +namespace Tvdt\Security\Voter; -use App\Entity\Answer; -use App\Entity\Candidate; -use App\Entity\Elimination; -use App\Entity\Question; -use App\Entity\Quiz; -use App\Entity\Season; -use App\Entity\User; use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; use Symfony\Component\Security\Core\Authorization\Voter\Vote; use Symfony\Component\Security\Core\Authorization\Voter\Voter; +use Tvdt\Entity\Answer; +use Tvdt\Entity\Candidate; +use Tvdt\Entity\Elimination; +use Tvdt\Entity\Question; +use Tvdt\Entity\Quiz; +use Tvdt\Entity\Season; +use Tvdt\Entity\User; /** @extends Voter */ final class SeasonVoter extends Voter diff --git a/src/Service/EliminationService.php b/src/Service/EliminationService.php index d22adbf..0343a67 100644 --- a/src/Service/EliminationService.php +++ b/src/Service/EliminationService.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace App\Service; +namespace Tvdt\Service; -use App\Repository\CandidateRepository; +use Tvdt\Repository\CandidateRepository; /** * @phpstan-import-type ResultList from CandidateRepository diff --git a/src/Service/QuizSpreadsheetService.php b/src/Service/QuizSpreadsheetService.php index 255a319..3598054 100644 --- a/src/Service/QuizSpreadsheetService.php +++ b/src/Service/QuizSpreadsheetService.php @@ -2,16 +2,16 @@ declare(strict_types=1); -namespace App\Service; +namespace Tvdt\Service; -use App\Entity\Answer; -use App\Entity\Question; -use App\Entity\Quiz; -use App\Exception\SpreadsheetDataException; use PhpOffice\PhpSpreadsheet\Reader; use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Writer; use Symfony\Component\HttpFoundation\File\File; +use Tvdt\Entity\Answer; +use Tvdt\Entity\Question; +use Tvdt\Entity\Quiz; +use Tvdt\Exception\SpreadsheetDataException; class QuizSpreadsheetService { diff --git a/templates/backoffice/index.html.twig b/templates/backoffice/index.html.twig index ddad310..43afa5b 100644 --- a/templates/backoffice/index.html.twig +++ b/templates/backoffice/index.html.twig @@ -7,7 +7,7 @@

{{ is_granted('ROLE_ADMIN') ? 'All Seasons'|trans : 'Your Seasons'|trans }}

- + {{ 'Add'|trans }} @@ -39,11 +39,11 @@ {% endif %} - {{ season.seasonCode }} - {{ 'Manage'|trans }} + {{ 'Manage'|trans }} {% endfor %} diff --git a/templates/backoffice/login/login.html.twig b/templates/backoffice/login/login.html.twig index 97e9fa9..d2ca0ef 100644 --- a/templates/backoffice/login/login.html.twig +++ b/templates/backoffice/login/login.html.twig @@ -5,7 +5,7 @@ {% block body %} {% if app.user %}
- You are logged in as {{ app.user.userIdentifier }}, Logout + You are logged in as {{ app.user.userIdentifier }}, Logout
{% else %}
@@ -34,7 +34,7 @@ - {{ 'Create an account'|trans }}
{% endif %} diff --git a/templates/backoffice/nav.html.twig b/templates/backoffice/nav.html.twig index 45bf351..8c62468 100644 --- a/templates/backoffice/nav.html.twig +++ b/templates/backoffice/nav.html.twig @@ -1,6 +1,6 @@