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
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Tests

on: [push]

jobs:
unit-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: php-actions/composer@v6
- name: PHPUnit Tests
uses: php-actions/phpunit@v9
with:
configuration: tests/phpunit.xml
5 changes: 4 additions & 1 deletion .php-cs-fixer.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<?php

$finder = PhpCsFixer\Finder::create()
->exclude(['var', 'vendor', 'migrations', 'fixtures'])
->exclude([
'src/Resources/skeleton',
'vendor'
])
->in(__DIR__)
;

Expand Down
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,3 +153,36 @@ class Logger extends Facade
```

Although facades are better testable than regular singletons, it is highly recommended to only use them sparringly and always prefer normal dependency injection when possible.

## Generator Commands

This bundle adds several [maker bundle](https://symfony.com/bundles/SymfonyMakerBundle/current/index.html) commands to generate commonly used components.

### Model / Repository

This command can be used 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

```bash
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
```
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
},
"autoload": {
"psr-4": {
"GeekCell\\DddBundle\\": "src"
"GeekCell\\DddBundle\\": "src/"
}
},
"autoload-dev": {
Expand All @@ -36,12 +36,13 @@
"mockery/mockery": "^1.5",
"phpstan/phpstan": "^1.9",
"phpstan/phpstan-mockery": "^1.1",
"phpunit/phpunit": "^9.5"
"phpunit/phpunit": "^9.5",
"symfony/maker-bundle": "^1.48"
},
"scripts": {
"gc:tests": "phpunit --testdox --colors=always",
"gc:cs-lint": "php-cs-fixer fix --config .php-cs-fixer.php --diff -vvv --dry-run",
"gc:cs-fix": "php-cs-fixer fix --config .php-cs-fixer.php -vvv || true",
"gc:phpstan": "phpstan analyse --memory-limit=2G --no-progress --level=8"
}
}
}
Loading