Open johnkhansrc opened 3 weeks ago
Like this :
# config/packages/elastically.yaml
elastically:
connections:
default:
client:
host: '%env(ELASTICSEARCH_HOST)%'
# If you want to use the Symfony HttpClient (you MUST create this service)
#transport: 'JoliCode\Elastically\Transport\HttpClientTransport'
# Path to the mapping directory (in YAML)
mapping_directory: '%kernel.project_dir%/src/*/Infrastructure/Persistence/Elastics/mapping'
Hi! Thanks for the suggestion, the proposal for configuration looks good to me.
Would you be able to open a pull request with this change?
That would be located in the YamlProvider.
(I didn't read your wall of text I'm sorry, did you use generative IA?).
I might have time for that during the month of December.
The Importance of Configuring the Jolicode/Elastically Bundle to Distribute DTOs and Mappings Across Multiple Directories
In the development of complex applications, architectures such as Domain-Driven Design (DDD) or hexagonal architecture are frequently employed to structure code in a logical and maintainable fashion. These methodologies promote the separation of code into distinct modules or domains, each representing a specific segment of the system with its own set of responsibilities.
Within this context, the ability to configure the Jolicode/Elastically bundle to distribute Data Transfer Objects (DTOs) and Elasticsearch mappings across multiple directories proves highly advantageous. The following points elucidate the benefits:
Clear Code Organization: Segmenting DTOs and mappings by domain or module results in a codebase that accurately mirrors the business logic. This enhances code readability and enables developers to swiftly navigate and locate various components of the application.
Domain Isolation: Separating directories facilitates the isolation of different domains. Modifications to the DTOs or mappings within one module do not impact others, thereby minimizing the risk of regressions and simplifying the debugging process.
Enhanced Maintainability: A modular code structure streamlines maintenance and updates. Developers can focus on specific modules without the need to consider unrelated dependencies, accelerating development cycles and reducing complexity.
Reusability and Scalability: Well-organized DTOs and mappings enhance the ease of reusing components in other parts of the application or even in separate projects. This modularity allows the application to scale more effectively by incorporating new modules without disrupting existing functionality.
Adherence to DDD and Hexagonal Principles: These architectural patterns emphasize separation of concerns and encapsulation of business domains. Distributing DTOs and mappings into separate directories aligns with these core principles, leading to a more robust and coherent application architecture.
Improved Collaboration: In teams where multiple developers work on different modules, a well-defined directory structure fosters better collaboration. Each developer can concentrate on their respective domain without the concern of interfering with others' work.
Simplified Testing: Clear module separation enables more efficient unit and integration testing. Tests can be specifically targeted to individual modules, enhancing the overall quality and reliability of the codebase.