From f8fc4d6bd9e2c2e53536498f31c126332680b625 Mon Sep 17 00:00:00 2001 From: Matthieu Date: Fri, 19 Jun 2026 16:03:52 +0200 Subject: [PATCH] feat(core) : move user entity into core module and repoint security/doctrine (temp legacy alias) --- .php-cs-fixer.dist.php | 1 + composer.json | 5 ++++- config/packages/doctrine.yaml | 7 ++++++- config/packages/security.yaml | 2 +- config/services.yaml | 3 +++ src/{ => Module/Core/Domain}/Entity/User.php | 2 +- src/Module/Core/_compat_user_alias.php | 8 ++++++++ 7 files changed, 24 insertions(+), 4 deletions(-) rename src/{ => Module/Core/Domain}/Entity/User.php (99%) create mode 100644 src/Module/Core/_compat_user_alias.php diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 04b76c2..713b4d3 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -8,6 +8,7 @@ use PhpCsFixer\Finder; $finder = Finder::create() ->in('src') ->notName('Kernel.php') + ->notPath('Module/Core/_compat_user_alias.php') ; $rules = [ diff --git a/composer.json b/composer.json index 7b9c607..533bddc 100644 --- a/composer.json +++ b/composer.json @@ -55,7 +55,10 @@ "autoload": { "psr-4": { "App\\": "src/" - } + }, + "files": [ + "src/Module/Core/_compat_user_alias.php" + ] }, "autoload-dev": { "psr-4": { diff --git a/config/packages/doctrine.yaml b/config/packages/doctrine.yaml index 303521a..bc43e4d 100644 --- a/config/packages/doctrine.yaml +++ b/config/packages/doctrine.yaml @@ -14,7 +14,7 @@ doctrine: Doctrine\DBAL\Platforms\PostgreSQLPlatform: identity auto_mapping: true resolve_target_entities: - App\Shared\Domain\Contract\UserInterface: App\Entity\User + App\Shared\Domain\Contract\UserInterface: App\Module\Core\Domain\Entity\User mappings: App: type: attribute @@ -22,6 +22,11 @@ doctrine: dir: '%kernel.project_dir%/src/Entity' prefix: 'App\Entity' alias: App + Core: + type: attribute + is_bundle: false + dir: '%kernel.project_dir%/src/Module/Core/Domain/Entity' + prefix: 'App\Module\Core\Domain\Entity' controller_resolver: auto_mapping: false diff --git a/config/packages/security.yaml b/config/packages/security.yaml index bcdbaa6..24cb6de 100644 --- a/config/packages/security.yaml +++ b/config/packages/security.yaml @@ -10,7 +10,7 @@ security: providers: app_user_provider: entity: - class: App\Entity\User + class: App\Module\Core\Domain\Entity\User property: username firewalls: diff --git a/config/services.yaml b/config/services.yaml index b91e5ea..1b039ef 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -27,6 +27,9 @@ services: # this creates a service per class whose id is the fully-qualified class name App\: resource: '../src/' + # Temporary legacy class_alias bootstrap file (no service): excluded from autowiring scan. + exclude: + - '../src/Module/Core/_compat_user_alias.php' # add more service definitions when explicit configuration is needed # please note that last definitions always *replace* previous ones diff --git a/src/Entity/User.php b/src/Module/Core/Domain/Entity/User.php similarity index 99% rename from src/Entity/User.php rename to src/Module/Core/Domain/Entity/User.php index 38e789e..a4a098a 100644 --- a/src/Entity/User.php +++ b/src/Module/Core/Domain/Entity/User.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Entity; +namespace App\Module\Core\Domain\Entity; use ApiPlatform\Metadata\ApiProperty; use ApiPlatform\Metadata\ApiResource; diff --git a/src/Module/Core/_compat_user_alias.php b/src/Module/Core/_compat_user_alias.php new file mode 100644 index 0000000..3529be8 --- /dev/null +++ b/src/Module/Core/_compat_user_alias.php @@ -0,0 +1,8 @@ +