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

feat: Add support for subdomains in newFactory method (#29) #31

Merged
merged 9 commits into from
Oct 23, 2023

Conversation

jaspertey
Copy link
Member

@jaspertey jaspertey commented Aug 18, 2023

  • Add test coverage
  • Refine and simplify where possible

Added

  • Formal support for subdomains (nested domains). For example, to generate model Domain\Reporting\Internal\Models\InvoiceReport, the domain argument can be specified in any of the following ways:
    • ddd:model Reporting\\Internal InvoiceReport
    • ddd:model Reporting/Internal InvoiceReport
    • ddd:model Reporting.Internal InvoiceReport
  • Implement abstract Lunarstorm\LaravelDDD\Factories\DomainFactory extension of Illuminate\Database\Eloquent\Factories\Factory:
    • Implements DomainFactory::resolveFactoryName() to resolve the corresponding factory for a domain model.
    • Will resolve the correct factory if the model belongs to a subdomain; Domain\Reporting\Internal\Models\InvoiceReport will correctly resolve to Database\Factories\Reporting\Internal\InvoiceReportFactory.

Changed

  • Default base model implementation in base-model.php.stub now uses using DomainFactory::factoryForModel() inside the newFactory method to resolve the model factory.

@jaspertey jaspertey self-assigned this Aug 18, 2023
- implement abstract DomainFactory (extends Factory).
- DomainFactory::resolveFactoryName() implements custom domain factory resolution.
- Ensure factory resolution respects customizations made in ddd config.
- Simplify base-model stub's newFactory method to use DomainFactory::factoryForModel().
- Refactor the API of the internal Domain support class.
- Add more test coverage.
@jaspertey jaspertey marked this pull request as ready for review October 23, 2023 00:24
@jaspertey jaspertey merged commit 5e7a8bb into main Oct 23, 2023
19 checks passed
@jaspertey jaspertey deleted the feat-sub-domain-factories branch October 23, 2023 00:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants