Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Allow multiple resource directories #195

Open
johnkhansrc opened this issue Nov 1, 2024 · 4 comments
Open

[Feature] Allow multiple resource directories #195

johnkhansrc opened this issue Nov 1, 2024 · 4 comments
Labels
help wanted Extra attention is needed

Comments

@johnkhansrc
Copy link

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.

@johnkhansrc
Copy link
Author

Like this :
image

@johnkhansrc
Copy link
Author

# 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'

@damienalexandre
Copy link
Member

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?).

@johnkhansrc
Copy link
Author

I might have time for that during the month of December.

@damienalexandre damienalexandre changed the title Allow multiple resource directories [Feature] Allow multiple resource directories Nov 13, 2024
@damienalexandre damienalexandre added the help wanted Extra attention is needed label Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants