Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,19 @@
### Cache
- After creating/modifying API Platform resource classes, clear route cache: `php bin/console cache:clear --env=test`

## DDD Namespace Migration Patterns

- macOS `sed` does not support `\b` word boundaries — use `perl -pi` for namespace replacements
- When moving entities to a new namespace, check for **unqualified class references** that relied on same-namespace resolution (e.g., `User::class` in Interview entities that was resolved via `App\Entity` namespace)
- After moving entities, update `targetEntity:` references in **other** entities that point to the moved class (e.g., `User#interviews` → needs `use App\Interview\Infrastructure\Entity\Interview`)
- Non-Doctrine classes in `Infrastructure/Entity/` (like InterviewDistribution) must be excluded from service autodiscovery — they have constructor args that aren't services
- When moving subscribers out of `App\EventSubscriber\`, check if unused bindings remain (SmsSenderInterface, $env, MailerInterface) — Symfony will error on unused bindings. Also check the **destination** subscriber block has all needed bindings.
- DQL strings contain inline FQCNs (e.g., `FROM App\Entity\Interview i`) — must be updated alongside `use` statements
- Twig `controller()` calls contain inline FQCNs (e.g., `controller('App\\Controller\\FooController::action')`) — must be updated despite the "don't update Twig FQCN references" rule (that applies to `path()` route names, not controller class refs)
- `services.yaml` Twig extension blocks (`App\Twig\Extension\:`) must be updated when extensions move to a bounded context (e.g., `App\Organization\Twig\:`)
- For high-impact entities like Department (referenced by every context), update `use` statements in the **remaining** `App\Entity\*` files (User, AccessRule) that use unqualified class names that previously resolved via same-namespace
- `rm -rf var/cache/*` can fail with "Directory not empty" on macOS — use `find var/cache -type f -delete && find var/cache -type d -empty -delete` instead

## Entity Gotchas

### User
Expand Down Expand Up @@ -86,7 +99,7 @@
- `--filter DashboardApiTest` not `--filter Dashboard` (too broad)
- `composer test:parallel` uses 256M — OOMs at ~1020+ tests. Use `php -d memory_limit=512M` directly.
- SQLite column naming: entity `targetAudience` → column `target_audience` (snake_case in raw SQL)
- Test baseline: 1001 tests, 2978 assertions (after removing 7 controller test files replaced by API tests)
- Test baseline: 1011 tests, 2995 assertions

### Controller deprecation status
- 11 controllers fully covered by API: Department, UserAdmin, Semester, ChangeLog, SocialEvent, InterviewSchema, FieldOfStudy, Position, ExecutiveBoard, PasswordReset, Contact
Expand Down
1 change: 1 addition & 0 deletions apps/server/.env.test
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
APP_ENV=test
APP_DEBUG=1
CORS_ALLOW_ORIGIN='*'
DATABASE_URL=sqlite:///:memory:
21 changes: 20 additions & 1 deletion apps/server/config/packages/api_platform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,26 @@ api_platform:
description: 'REST API for Vektorprogrammet'
version: '1.0.0'
mapping:
paths: ['%kernel.project_dir%/src/App/Entity', '%kernel.project_dir%/src/App/ApiResource']
paths:
- '%kernel.project_dir%/src/App/Admission/Api/Resource'
- '%kernel.project_dir%/src/App/Admission/Infrastructure/Entity'
- '%kernel.project_dir%/src/App/Interview/Api/Resource'
- '%kernel.project_dir%/src/App/Interview/Infrastructure/Entity'
- '%kernel.project_dir%/src/App/Organization/Api/Resource'
- '%kernel.project_dir%/src/App/Organization/Infrastructure/Entity'
- '%kernel.project_dir%/src/App/Survey/Api/Resource'
- '%kernel.project_dir%/src/App/Survey/Infrastructure/Entity'
- '%kernel.project_dir%/src/App/Identity/Api/Resource'
- '%kernel.project_dir%/src/App/Identity/Infrastructure/Entity'
- '%kernel.project_dir%/src/App/Scheduling/Api/Resource'
- '%kernel.project_dir%/src/App/Scheduling/Infrastructure/Entity'
- '%kernel.project_dir%/src/App/Operations/Api/Resource'
- '%kernel.project_dir%/src/App/Operations/Infrastructure/Entity'
- '%kernel.project_dir%/src/App/Content/Api/Resource'
- '%kernel.project_dir%/src/App/Content/Infrastructure/Entity'
- '%kernel.project_dir%/src/App/Shared/Api/Resource'
- '%kernel.project_dir%/src/App/Shared/Entity'
- '%kernel.project_dir%/src/App/Support/Api/Resource'
defaults:
pagination_enabled: true
pagination_items_per_page: 30
Expand Down
58 changes: 53 additions & 5 deletions apps/server/config/packages/doctrine.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,59 @@ doctrine:
orm:
auto_generate_proxy_classes: '%kernel.debug%'
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
auto_mapping: true
auto_mapping: false
mappings:
App:
Admission:
is_bundle: false
type: attribute
dir: '%kernel.project_dir%/src/App/Entity'
prefix: 'App\Entity'
alias: App
dir: '%kernel.project_dir%/src/App/Admission/Infrastructure/Entity'
prefix: 'App\Admission\Infrastructure\Entity'
alias: Admission
Interview:
is_bundle: false
type: attribute
dir: '%kernel.project_dir%/src/App/Interview/Infrastructure/Entity'
prefix: 'App\Interview\Infrastructure\Entity'
alias: Interview
Organization:
is_bundle: false
type: attribute
dir: '%kernel.project_dir%/src/App/Organization/Infrastructure/Entity'
prefix: 'App\Organization\Infrastructure\Entity'
alias: Organization
Survey:
is_bundle: false
type: attribute
dir: '%kernel.project_dir%/src/App/Survey/Infrastructure/Entity'
prefix: 'App\Survey\Infrastructure\Entity'
alias: Survey
Identity:
is_bundle: false
type: attribute
dir: '%kernel.project_dir%/src/App/Identity/Infrastructure/Entity'
prefix: 'App\Identity\Infrastructure\Entity'
alias: Identity
Scheduling:
is_bundle: false
type: attribute
dir: '%kernel.project_dir%/src/App/Scheduling/Infrastructure/Entity'
prefix: 'App\Scheduling\Infrastructure\Entity'
alias: Scheduling
Operations:
is_bundle: false
type: attribute
dir: '%kernel.project_dir%/src/App/Operations/Infrastructure/Entity'
prefix: 'App\Operations\Infrastructure\Entity'
alias: Operations
Content:
is_bundle: false
type: attribute
dir: '%kernel.project_dir%/src/App/Content/Infrastructure/Entity'
prefix: 'App\Content\Infrastructure\Entity'
alias: Content
Shared:
is_bundle: false
type: attribute
dir: '%kernel.project_dir%/src/App/Shared/Entity'
prefix: 'App\Shared\Entity'
alias: Shared
10 changes: 5 additions & 5 deletions apps/server/config/packages/security.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ security:
providers: [db_username, db_email, db_company_email]
db_username:
entity:
class: App\Entity\User
class: App\Identity\Infrastructure\Entity\User
property: user_name
db_email:
entity:
class: App\Entity\User
class: App\Identity\Infrastructure\Entity\User
property: email
db_company_email:
entity:
class: App\Entity\User
class: App\Identity\Infrastructure\Entity\User
property: companyEmail

firewalls:
Expand Down Expand Up @@ -53,12 +53,12 @@ security:
pattern: ^/admin
http_basic: ~
provider: chain_provider
user_checker: App\Security\UserChecker
user_checker: App\Identity\Infrastructure\UserChecker
secured_area:
lazy: true
http_basic: ~
provider: chain_provider
user_checker: App\Security\UserChecker
user_checker: App\Identity\Infrastructure\UserChecker
entry_point: form_login
form_login:
login_path: /login
Expand Down
40 changes: 38 additions & 2 deletions apps/server/config/routes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,44 @@ api_login:
path: /api/login
methods: ['POST']

app:
resource: "../src/App/Controller/"
content:
resource: "../src/App/Content/Controller/"
type: attribute

support:
resource: "../src/App/Support/Controller/"
type: attribute

shared:
resource: "../src/App/Shared/Controller/"
type: attribute

operations:
resource: "../src/App/Operations/Controller/"
type: attribute

scheduling:
resource: "../src/App/Scheduling/Controller/"
type: attribute

survey:
resource: "../src/App/Survey/Controller/"
type: attribute

admission:
resource: "../src/App/Admission/Controller/"
type: attribute

interview:
resource: "../src/App/Interview/Controller/"
type: attribute

organization:
resource: "../src/App/Organization/Controller/"
type: attribute

identity:
resource: "../src/App/Identity/Controller/"
type: attribute

_liip_imagine:
Expand Down
Loading
Loading