An IA assisted dive into domain from legacy code

This commit is contained in:
2026-04-10 12:27:36 +02:00
parent f0bfb48acd
commit 3142cc1f45
7 changed files with 1153 additions and 9 deletions

View File

@@ -0,0 +1,28 @@
# <Any> Bundle Deep Dive
## Ubiquitous Language
Understand business terms, list them.
Propose adaptation if ambiguity.
## Domain Core
Identify what carries business meaning.
Need key entities. What is domain/ application/infra (logic from legacy code is not DDD)
Mainly in `src/.../[Entity, Model, Repository, Controller]/` paths
## Invariants / Concistency
Understand what's always be true, list them as rule.
## Cross-context Dependencies
Map coupling in contexts of bundles.
## DDD Slicing
Define migration-safe target model.
- Aggregates (target)
- Value Objects (first candidates)
- Domain services to extract
- Repository interfaces (domain-facing)
- Domain events (optional first)
## Reading Order
Fast onboarding for understanding bundle

View File

@@ -0,0 +1,181 @@
# ASP Bundle Deep Dive
## Ubiquitous Language
- **FicheContratAsp**: ASP-facing contract dossier with ASP IDs, statuses, and errors.
Path: `src/Uriae/AspBundle/Entity/FicheContratAsp.php`
- **TypeContratAsp**: ASP contract typology (`NPT`, `I`, `R1..R99`) and renewal semantics.
Path: `src/Uriae/AspBundle/Entity/TypeContratAsp.php`
- **Suivi**: trace line for ASP file exchanges.
Path: `src/Uriae/AspBundle/Entity/Suivi.php`
- **ModificationAsp**: ASP modification request with dedicated lifecycle.
Path: `src/Uriae/AspBundle/Entity/ModificationAsp.php`
- **FichierEnvoiAsp / FichierRetourAsp**: outbound/inbound ASP files.
Paths: `src/Uriae/AspBundle/Entity/AbstractFichierAsp.php`, `src/Uriae/AspBundle/Entity/FichierRetourAsp.php`
- **SuiviMensuelEtSortieAsp**: monthly batch submission root.
Path: `src/Uriae/AspBundle/Entity/SuiviMensuelEtSortieAsp.php`
- **FicheSuiviMensuelEtSortieAsp**: monthly line per contract.
Path: `src/Uriae/AspBundle/Entity/FicheSuiviMensuelEtSortieAsp.php`
- **SortieEtSuiviAnnuel / FicheSortieEtSuiviAnnuel**: annual exit/follow-up model.
Paths: `src/Uriae/AspBundle/Entity/SortieEtSuiviAnnuel.php`, `src/Uriae/AspBundle/Entity/FicheSortieEtSuiviAnnuel.php`
- **Erreur**: unified internal/return error catalog by ASP domain type.
Path: `src/Uriae/AspBundle/Entity/Erreur.php`
## Domain Core
- **De facto root: `FicheContratAsp`**
- Carries ASP IDs, multi-channel statuses (inscription/sortie/renewal), ASP and internal errors.
- Hard-linked to `Contrat` (Employee context).
- Paths:
- `src/Uriae/AspBundle/Entity/FicheContratAsp.php`
- `src/Uriae/EmployeeBundle/Entity/Contrat.php`
- **Monthly submission cluster**
- Root: `SuiviMensuelEtSortieAsp`
- Child lines: `FicheSuiviMensuelEtSortieAsp`
- Paths:
- `src/Uriae/AspBundle/Entity/SuiviMensuelEtSortieAsp.php`
- `src/Uriae/AspBundle/Entity/FicheSuiviMensuelEtSortieAsp.php`
- **Annual submission cluster**
- Root: `SortieEtSuiviAnnuel`
- Child lines: `FicheSortieEtSuiviAnnuel`
- Paths:
- `src/Uriae/AspBundle/Entity/SortieEtSuiviAnnuel.php`
- `src/Uriae/AspBundle/Entity/FicheSortieEtSuiviAnnuel.php`
- **Status behavior**
- Generic status set in `StatusTrait`.
- Modification flow has separate status constants.
- Paths:
- `src/Uriae/AspBundle/Traits/StatusTrait.php`
- `src/Uriae/AspBundle/Entity/ModificationAsp.php`
## Invariants / Concistency
- `src/Uriae/AspBundle/Traits/StatusTrait.php`
- Status is constrained to allowed values.
- `src/Uriae/AspBundle/Entity/FicheContratAsp.php`
- Clearing both ASP IDs resets auto flags/dates and reverts transfer status branch.
- Setting both ASP IDs manually marks manual provenance and transmitted status.
- `src/Uriae/AspBundle/Entity/TypeContratAsp.php`
- Contract type codes constrained to `NPT`, `I`, `R1..R99`.
- Renewal semantics inferred from label set.
- `src/Uriae/AspBundle/Repository/FicheContratAspRepository.php`
- Inscription/renewal/sortie/modification candidate filtering encoded via cross-context query rules.
- Monthly candidate contracts depend on period overlap + ASP IDs presence.
- `src/Uriae/AspBundle/Validator/ErreursInternesValidator.php`
- EI duration <= 24 months.
- Work hours/salary/annexe prerequisites.
- Renewal sequence integrity and ASP ID prerequisites.
- Aid/resource/PE/agrement consistency mapped to error catalog entries.
- `src/Uriae/AspBundle/Model/FichierRetourAsp/ProcessFichierRetourAsp.php`
- Return-line length depends on SIAE type.
- `src/Uriae/AspBundle/Model/FichierRetourAsp/ProcessFichierRetourAspSuivieMensuelEtSortie.php`
- Monthly return line must have expected structure and success code handling.
- `src/Uriae/AspBundle/Model/FichierRetourAsp/ProcessFichierRetourAspSortieEtSuiviAnnuel.php`
- Annual return parsing enforces line count format and matching sent file expectations.
## Cross-context Dependencies
- **ASP -> Employee**
- `FicheContratAsp` linked to `Contrat`.
- ASP processing mutates employee-related fields.
- Paths:
- `src/Uriae/AspBundle/Entity/FicheContratAsp.php`
- `src/Uriae/EmployeeBundle/Entity/Contrat.php`
- `src/Uriae/AspBundle/Manager/AspFicheContratManager.php`
- **ASP -> Structure**
- Depends on structure metadata (`SiaeType`, `AnnexeFinanciere`, measures, ASP IDs).
- Paths:
- `src/Uriae/StructureBundle/Entity/Structure.php`
- `src/Uriae/StructureBundle/Entity/SiaeType.php`
- `src/Uriae/StructureBundle/Entity/AnnexeFinanciere.php`
- **ASP -> Union**
- Uses sortie/typology references for mappings and checks.
- Paths:
- `src/Uriae/UnionBundle/Entity/SituationSortie.php`
- `src/Uriae/UnionBundle/Entity/TypeSituationSortie.php`
- **ASP -> Suivi (indirect reporting coupling)**
- Aggregated reporting joins via broader employee/bilan query paths.
- Paths:
- `src/Uriae/EmployeeBundle/Repository/EmployeeRepository.php`
- `src/Uriae/BilanBundle/Model/Formatter.php`
## DDD Slicing
- **Aggregates (candidate)**
- `AspContractDossier` (replacement concept for `FicheContratAsp`).
- `AspModificationRequest`.
- `AspMonthlySubmission` + `MonthlySubmissionLine`.
- `AspAnnualExitSubmission` + `AnnualExitSubmissionLine`.
- **Domain services (candidate)**
- `AspEligibilityPolicy`.
- `AspInternalErrorPolicy`.
- `AspReturnFileParser` (pure parsing).
- `AspSubmissionDomainService` (state transitions and domain decisions).
- **Repository interfaces (domain-facing)**
- `AspContractDossierRepository`.
- `AspMonthlySubmissionRepository`.
- `AspAnnualExitSubmissionRepository`.
- `AspErrorCatalogRepository`.
- **Domain events (candidate)**
- `AspSubmissionRequested`.
- `AspSubmissionAccepted`.
- `AspSubmissionRejected`.
- `AspIdsAssignedToContract`.
- `AspInternalRuleViolationDetected`.
- `AspMonthlyLineAccepted`.
- `AspMonthlyLineRejected`.
- **Value objects (candidate)**
- `AspEmployeeId`, `AspContractId`.
- `TransmissionStatus`.
- `AspErrorCode`.
- `SubmissionPeriod`.
- `AnnexeNumber`.
- `MesureCode`.
- `AspLineNumber`.
## Reading Order
1. `src/Uriae/AspBundle/Entity/FicheContratAsp.php`
2. `src/Uriae/AspBundle/Traits/StatusTrait.php`
3. `src/Uriae/AspBundle/Entity/TypeContratAsp.php`
4. `src/Uriae/AspBundle/Repository/FicheContratAspRepository.php`
5. `src/Uriae/AspBundle/Validator/ErreursInternesValidator.php`
6. `src/Uriae/AspBundle/Manager/AbstractAspManager.php`
7. `src/Uriae/AspBundle/Manager/AspFicheContratManager.php`
8. `src/Uriae/AspBundle/Model/FichierRetourAsp/ProcessFichierRetourAsp.php`
9. `src/Uriae/AspBundle/Model/FichierRetourAsp/ProcessFichierRetourAspRenouvellement.php`
10. `src/Uriae/AspBundle/Model/FichierRetourAsp/ProcessFichierRetourAspModification.php`
11. `src/Uriae/AspBundle/Controller/AbstractInscriptionRenouvellementSortieController.php`
12. `src/Uriae/AspBundle/Controller/InscriptionController.php`
13. `src/Uriae/AspBundle/Controller/RenouvellementController.php`
14. `src/Uriae/AspBundle/Controller/ModificationController.php`
15. `src/Uriae/AspBundle/Entity/SuiviMensuelEtSortieAsp.php`
16. `src/Uriae/AspBundle/Entity/FicheSuiviMensuelEtSortieAsp.php`
17. `src/Uriae/AspBundle/Manager/SuiviMensuelManager.php`
18. `src/Uriae/AspBundle/Model/FichierRetourAsp/ProcessFichierRetourAspSuivieMensuelEtSortie.php`
19. `src/Uriae/AspBundle/Entity/SortieEtSuiviAnnuel.php`
20. `src/Uriae/AspBundle/Entity/FicheSortieEtSuiviAnnuel.php`
21. `src/Uriae/AspBundle/Model/SortieEtSuiviAnnuelManager.php`
22. `src/Uriae/AspBundle/Model/FichierRetourAsp/ProcessFichierRetourAspSortieEtSuiviAnnuel.php`
23. `src/Uriae/EmployeeBundle/Entity/Contrat.php`
24. `src/Uriae/EmployeeBundle/Controller/ContratsController.php`
25. `src/Uriae/EmployeeBundle/Form/Type/ContratType.php`
26. `src/Uriae/StructureBundle/Entity/SiaeType.php`
27. `src/Uriae/UnionBundle/Entity/TypeSituationSortie.php`

View File

@@ -2,6 +2,203 @@
## Ubiquitous Language ## Ubiquitous Language
- **Employee / Salarie / Employe**: central person lifecycle record.
Path: `src/Uriae/EmployeeBundle/Entity/Employee.php`
- **TypeEmployee**: profile category driving workflows/filters.
Paths: `src/Uriae/EmployeeBundle/Entity/Employee.php`, `src/Uriae/EmployeeBundle/Repository/EmployeeRepository.php`
- **Employee state** (`Postulant`, `En contrat`, `Sorti`): lifecycle projection from contracts/sortie.
Paths: `src/Uriae/EmployeeBundle/Entity/Employee.php`, `src/Uriae/EmployeeBundle/Model/EmployeeStateUpdater.php`
- **Contrat**: contract period + métier + site + ASP bridge.
Path: `src/Uriae/EmployeeBundle/Entity/Contrat.php`
- **ParcoursInsertion**: insertion timeline + sortie segments.
Path: `src/Uriae/EmployeeBundle/Entity/ParcoursInsertion.php`
- **SituationSortie**: exit segment with dates/type.
Path: `src/Uriae/UnionBundle/Entity/SituationSortie.php`
- **FirstHome**: intake/prescriber/resource/mutuelle context.
Path: `src/Uriae/EmployeeBundle/Entity/FirstHome.php`
- **AdministrativeInformation**: civil/admin identity block (NIR/NTT, nationality, birth info).
Path: `src/Uriae/EmployeeBundle/Entity/AdministrativeInformation.php`
- **PersonnalDetail**: address/contact block.
Path: `src/Uriae/EmployeeBundle/Entity/PersonnalDetail.php`
- **HiringStatus**: eligibility and social condition matrix (RSA, AAH, RQTH, etc.).
Path: `src/Uriae/EmployeeBundle/Entity/HiringStatus.php`
## Domain Core ## Domain Core
- **De facto root: `Employee`**
- Owns/coordinates personal, admin, intake, insertion, contracts, jobs, medical visits, receipts, competencies.
- Path: `src/Uriae/EmployeeBundle/Entity/Employee.php`
- **Contract lifecycle cluster**
- `Contrat` + ASP contract dossier + sortie semantics.
- Paths:
- `src/Uriae/EmployeeBundle/Entity/Contrat.php`
- `src/Uriae/AspBundle/Entity/FicheContratAsp.php`
- `src/Uriae/UnionBundle/Entity/SituationSortie.php`
- **Insertion timeline cluster**
- `ParcoursInsertion` with associated sortie segments.
- Path: `src/Uriae/EmployeeBundle/Entity/ParcoursInsertion.php`
- **Profile/intake clusters**
- `PersonnalDetail`, `AdministrativeInformation`, `HiringStatus`, `FirstHome`.
- Paths:
- `src/Uriae/EmployeeBundle/Entity/PersonnalDetail.php`
- `src/Uriae/EmployeeBundle/Entity/AdministrativeInformation.php`
- `src/Uriae/EmployeeBundle/Entity/HiringStatus.php`
- `src/Uriae/EmployeeBundle/Entity/FirstHome.php`
## Invariants / Concistency ## Invariants / Concistency
- `src/Uriae/EmployeeBundle/Entity/Employee.php`
- State constrained to known values.
- `civility` drives derived sex.
- Sortie considered complete only when both date + type are present.
- Contract timeline helpers (first/last/previous/initial logic).
- `src/Uriae/EmployeeBundle/Model/EmployeeStateUpdater.php`
- Recomputes state from contracts/sortie chronology.
- `src/Uriae/EmployeeBundle/Entity/Contrat.php`
- Contract date ordering constraints.
- ROME validity constraints.
- ASP-specific duration-in-months rounding behavior.
- `src/Uriae/EmployeeBundle/Form/Validator/DateEffectiveContratValidator.php`
- Prevents new/update contract when previous relevant contract has no effective end date.
- `src/Uriae/EmployeeBundle/Form/Validator/CodeRomeValidator.php`
- Rejects expired ROME codes at contract start.
- Adds date-threshold behavior around 2022 policy.
- `src/Uriae/EmployeeBundle/Entity/ParcoursInsertion.php`
- Agreement number format constraints.
- First/last sortie determination rules by entry dates.
- `src/Uriae/UnionBundle/Entity/SituationSortie.php`
- Sortie type/date consistency (both required together).
- `src/Uriae/EmployeeBundle/Model/SituationSortieUpdater.php`
- Rebuilds contract-sortie mapping.
- Removes empty sorties.
- Creates sortie for orphan contracts.
- Triggers state refresh.
- `src/Uriae/EmployeeBundle/Entity/AdministrativeInformation.php`
- Birth date required and validated.
- NIR/NTT consistency via validators.
- `src/Uriae/EmployeeBundle/Form/Validator/SocialSecurityNumberValidator.php`
- NIR shape + civility constraints.
- NTT fallback requirement when NIR absent in specific cases.
- `src/Uriae/EmployeeBundle/Form/Validator/TemporaryTechnicalNumberValidator.php`
- NIR/NTT mutual exclusivity.
- `src/Uriae/EmployeeBundle/Entity/HiringStatus.php`
- Coherence between social flags (RSA/ayant-droit, sans-ressources, AAH-handicap linkage).
- Young-in-difficulty age window logic based on DOB + first contract.
- `src/Uriae/EmployeeBundle/Entity/PersonnalDetail.php`
- At least one phone required.
- Phone/address/town/zip consistency checks.
- `src/Uriae/EmployeeBundle/Entity/FirstHome.php`
- PE inscription-dependent fields required conditionally.
- PE identifier formatting.
- Conventionneur-only partner constraint.
## Cross-context Dependencies
- **Employee -> Suivi**
- Paths:
- `src/Uriae/EmployeeBundle/Entity/Employee.php`
- `src/Uriae/SuiviBundle/Entity/Accompagnement.php`
- `src/Uriae/SuiviBundle/Entity/Evaluation.php`
- `src/Uriae/SuiviBundle/Entity/Problematique.php`
- `src/Uriae/SuiviBundle/Entity/Potentiel.php`
- DDD direction idea: Suivi consumes Employee identity/reference, not full object graph.
- **Employee -> ASP**
- Paths:
- `src/Uriae/EmployeeBundle/Entity/Contrat.php`
- `src/Uriae/AspBundle/Entity/FicheContratAsp.php`
- `src/Uriae/AspBundle/Manager/AspFicheContratManager.php`
- DDD direction idea: ASP as downstream integration context reacting to contract events.
- **Employee -> Union**
- Paths:
- `src/Uriae/EmployeeBundle/Entity/ParcoursInsertion.php`
- `src/Uriae/UnionBundle/Entity/SituationSortie.php`
- DDD direction idea: shared kernel or ACL around sortie taxonomy.
- **Employee <-> Structure**
- Paths:
- `src/Uriae/EmployeeBundle/Entity/Employee.php`
- `src/Uriae/StructureBundle/Entity/Structure.php`
- DDD direction idea: explicit IDs/reference objects instead of deep bidirectional graph.
## DDD Slicing
- **Aggregates (candidate)**
- `EmployeeProfile` (identity + personal/admin + hiring status).
- `EmploymentLifecycle` (contracts + state projection + timeline fields).
- `InsertionJourney` (parcours + sortie segments).
- `IntakeContext` (first home/resources/mutuelle data).
- `EmployeeCompetency` (employee-competence assignment).
- **Domain services (candidate)**
- `EmployeeStatePolicy` (from `EmployeeStateUpdater`).
- `SituationSortieRebuilder` (from `SituationSortieUpdater`).
- `ContractTimelineCalculator` (first/last contract rules).
- `HiringStatusPolicy` (coherence rules currently scattered in entity callbacks/validators).
- **Repository interfaces (domain-facing)**
- `EmployeeRepository` (aggregate retrieval only).
- `ContractRepository` (active/last/chronology views).
- `InsertionJourneyRepository`.
- Separate read-model queries for reporting/export/bilan.
- **Domain events (candidate)**
- `ContractAdded`, `ContractUpdated`, `ContractRemoved`.
- `EmployeeStateChanged`.
- `SituationSortieRecomputed`.
- `AspSubmissionAcknowledged` (integration side).
- **Value objects (candidate)**
- `EmployeeState`, `EmployeeTypeSlug`.
- `ContractPeriod`.
- `SocialSecurityNumber`, `TemporaryTechnicalNumber`.
- `AgreementNumber`, `PoleEmploiId`.
- `PhoneNumber`, `PostalAddress`, `ZipCode`.
`src/Uriae/EmployeeBundle/Entity/Employee.php`
## Reading Order (Employee domain deep dive)
1. `src/Uriae/EmployeeBundle/Entity/Employee.php`
2. `src/Uriae/EmployeeBundle/Entity/Contrat.php`
3. `src/Uriae/EmployeeBundle/Entity/ParcoursInsertion.php`
4. `src/Uriae/UnionBundle/Entity/SituationSortie.php`
5. `src/Uriae/EmployeeBundle/Model/SituationSortieUpdater.php`
6. `src/Uriae/EmployeeBundle/Model/EmployeeStateUpdater.php`
7. `src/Uriae/EmployeeBundle/EventSubscriber/ContratChangeSubscriber.php`
8. `src/Uriae/EmployeeBundle/Entity/AdministrativeInformation.php`
9. `src/Uriae/EmployeeBundle/Entity/HiringStatus.php`
10. `src/Uriae/EmployeeBundle/Entity/PersonnalDetail.php`
11. `src/Uriae/EmployeeBundle/Entity/FirstHome.php`
12. `src/Uriae/EmployeeBundle/Entity/Pmsmp.php`
13. `src/Uriae/EmployeeBundle/Form/Validator/DateEffectiveContratValidator.php`
14. `src/Uriae/EmployeeBundle/Form/Validator/CodeRomeValidator.php`
15. `src/Uriae/EmployeeBundle/Form/Validator/SocialSecurityNumberValidator.php`
16. `src/Uriae/EmployeeBundle/Form/Validator/TemporaryTechnicalNumberValidator.php`
17. `src/Uriae/EmployeeBundle/Repository/EmployeeRepository.php`
18. `src/Uriae/EmployeeBundle/Repository/ContratRepository.php`
19. `src/Uriae/EmployeeBundle/Controller/ContratsController.php`
20. `src/Uriae/EmployeeBundle/Controller/InsertionController.php`
21. `src/Uriae/AspBundle/Entity/FicheContratAsp.php`
22. `src/Uriae/AspBundle/Manager/AspFicheContratManager.php`
23. `src/Uriae/SuiviBundle/Entity/Accompagnement.php`
24. `src/Uriae/SuiviBundle/Entity/Evaluation.php`
25. `src/Uriae/StructureBundle/Entity/Structure.php`

View File

@@ -4,23 +4,24 @@
### Core Domain ### Core Domain
- `src/Uriae/EmployeeBundle` : core employee lifecycle (identity, admin info, contracts, insertion path, documents, competencies) - `src/Uriae/EmployeeBundle` : core employee lifecycle
- `src/Uriae/SuiviBundle`: - `src/Uriae/SuiviBundle`: follow-up domain
- `src/Uriae/AspBundle`: - `src/Uriae/AspBundle`: ASP integration boundary
- `src/Uriae/StructureBundle`: - `src/Uriae/StructureBundle`: tenant/organization scope
- `src/Uriae/UnionBundle`: - `src/Uriae/UnionBundle`: shared referentials
### Metrics Domain ### Metrics Domain
- `src/Uriae/BilanBundle`: - `src/Uriae/BilanBundle`: cross-context reporting/metrics aggregation
### Pipeline Domain ### Pipeline Domain
- `src/Uriae/ImportBundle`: - `src/Uriae/ImportBundle`: batch ingestion pipelines
- `src/Uriae/ExportBundle`: - `src/Uriae/ExportBundle`: batch extraction pipelines
## InDepth maps ## InDepth maps
### EmployeeBundle ### EmployeeBundle
- **Core entities** - **Core entities**
- `src/Uriae/EmployeeBundle/Entity/Employee.php` - `src/Uriae/EmployeeBundle/Entity/Employee.php`
- `src/Uriae/EmployeeBundle/Entity/Contrat.php` - `src/Uriae/EmployeeBundle/Entity/Contrat.php`
@@ -46,3 +47,170 @@
- `src/Uriae/EmployeeBundle/Command/UpdateSituationSortieCommand.php` - `src/Uriae/EmployeeBundle/Command/UpdateSituationSortieCommand.php`
- `src/Uriae/EmployeeBundle/Command/UpdateContratDatesEmployeCommand.php` - `src/Uriae/EmployeeBundle/Command/UpdateContratDatesEmployeCommand.php`
- `src/Uriae/EmployeeBundle/Command/AnonymisationProcessCommand.php` - `src/Uriae/EmployeeBundle/Command/AnonymisationProcessCommand.php`
### SuiviBundle
- **Core entities**
- `src/Uriae/SuiviBundle/Entity/Action.php` (abstract parent).
- `src/Uriae/SuiviBundle/Entity/Accompagnement.php`.
- `src/Uriae/SuiviBundle/Entity/Evaluation.php`.
- `src/Uriae/SuiviBundle/Entity/Event.php`.
- `src/Uriae/SuiviBundle/Entity/Rdv.php`.
- `src/Uriae/SuiviBundle/Entity/Problematique.php`.
- `src/Uriae/SuiviBundle/Entity/FormationInterne.php`.
- `src/Uriae/SuiviBundle/Entity/ParticipationFormation.php`.
- **Repositories**
- `src/Uriae/SuiviBundle/Repository/AccompagnementRepository.php`.
- `src/Uriae/SuiviBundle/Repository/EvaluationRepository.php`.
- **Forms**
- `src/Uriae/SuiviBundle/Form/Type/AccompagnementType.php`.
- `src/Uriae/SuiviBundle/Form/Type/EvaluationType.php`.
- `src/Uriae/SuiviBundle/Form/Type/RdvType.php`.
- `src/Uriae/SuiviBundle/Form/Type/ProblematiqueType.php`.
- **Controllers**
- `src/Uriae/SuiviBundle/Controller/SuiviController.php`.
- `src/Uriae/SuiviBundle/Controller/AccompagnementController.php`.
- `src/Uriae/SuiviBundle/Controller/BilanIndividuelController.php`.
- **Services/Models**
- `src/Uriae/SuiviBundle/Model/FormatterBilanIndividuel.php`.
- **Fixtures**
- `src/Uriae/SuiviBundle/DataFixtures/ORM/shared/LoadTypeAction.php`.
- `src/Uriae/SuiviBundle/DataFixtures/ORM/shared/LoadReferentielEvaluation.php`.
- **Commands**
- `src/Uriae/SuiviBundle/Command/MigrateActionCommand.php`.
- `src/Uriae/SuiviBundle/Command/DesactivateHabilitationsCommand.php`.
### AspBundle
- **Core entities**
- `src/Uriae/AspBundle/Entity/FicheContratAsp.php`.
- `src/Uriae/AspBundle/Entity/ModificationAsp.php`.
- `src/Uriae/AspBundle/Entity/Suivi.php`.
- `src/Uriae/AspBundle/Entity/FichierEnvoiAsp.php`.
- `src/Uriae/AspBundle/Entity/FichierRetourAsp.php`.
- **Repositories**
- `src/Uriae/AspBundle/Repository/FicheContratAspRepository.php`.
- **Forms**
- `src/Uriae/AspBundle/Form/Type/FicheContratAspType.php`.
- `src/Uriae/AspBundle/Form/Type/FichierRetourAspType.php`.
- **Controllers**
- `src/Uriae/AspBundle/Controller/InscriptionController.php`.
- `src/Uriae/AspBundle/Controller/ModificationController.php`.
- `src/Uriae/AspBundle/Controller/SuiviMensuelEtSortieController.php`.
- **Managers**
- `src/Uriae/AspBundle/Manager/AspFicheContratManager.php`.
- `src/Uriae/AspBundle/Manager/InscriptionManager.php`.
- `src/Uriae/AspBundle/Manager/ModificationManager.php`.
- `src/Uriae/AspBundle/Manager/RenouvellementManager.php`.
- **Fixtures**
- `src/Uriae/AspBundle/DataFixtures/ORM/shared/LoadTypeContratAsp.php`.
- `src/Uriae/AspBundle/DataFixtures/ORM/shared/LoadNatureEmploi.php`.
- **Commands**
- `src/Uriae/AspBundle/Command/UpdateAspFileCommand.php`.
- `src/Uriae/AspBundle/Command/MigrateRenouvellementCommand.php`.
### StructureBundle
- **Core entities**
- `src/Uriae/StructureBundle/Entity/Structure.php`.
- `src/Uriae/StructureBundle/Entity/SiteTravail.php`.
- `src/Uriae/StructureBundle/Entity/Alerte.php`.
- `src/Uriae/StructureBundle/Entity/Competence.php`.
- `src/Uriae/StructureBundle/Entity/HeadOffice.php`.
- **Repositories**
- `src/Uriae/StructureBundle/Repository/StructureRepository.php`.
- `src/Uriae/StructureBundle/Repository/CompetenceRepository.php`.
- **Forms**
- `src/Uriae/StructureBundle/Form/Type/AddStructureFormType.php`.
- `src/Uriae/StructureBundle/Form/Type/InformationStructureType.php`.
- `src/Uriae/StructureBundle/Form/Type/AlerteType.php`.
- **Controllers**
- `src/Uriae/StructureBundle/Controller/StructureController.php`.
- **Services/Models**
- `src/Uriae/StructureBundle/Model/EvaluationUpdater.php`.
- `src/Uriae/StructureBundle/Model/DiaryHandler.php`.
- **Fixtures**
- `src/Uriae/StructureBundle/DataFixtures/ORM/shared/LoadTownDepartementRegion.php`.
- `src/Uriae/StructureBundle/DataFixtures/ORM/shared/LoadTypeSiae.php`.
- `src/Uriae/StructureBundle/DataFixtures/ORM/shared/LoadFormeJuridique.php`.
- **Commands**
- `src/Uriae/StructureBundle/Command/UpdateStructureEvaluationsCommand.php`.
- `src/Uriae/StructureBundle/Command/AddAlerteCommand.php`.
- `src/Uriae/StructureBundle/Command/SendDiaryMailerCommand.php`.
### UnionBundle
- **Core entities**
- `src/Uriae/UnionBundle/Entity/Partenaire.php`.
- `src/Uriae/UnionBundle/Entity/SituationSortie.php`.
- `src/Uriae/UnionBundle/Entity/TypeSituationSortie.php`.
- `src/Uriae/UnionBundle/Entity/Conventionnement.php`.
- `src/Uriae/UnionBundle/Entity/Union.php`.
- **Repositories**
- `src/Uriae/UnionBundle/Repository/PartenaireRepository.php`.
- `src/Uriae/UnionBundle/Repository/SituationSortieRepository.php`.
- **Forms**
- `src/Uriae/UnionBundle/Form/Type/PartenaireType.php`.
- `src/Uriae/UnionBundle/Form/Type/SituationSortieType.php`.
- `src/Uriae/UnionBundle/Form/Type/ConventionnementType.php`.
- **Controllers**
- `src/Uriae/UnionBundle/Controller/ReferentielInsertionController.php`.
- `src/Uriae/UnionBundle/Controller/SituationsSalariesController.php`.
- **Fixtures**
- `src/Uriae/UnionBundle/DataFixtures/ORM/shared/LoadTypeSituationsSortie.php`.
- `src/Uriae/UnionBundle/DataFixtures/ORM/shared/LoadTypePartenaire.php`.
- `src/Uriae/UnionBundle/DataFixtures/ORM/shared/LoadConventionnement.php`.
### Others Bundles
- **Bilan**
- `src/Uriae/BilanBundle/Controller/BilanController.php`.
- `src/Uriae/BilanBundle/Model/Formatter.php`.
- `src/Uriae/BilanBundle/Form/Model/Filter.php`.
- `src/Uriae/BilanBundle/Form/Model/FilterUnion.php`.
- `src/Uriae/BilanBundle/Form/Model/FilterFactory.php`.
- **Import**
- `src/Uriae/ImportBundle/Controller/ImportController.php`.
- `src/Uriae/ImportBundle/Model/Import/ImportFactory.php`.
- `src/Uriae/ImportBundle/Model/Import/AbstractImport.php`.
- `src/Uriae/ImportBundle/Model/Import/ImportSalarie.php`.
- `src/Uriae/ImportBundle/Model/Import/ImportContrat.php`.
- `src/Uriae/ImportBundle/Model/Import/ImportParcours.php`.
- `src/Uriae/ImportBundle/Model/Import/ImportExportAsp.php`.
- **Export**
- `src/Uriae/ExportBundle/Controller/ExportController.php`.
- `src/Uriae/ExportBundle/Model/Export/AbstractExport.php`.
- `src/Uriae/ExportBundle/Model/Export/ExportFactory.php`.
- `src/Uriae/ExportBundle/Model/Export/ExportSalarie.php`.
- `src/Uriae/ExportBundle/Model/Export/ExportContrat.php`.
- `src/Uriae/ExportBundle/Model/Export/ExportParcours.php`.
- `src/Uriae/ExportBundle/Model/Export/ExportSuivi.php`.
## Cross-context Dependencies
- **Employee <-> Suivi**
- `src/Uriae/EmployeeBundle/Entity/Employee.php` references many Suivi entities.
- `src/Uriae/SuiviBundle/Controller/*` pivot around `Employee`.
- `src/Uriae/SuiviBundle/Form/Type/AccompagnementType.php` mixes Employee + Partenaire + Structure data.
- **Employee <-> ASP**
- `src/Uriae/EmployeeBundle/Entity/Contrat.php` owns ASP link.
- `src/Uriae/EmployeeBundle/Controller/ContratsController.php` includes ASP behavior.
- `src/Uriae/AspBundle/Repository/FicheContratAspRepository.php` joins Contract/Employee/Structure.
- **Employee <-> Union**
- `src/Uriae/EmployeeBundle/Entity/Contrat.php` links sortie taxonomy.
- `src/Uriae/EmployeeBundle/Model/SituationSortieUpdater.php` manipulates Union sortie references.
- `src/Uriae/EmployeeBundle/Repository/EmployeeRepository.php` uses sortie semantics for metrics.
- **Structure as tenancy seam**
- `src/Uriae/StructureBundle/Entity/Structure.php` is shared by User/Employee/Asp/Suivi.
- `src/Uriae/AspBundle/Manager/AspFicheContratManager.php` requires structure-level configuration.
- `src/Uriae/ImportBundle/Controller/ImportController.php` and `src/Uriae/ExportBundle/Controller/ExportController.php` are structure-scoped.
- **Bilan as aggregate seam**
- `src/Uriae/BilanBundle/Model/Formatter.php` crosses Employee + Suivi + Union + Asp + Structure.
- `src/Uriae/BilanBundle/Controller/BilanController.php` orchestrates cross-context queries.
## Reading Order

View File

@@ -0,0 +1,199 @@
# Structure Bundle Deep Dive
## Ubiquitous Language
- **Structure**: tenant-like operational organization that owns users/employees/configuration.
Path: `src/Uriae/StructureBundle/Entity/Structure.php`
- **HeadOffice / Groupe**: grouping of structures with admin ownership.
Path: `src/Uriae/StructureBundle/Entity/HeadOffice.php`
- **SiaeType**: structure typology and ASP capabilities (`aspEnabled`, `aspFileEnabled`, `mesure`, `idAsp`).
Path: `src/Uriae/StructureBundle/Entity/SiaeType.php`
- **FormeJuridique**: legal form reference.
Path: `src/Uriae/StructureBundle/Entity/FormeJuridique.php`
- **Town / Department / Region**: territorial reference model.
Path: `src/Uriae/StructureBundle/Entity/Town.php`
- **SiteTravail**: work site linked to structure.
Path: `src/Uriae/StructureBundle/Entity/SiteTravail.php`
- **Sector**: operational sector linked to structure.
Path: `src/Uriae/StructureBundle/Entity/Sector.php`
- **PersonneContact**: structure contact person.
Path: `src/Uriae/StructureBundle/Entity/PersonneContact.php`
- **AnnexeFinanciere**: yearly annex identifier for structure financing context.
Path: `src/Uriae/StructureBundle/Entity/AnnexeFinanciere.php`
- **ChiffreCle** / **Financement**: yearly KPI and funding model.
Paths: `src/Uriae/StructureBundle/Entity/ChiffreCle.php`, `src/Uriae/StructureBundle/Entity/Financement.php`
- **Alerte**: threshold rule per type with display/order metadata.
Path: `src/Uriae/StructureBundle/Entity/Alerte.php`
- **Diary / DiaryEvent / DiaryMailer**: operational alert calendar and recipients.
Paths: `src/Uriae/StructureBundle/Entity/Diary.php`, `src/Uriae/StructureBundle/Entity/DiaryEvent.php`, `src/Uriae/StructureBundle/Entity/DiaryMailer.php`
- **Competence**: structure-scoped competence catalog reused by employees.
Path: `src/Uriae/StructureBundle/Entity/Competence.php`
- **Fusion**: merge workflow between structures with cross-context remapping.
Path: `src/Uriae/StructureBundle/Controller/StructureController.php`
## Domain Core
- **Likely root today: `Structure`**
- Central owner of users, employees, sectors, sites, alerts, diary, annexes, and financial records.
- Paths:
- `src/Uriae/StructureBundle/Entity/Structure.php`
- `src/Uriae/StructureBundle/Repository/StructureRepository.php`
- **Monitoring configuration cluster**
- `Alerte`, `Diary`, `DiaryEvent`, `DiaryMailer`.
- Paths:
- `src/Uriae/StructureBundle/Entity/Alerte.php`
- `src/Uriae/StructureBundle/Entity/Diary.php`
- `src/Uriae/StructureBundle/Entity/DiaryEvent.php`
- `src/Uriae/StructureBundle/Entity/DiaryMailer.php`
- **Profile and topology cluster**
- Identity/legal/contact + work organization (`SiteTravail`, `Sector`).
- Paths:
- `src/Uriae/StructureBundle/Entity/Structure.php`
- `src/Uriae/StructureBundle/Entity/FormeJuridique.php`
- `src/Uriae/StructureBundle/Entity/SiaeType.php`
- `src/Uriae/StructureBundle/Entity/SiteTravail.php`
- `src/Uriae/StructureBundle/Entity/Sector.php`
- **Financial cluster**
- Annex, key figures, financings.
- Paths:
- `src/Uriae/StructureBundle/Entity/AnnexeFinanciere.php`
- `src/Uriae/StructureBundle/Entity/ChiffreCle.php`
- `src/Uriae/StructureBundle/Entity/Financement.php`
- **Boundary reality**
- Structure aggregate currently directly traverses multiple contexts (Employee/User/Suivi/Union/Asp), especially in controller workflows.
## Invariants / Concistency
- `src/Uriae/StructureBundle/Entity/Structure.php`
- Structure name uniqueness.
- Mandatory fields for information and characteristics contexts.
- SIRET length and structural validation coupling.
- Town cannot be sentinel invalid value.
- At least one activity sector required.
- Category activity constrained to a fixed set of values.
- Bidirectional consistency for collections (users, employees, sectors, sites, alerts, diary).
- `src/Uriae/StructureBundle/Form/Validator/SiretValidator.php`
- SIRET validated with Luhn checksum.
- `src/Uriae/StructureBundle/Form/Validator/AnnexeFinanciereValidator.php`
- Annex values must match allowed patterns.
- `src/Uriae/StructureBundle/Entity/Alerte.php`
- Alert type constrained to known constants and default behavior fields.
- `src/Uriae/StructureBundle/Entity/Diary.php`
- Default diary event initialization and base config defaults.
- `src/Uriae/StructureBundle/Controller/CompetenceController.php`
- Competence deletion blocked if linked to employee competences.
- `src/Uriae/StructureBundle/Controller/StructureController.php`
- Admin-only operations for create/delete/toggle SMS.
- On creation, default alert templates are provisioned.
- On delete, users are disabled or reassigned depending on group role.
- `src/Uriae/StructureBundle/Repository/StructureRepository.php`
- Soft-deleted structures excluded from normal retrieval paths.
## Cross-context Dependencies
- **Structure <-> User**
- Paths:
- `src/Uriae/StructureBundle/Entity/Structure.php`
- `src/Uriae/UserBundle/Entity/User.php`
- `src/Uriae/UserBundle/Security/SuccessHandler.php`
- **Structure <-> Employee**
- Paths:
- `src/Uriae/StructureBundle/Entity/Structure.php`
- `src/Uriae/EmployeeBundle/Entity/Employee.php`
- `src/Uriae/EmployeeBundle/Repository/EmployeeRepository.php`
- **Structure <-> Suivi**
- Paths:
- `src/Uriae/SuiviBundle/Entity/TypeAction.php`
- `src/Uriae/SuiviBundle/Entity/CategorieSavoir.php`
- `src/Uriae/StructureBundle/Model/EvaluationUpdater.php`
- `src/Uriae/StructureBundle/Controller/ReferentielInsertionController.php`
- **Structure <-> Union**
- Paths:
- `src/Uriae/UnionBundle/Entity/Partenaire.php`
- `src/Uriae/StructureBundle/Controller/StructureController.php`
- **Structure <-> ASP**
- Paths:
- `src/Uriae/StructureBundle/Entity/SiaeType.php`
- `src/Uriae/AspBundle/Model/GeneratorFactory.php`
- `src/Uriae/AspBundle/Manager/AbstractAspManager.php`
- `src/Uriae/AspBundle/Entity/AbstractFichierAsp.php`
## DDD Slicing
- **Aggregates (candidate)**
- `StructureProfile` (identity/legal/contact/territory/SIAE/head-office).
- `StructureWorkOrganization` (sites/sectors/activity sectors).
- `StructureMonitoringConfig` (alerts/diary/events/recipients).
- `StructureFinancialProfile` (annexes/key figures/financing).
- **Value objects (candidate)**
- `Siret`, `PhoneNumber`, `EmailAddress`, `PostalAddress`.
- `ActivityCategory`.
- `AlertThresholds` and `AlertOperand`.
- `ApiTokenCiphertext`.
- **Domain services (candidate)**
- `StructureMergeService`.
- `StructureProvisioningService`.
- `StructureAlertPolicyService`.
- `StructureDiaryComputationService`.
- **Repository interfaces (domain-facing)**
- `StructureRepository`.
- `StructureMonitoringRepository`.
- `StructureFinancialRepository`.
- `StructureMergeReadModel`.
- `StructureReferenceDataRepository`.
- **Domain events (candidate)**
- `StructureCreated`.
- `StructureMerged`.
- `StructureSoftDeleted`.
- `StructureMonitoringConfigured`.
- `StructureSiaeTypeChanged`.
- `StructureUsersReassigned`.
## Reading Order
1. `src/Uriae/StructureBundle/Entity/Structure.php`
2. `src/Uriae/StructureBundle/Repository/StructureRepository.php`
3. `src/Uriae/StructureBundle/Controller/StructureController.php`
4. `src/Uriae/StructureBundle/Entity/Alerte.php`
5. `src/Uriae/StructureBundle/Repository/AlerteRepository.php`
6. `src/Uriae/StructureBundle/Entity/Diary.php`
7. `src/Uriae/StructureBundle/Entity/DiaryEvent.php`
8. `src/Uriae/StructureBundle/Entity/DiaryMailer.php`
9. `src/Uriae/StructureBundle/Model/DiaryHandler.php`
10. `src/Uriae/StructureBundle/Controller/AlerteController.php`
11. `src/Uriae/StructureBundle/Entity/SiaeType.php`
12. `src/Uriae/StructureBundle/Entity/HeadOffice.php`
13. `src/Uriae/StructureBundle/Entity/SiteTravail.php`
14. `src/Uriae/StructureBundle/Entity/Sector.php`
15. `src/Uriae/StructureBundle/Entity/Competence.php`
16. `src/Uriae/StructureBundle/Form/Validator/AnnexeFinanciereValidator.php`
17. `src/Uriae/StructureBundle/Form/Validator/SiretValidator.php`
18. `src/Uriae/StructureBundle/Model/EvaluationUpdater.php`
19. `src/Uriae/EmployeeBundle/Entity/Employee.php`
20. `src/Uriae/EmployeeBundle/Entity/Contrat.php`
21. `src/Uriae/EmployeeBundle/Entity/Pmsmp.php`
22. `src/Uriae/EmployeeBundle/Repository/EmployeeRepository.php`
23. `src/Uriae/SuiviBundle/Entity/TypeAction.php`
24. `src/Uriae/SuiviBundle/Entity/CategorieSavoir.php`
25. `src/Uriae/AspBundle/Model/GeneratorFactory.php`
26. `src/Uriae/UserBundle/Entity/User.php`

View File

@@ -0,0 +1,224 @@
# Suivi Bundle Deep Dive
## Ubiquitous Language
- **Suivi salarié**: umbrella follow-up workflow for active/exited employees.
Paths: `src/Uriae/SuiviBundle/Controller/SuiviController.php`, `src/Uriae/SuiviBundle/Resources/translations/messages.fr.yml`
- **Action**: abstract intervention (`dateDebut`, `duree`, `typeAction`, `commentaire`, `structure`).
Path: `src/Uriae/SuiviBundle/Entity/Action.php`
- **Accompagnement**: socio-professional support action with objective/result/encadrants/partenaires.
Path: `src/Uriae/SuiviBundle/Entity/Accompagnement.php`
- **Evaluation**: employee assessment action with notes and validation lifecycle.
Path: `src/Uriae/SuiviBundle/Entity/Evaluation.php`
- **Note**: score item per savoir with bounded values.
Path: `src/Uriae/SuiviBundle/Entity/Note.php`
- **Savoir taxonomy** (`TypeSavoir`, `CategorieSavoir`, `Savoir`): evaluation referential tree.
Paths: `src/Uriae/SuiviBundle/Entity/TypeSavoir.php`, `src/Uriae/SuiviBundle/Entity/CategorieSavoir.php`, `src/Uriae/SuiviBundle/Entity/Savoir.php`
- **Action taxonomy** (`AxeTypeAction`, `CategorieTypeAction`, `TypeAction`): insertion action referential tree.
Paths: `src/Uriae/SuiviBundle/Entity/AxeTypeAction.php`, `src/Uriae/SuiviBundle/Entity/CategorieTypeAction.php`, `src/Uriae/SuiviBundle/Entity/TypeAction.php`
- **FormationInterne** + **ParticipationFormation**: training and attendee participation.
Paths: `src/Uriae/SuiviBundle/Entity/FormationInterne.php`, `src/Uriae/SuiviBundle/Entity/ParticipationFormation.php`
- **Potentiel**: employability/motivation/mobility profile.
Path: `src/Uriae/SuiviBundle/Entity/Potentiel.php`
- **Problematique**: insertion issue lifecycle and resolution.
Path: `src/Uriae/SuiviBundle/Entity/Problematique.php`
- **Habilitation**: employee certification/authorization with expiry.
Path: `src/Uriae/SuiviBundle/Entity/Habilitation.php`
- **RDV** and **Event**: appointment and event timeline entries.
Paths: `src/Uriae/SuiviBundle/Entity/Rdv.php`, `src/Uriae/SuiviBundle/Entity/Event.php`
## Domain Core
- **Practical root today: `Employee` (outside Suivi)**
- Most Suivi entities attach to `Employee` and are also maintained from Employee-side relations.
- Path: `src/Uriae/EmployeeBundle/Entity/Employee.php`
- **Action hierarchy**
- Polymorphic root `Action` with concrete subclasses:
- `Accompagnement`
- `Evaluation`
- `FormationInterne`
- Path: `src/Uriae/SuiviBundle/Entity/Action.php`
- **Evaluation subgraph**
- `Evaluation` + `Note` collection and validation lifecycle.
- Paths:
- `src/Uriae/SuiviBundle/Entity/Evaluation.php`
- `src/Uriae/SuiviBundle/Entity/Note.php`
- **Formation subgraph**
- `FormationInterne` + participants + costs.
- Paths:
- `src/Uriae/SuiviBundle/Entity/FormationInterne.php`
- `src/Uriae/SuiviBundle/Entity/ParticipationFormation.php`
- **Potentiel and conformite subgraphs**
- `Potentiel`, `Problematique`, `Habilitation`.
- Paths:
- `src/Uriae/SuiviBundle/Entity/Potentiel.php`
- `src/Uriae/SuiviBundle/Entity/Problematique.php`
- `src/Uriae/SuiviBundle/Entity/Habilitation.php`
- **Reference models**
- Action and savoir taxonomies are mutable references with strong structure-level administration.
- Paths:
- `src/Uriae/SuiviBundle/Entity/TypeAction.php`
- `src/Uriae/SuiviBundle/Entity/CategorieTypeAction.php`
- `src/Uriae/SuiviBundle/Entity/AxeTypeAction.php`
- `src/Uriae/SuiviBundle/Entity/TypeSavoir.php`
- `src/Uriae/SuiviBundle/Entity/CategorieSavoir.php`
- `src/Uriae/SuiviBundle/Entity/Savoir.php`
## Invariants / Concistency
- `src/Uriae/SuiviBundle/Entity/Note.php`
- Note value must be numeric and in allowed range.
- `src/Uriae/SuiviBundle/Entity/Evaluation.php`
- New evaluation starts unvalidated.
- Note initialization uses selected categories and default non-evaluated value.
- `src/Uriae/SuiviBundle/Repository/EvaluationRepository.php`
- Creation flow expects previous evaluations to be validated.
- First/last evaluation selection is based on validated subset.
- `src/Uriae/SuiviBundle/Controller/EvaluationController.php`
- Blocks new evaluation when prior validations are pending.
- `src/Uriae/SuiviBundle/Model/Bilan/CategoryNode.php`
- Non-evaluated notes ignored from score computation.
- `src/Uriae/SuiviBundle/Model/Bilan/FamilyNode.php`
- Category score threshold drives strong/weak point classification.
- `src/Uriae/SuiviBundle/Entity/FormationInterne.php`
- `src/Uriae/SuiviBundle/Form/Validator/Collection/ArrayLength.php`
- Formation must have at least one participant.
- `src/Uriae/SuiviBundle/Entity/Action.php`
- `src/Uriae/SuiviBundle/Entity/ParticipationFormation.php`
- Duration fields (`heures/minutes`) recompute total duration via lifecycle logic.
- `src/Uriae/SuiviBundle/Repository/TypeActionRepository.php`
- Accompagnement-compatible action types are axis-filtered and category-filtered.
- `src/Uriae/SuiviBundle/Form/Type/FormationInterneType.php`
- Formation action type constrained to specific axis.
- `src/Uriae/SuiviBundle/Entity/TypeAction.php`
- `structure = null` means global type; non-null means structure-owned type.
- `src/Uriae/StructureBundle/Controller/GrilleEvaluationController.php`
- Prevents deleting a savoir when notes exist.
- `src/Uriae/SuiviBundle/Repository/HabilitationRepository.php`
- Expiry alerts depend on active habilitation + employee state.
- `src/Uriae/SuiviBundle/Command/DesactivateHabilitationsCommand.php`
- Batch deactivation for outdated active habilitations.
- `src/Uriae/SuiviBundle/Repository/RdvRepository.php`
- SMS target list filtered by send flag + next-day date rule.
## Cross-context Dependencies
- **Suivi <-> Employee (strong coupling)**
- Paths:
- `src/Uriae/SuiviBundle/Entity/*`
- `src/Uriae/EmployeeBundle/Entity/Employee.php`
- Direction idea: Suivi depends on Employee identity/reference boundary, not shared rich object graph.
- **Suivi <-> Structure**
- Paths:
- `src/Uriae/SuiviBundle/Entity/Action.php`
- `src/Uriae/SuiviBundle/Entity/TypeAction.php`
- `src/Uriae/SuiviBundle/Entity/CategorieSavoir.php`
- `src/Uriae/StructureBundle/Controller/GrilleEvaluationController.php`
- `src/Uriae/StructureBundle/Controller/ReferentielInsertionController.php`
- Direction idea: explicit catalog management contract instead of direct structure controllers mutating Suivi references.
- **Suivi -> Union**
- Paths:
- `src/Uriae/SuiviBundle/Entity/FormationInterne.php`
- `src/Uriae/SuiviBundle/Entity/Accompagnement.php`
- Direction idea: consume Union referentials through explicit read model/ACL.
- **Suivi -> User**
- Paths:
- `src/Uriae/SuiviBundle/Entity/Rdv.php`
- `src/Uriae/SuiviBundle/Entity/Event.php`
- `src/Uriae/SuiviBundle/Entity/Habilitation.php`
- Direction idea: reference user identity and role policy via dedicated boundary service.
## DDD Slicing
- **Subcontexts**
- `suivi-actions` (`Accompagnement`, `Evaluation`, `FormationInterne`, `ParticipationFormation`)
- `suivi-potentiel` (`Potentiel`, `Problematique`, projet/experience profile)
- `suivi-interactions` (`Rdv`, `Event`)
- `suivi-conformite` (`Habilitation`)
- `suivi-referentiels` (taxonomy aggregates)
- **Aggregates (candidate)**
- `EvaluationAggregate` (evaluation + notes).
- `FormationInterneAggregate` (formation + participations + costs).
- `AccompagnementAggregate`.
- `PotentielAggregate`.
- `HabilitationAggregate`.
- `RdvAggregate`.
- `EventAggregate`.
- **Domain services (candidate)**
- `EvaluationPolicyService`.
- `FormationParticipationService`.
- `HabilitationExpiryService`.
- `RdvNotificationPolicy`.
- **Repository interfaces (domain-facing)**
- `EvaluationRepository`, `AccompagnementRepository`, `FormationInterneRepository`.
- `HabilitationRepository`, `RdvRepository`, `ProblematiqueRepository`.
- `TypeActionCatalog`, `SavoirCatalog`.
- **Domain events (candidate)**
- `EvaluationCreated`, `EvaluationValidated`.
- `FormationParticipantAdded`, `FormationParticipantRemoved`.
- `HabilitationExpired`, `HabilitationDeactivated`.
- `RdvPlanned`, `RdvSmsRequested`.
- **Value objects (candidate)**
- `DurationMinutes`.
- `NoteValue`.
- `Avancement`.
- `ResolutionMode`.
- `ActionTypeCode`.
- `StructureScope`.
## Reading Order
1. `src/Uriae/EmployeeBundle/Entity/Employee.php`
2. `src/Uriae/SuiviBundle/Entity/Action.php`
3. `src/Uriae/SuiviBundle/Entity/Evaluation.php`
4. `src/Uriae/SuiviBundle/Entity/Note.php`
5. `src/Uriae/SuiviBundle/Entity/Accompagnement.php`
6. `src/Uriae/SuiviBundle/Entity/FormationInterne.php`
7. `src/Uriae/SuiviBundle/Entity/ParticipationFormation.php`
8. `src/Uriae/SuiviBundle/Entity/Potentiel.php`
9. `src/Uriae/SuiviBundle/Entity/Problematique.php`
10. `src/Uriae/SuiviBundle/Entity/Habilitation.php`
11. `src/Uriae/SuiviBundle/Entity/Rdv.php`
12. `src/Uriae/SuiviBundle/Entity/Event.php`
13. `src/Uriae/SuiviBundle/Entity/TypeAction.php`
14. `src/Uriae/SuiviBundle/Entity/CategorieSavoir.php`
15. `src/Uriae/SuiviBundle/Entity/TypeSavoir.php`
16. `src/Uriae/SuiviBundle/Repository/EvaluationRepository.php`
17. `src/Uriae/SuiviBundle/Repository/FormationInterneRepository.php`
18. `src/Uriae/SuiviBundle/Repository/TypeActionRepository.php`
19. `src/Uriae/SuiviBundle/Repository/HabilitationRepository.php`
20. `src/Uriae/SuiviBundle/Controller/EvaluationController.php`
21. `src/Uriae/SuiviBundle/Controller/FormationInterneController.php`
22. `src/Uriae/SuiviBundle/Controller/AccompagnementController.php`
23. `src/Uriae/SuiviBundle/Model/FormatterBilanIndividuel.php`
24. `src/Uriae/StructureBundle/Controller/GrilleEvaluationController.php`
25. `src/Uriae/StructureBundle/Controller/ReferentielInsertionController.php`
26. `src/Uriae/StructureBundle/Model/DiaryHandler.php`

View File

@@ -0,0 +1,147 @@
# Union Bundle Deep Dive
## Ubiquitous Language
- **Union**: federation-level identity (sigle, organisme, address, contact) stored in `union_informations`.
Path: `src/Uriae/UnionBundle/Entity/Union.php`
- **Partenaire**: partner actor (moral/physical), typed via `TypePartenaire`, optionally scoped to a `Structure`.
Path: `src/Uriae/UnionBundle/Entity/Partenaire.php`
- **TypePartenaire**: partner role label (ordered list).
Path: `src/Uriae/UnionBundle/Entity/TypePartenaire.php`
- **Conventionnement**: ordered conventionnement catalog entry.
Path: `src/Uriae/UnionBundle/Entity/Conventionnement.php`
- **ButFormation**: ordered training-goal catalog entry.
Path: `src/Uriae/UnionBundle/Entity/ButFormation.php`
- **TypeSituationSortie**: exit typology with ASP codes per SIAE type and category constants (`Durable`, `Transition`, etc.).
Path: `src/Uriae/UnionBundle/Entity/TypeSituationSortie.php`
- **SituationSortie**: employee insertion exit segment (dates, type, contracts grouping) tied to `ParcoursInsertion`.
Path: `src/Uriae/UnionBundle/Entity/SituationSortie.php`
- **HomepageMessage**: union-wide homepage banner text.
Path: `src/Uriae/UnionBundle/Entity/HomepageMessage.php`
## Domain Core
- **Union profile aggregate (catalog root)**
- Single-row style configuration for the federation.
- Depends on `StructureBundle` `Town` for city reference.
- Path: `src/Uriae/UnionBundle/Entity/Union.php`
- **Partner directory**
- `Partenaire` + `TypePartenaire` (many-to-many typing).
- Optional `Structure` scope blurs pure “union referential” vs “structure-local partner”.
- Paths: `src/Uriae/UnionBundle/Entity/Partenaire.php`, `src/Uriae/UnionBundle/Entity/TypePartenaire.php`
- **Ordered catalogs**
- `Conventionnement`, `ButFormation` with `position` ordering.
- Paths: `src/Uriae/UnionBundle/Entity/Conventionnement.php`, `src/Uriae/UnionBundle/Entity/ButFormation.php`
- **Exit taxonomy + lifecycle segment (boundary anomaly)**
- `TypeSituationSortie` is clearly union-level referential.
- `SituationSortie` is **employee insertion state**: links `ParcoursInsertion`, `Contrat[]`, and exit type. It lives in Union bundle but behaves as **Employee / insertion journey** domain.
- Paths: `src/Uriae/UnionBundle/Entity/TypeSituationSortie.php`, `src/Uriae/UnionBundle/Entity/SituationSortie.php`
- **Admin referential UI (not Union-owned data)**
- Controllers under Union manage `SuiviBundle` taxonomies (`AxeTypeAction`, `CategorieTypeAction`, `TypeAction`) and evaluation grid (`TypeSavoir`, `CategorieSavoir`, `Savoir`) using `StructureBundle` form types.
- Paths:
- `src/Uriae/UnionBundle/Controller/ReferentielInsertionController.php`
- `src/Uriae/UnionBundle/Controller/GrilleEvaluationController.php`
## Invariants / Concistency
- `src/Uriae/UnionBundle/Entity/Union.php`
- Sigle, adresse, code postal (length 5), telephone constraints (via `@Telephone` from Structure bundle).
- `src/Uriae/UnionBundle/Entity/Partenaire.php`
- Libellé not blank.
- `src/Uriae/UnionBundle/Entity/TypePartenaire.php`, `Conventionnement.php`, `ButFormation.php`
- Name not blank; position field for ordering.
- `src/Uriae/UnionBundle/Entity/TypeSituationSortie.php`
- Libellé not blank; ASP code fields length-capped per SIAE column.
- `src/Uriae/UnionBundle/Entity/SituationSortie.php`
- Callback `isSituationSortieValid`: if `dateSortie` set then `typeSituationSortie` required.
- Callback `isDateSortieValid`: if `typeSituationSortie` set then `dateSortie` required.
- `setParcoursInsertion` / `addContrat` maintain bidirectional graph with Employee entities.
- `src/Uriae/UnionBundle/Controller/NatureEmploisController.php`
- Metier delete allowed only when no contract references that metier.
- `src/Uriae/UnionBundle/Controller/SituationsSalariesController.php`
- Position assignment on add for `ProblemeInsertion` / `DureeAide` (via Employee repositories).
## Cross-context Dependencies
- **Union -> Structure**
- `Union` uses `Town`.
- `Partenaire` optional `Structure`.
- Paths: `src/Uriae/UnionBundle/Entity/Union.php`, `src/Uriae/UnionBundle/Entity/Partenaire.php`
- **Union (entity) -> Employee**
- `SituationSortie` -> `ParcoursInsertion`, `Contrat`.
- Path: `src/Uriae/UnionBundle/Entity/SituationSortie.php`
- **Union (controllers) -> Employee**
- Metier, resource categories, problem types, aide durations.
- Paths: `src/Uriae/UnionBundle/Controller/NatureEmploisController.php`, `src/Uriae/UnionBundle/Controller/SituationsSalariesController.php`
- **Union (controllers) -> Suivi**
- Insertion referential + evaluation grid.
- Paths: `src/Uriae/UnionBundle/Controller/ReferentielInsertionController.php`, `src/Uriae/UnionBundle/Controller/GrilleEvaluationController.php`
- **Downstream consumers**
- Employee (`ParcoursInsertion`, `Contrat`, `FirstHome`), Suivi (`Partenaire`, `ButFormation`), Asp (`TypeSituationSortie` codes), Bilan/reporting.
## DDD Slicing
Treat **Union** as two conceptual areas:
### A) Federation referential (true Union BC)
- **Aggregates (candidate)**
- `UnionOrganizationProfile` (current `Union` entity).
- `PartnerDirectory` (`Partenaire` + types; clarify global vs structure-scoped partners as separate AR or explicit `PartnerScope` VO).
- `ConventionnementCatalog`, `ButFormationCatalog`.
- `ExitTypeCatalog` (`TypeSituationSortie` only).
- **Value objects (candidate)**
- `PartnerLabel`, `ExitTypeCode`, `AspExitCodeBySiae` (wrap per-SIAE code columns).
- **Domain services**
- `PartnerTypingPolicy` (conventionneur-only rules currently enforced in Employee `FirstHome` should align with Union vocabulary).
### B) Relocate out of Union (employee insertion)
- **SituationSortie** as part of **Employee / InsertionJourney** aggregate (or its own AR owned by Employee context), with Union only providing `ExitTypeId` / published catalog.
- **Application layer**
- “Union admin” use cases that today edit Suivi/Employee referentials should become explicit **application services** in the owning BC, callable from Union UI via APIs or shared kernel interfaces—not direct entity manipulation from Union controllers.
## Reading Order
1. `src/Uriae/UnionBundle/Entity/Union.php`
2. `src/Uriae/UnionBundle/Repository/UnionRepository.php`
3. `src/Uriae/UnionBundle/Controller/InformationsController.php`
4. `src/Uriae/UnionBundle/Entity/Partenaire.php`
5. `src/Uriae/UnionBundle/Entity/TypePartenaire.php`
6. `src/Uriae/UnionBundle/Repository/PartenaireRepository.php`
7. `src/Uriae/UnionBundle/Controller/PartenairesController.php`
8. `src/Uriae/UnionBundle/Entity/Conventionnement.php`
9. `src/Uriae/UnionBundle/Entity/ButFormation.php`
10. `src/Uriae/UnionBundle/Repository/ConventionnementRepository.php`
11. `src/Uriae/UnionBundle/Repository/ButFormationRepository.php`
12. `src/Uriae/UnionBundle/Controller/FormationsController.php`
13. `src/Uriae/UnionBundle/Entity/TypeSituationSortie.php`
14. `src/Uriae/UnionBundle/Entity/SituationSortie.php`
15. `src/Uriae/UnionBundle/Repository/SituationSortieRepository.php`
16. `src/Uriae/UnionBundle/Controller/SituationsSortiesController.php`
17. `src/Uriae/UnionBundle/Entity/HomepageMessage.php`
18. `src/Uriae/UnionBundle/Controller/HomepageMessageController.php`
19. `src/Uriae/UnionBundle/Controller/ReferentielInsertionController.php`
20. `src/Uriae/UnionBundle/Controller/GrilleEvaluationController.php`
21. `src/Uriae/UnionBundle/Controller/NatureEmploisController.php`
22. `src/Uriae/UnionBundle/Controller/SituationsSalariesController.php`
23. `src/Uriae/UnionBundle/Controller/TypologieSiaeController.php`
24. `src/Uriae/EmployeeBundle/Entity/ParcoursInsertion.php`
25. `src/Uriae/EmployeeBundle/Model/SituationSortieUpdater.php`