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

Fix custom base model support #35

Merged
merged 4 commits into from
Nov 13, 2023
Merged

Conversation

JasperTey
Copy link
Member

@JasperTey JasperTey commented Nov 12, 2023

Changed

  • Implement more robust handling of base models when generating a domain model with ddd:model:
    • If the configured ddd.base_model exists (evaluated using class_exists), base model generation is skipped.
    • If ddd.base_model does not exist and falls under a domain namespace, base model will be generated.
    • Falling under a domain namespace means Domain\**\Models\SomeBaseModel.
    • For example, if ddd.base_model were set to App\Models\CustomAppBaseModel or Illuminate\Database\Eloquent\NonExistentModel, they fall outside of the domain namespace and won't be generated on your behalf.

Fixed

  • Resolve long-standing issue where ddd:model would not properly detect whether the configured ddd.base_model already exists, leading to unpredictable results when ddd.base_model deviated from the default Domain\Shared\Models\BaseModel.

JasperTey and others added 3 commits November 12, 2023 10:08
- skip base model creation if ddd.base_model is a class that exists
- otherwise, attempt to generate one, as long as it's within a domain-level namespace
@JasperTey JasperTey linked an issue Nov 12, 2023 that may be closed by this pull request
@JasperTey JasperTey marked this pull request as draft November 13, 2023 02:21
@JasperTey JasperTey marked this pull request as ready for review November 13, 2023 03:19
@JasperTey JasperTey merged commit 007e3e8 into main Nov 13, 2023
19 checks passed
@JasperTey JasperTey deleted the fix-custom-base-model-support branch November 13, 2023 03:19
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.

ddd:model does not respect custom base model
1 participant