Skip to content

Add MakerModel to generate domain models and related classes/resources (#13) #14

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

Closed
wants to merge 23 commits into from

Conversation

b00gizm
Copy link
Contributor

@b00gizm b00gizm commented Jan 21, 2023

Adds a Maker command to generate

  • The domain model class
  • A repository class for the model
  • The model's identity class as value object (optional)
  • A Doctrine database entity configuration, either as annotation or separate config file (optional)
  • A custom Doctrine type for the model's identity class (optional)

Command Output

Description:
  Creates a new domain model class

Usage:
  make:ddd:model [options] [--] [<name>]

Arguments:
  name                               The name of the model class (e.g. Customer)

Options:
      --aggregate-root               Marks the model as aggregate root
      --entity=ENTITY                Use this model as Doctrine entity
      --with-identity=WITH-IDENTITY  Whether an identity value object should be created
      --with-suffix                  Adds the suffix "Model" to the model class name

Checklist

  • Add Maker command
  • Generate model class
  • Generate repository class
  • (Optionally) inherit from AggregateRoot (--aggregate-root)
  • (Optionally) generate model identity class as value object (--with-identity)
    • For numeric/integer ID
    • For UUID
  • (Optionally) add Doctrine database entity configuration (--entity)
    • As attributes
    • As separate XML config file
    • Create custom Doctrine mapping types for model identity
      • For numeric/integer ID
      • For UUID
    • Update Doctrine configuration
  • Handle custom paths/prefixes in case the user wants to use a different root directory than src/Domain/Model
  • Add documentation
  • Add test case

@b00gizm b00gizm linked an issue Jan 21, 2023 that may be closed by this pull request
@b00gizm b00gizm self-assigned this Jan 21, 2023
@b00gizm b00gizm added the enhancement New feature or request label Jan 21, 2023
@b00gizm b00gizm added this to the v1.2.0 milestone Jan 21, 2023
@b00gizm
Copy link
Contributor Author

b00gizm commented Jan 21, 2023

Doctrine's YAML driver is deprecated and will be removed from v3.0. Either replace with XML config generation or omit entirely and just focus on annotations (attributes).

Symfony's docs for configuring Doctrine ORM.

@janvt
Copy link
Contributor

janvt commented Mar 6, 2023

Handle custom paths/prefixes in case the user wants to use a different root directory than src/Domain/Model

@b00gizm The Symfony MakerBundle is very opinionated and does not allow an override of the directory, as fas as I know (just the namespace). So I don't think we need to support this...

@janvt janvt marked this pull request as ready for review March 9, 2023 11:58
@janvt janvt self-assigned this Mar 9, 2023
@janvt janvt self-requested a review March 9, 2023 11:59
@janvt
Copy link
Contributor

janvt commented Mar 9, 2023

Custom root path and tests will be tackled seperately outside of this PR.

@janvt
Copy link
Contributor

janvt commented Mar 10, 2023

Moved changeset to Maker Commands feature collection PR. #20
Closing this.

@janvt janvt closed this Mar 10, 2023
@janvt janvt deleted the feat/domain-model-maker branch March 28, 2023 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Leverage Symfony's MakerBundle to generate boilerplate code.
2 participants