Skip to content

Commit fefaa94

Browse files
committed
WIP
Signed-off-by: alexmerlin <alex.merlin.1985@gmail.com>
1 parent 14b0333 commit fefaa94

39 files changed

Lines changed: 492 additions & 557 deletions

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# dot-maker
22

3-
Programmatically generate Dotkernel projects files and directories.
3+
Programmatically generate Dotkernel project files and directories.
44

55
## Documentation
66

docs/book/v1/component/collection.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ If you input a module name which does not exist (like, "NonExistentModule"), an
3131
3232
and will keep prompting for a valid module name until you provide one.
3333

34+
Once an existing module name (like, "ExistingModule") is provided, `dot-maker` will output a success message:
35+
36+
> Found Module "ExistingModule"
37+
3438
## Name the Collection
3539

3640
Once the target module has been identified, you will be prompted to input a name for the Collection:
@@ -39,6 +43,8 @@ Once the target module has been identified, you will be prompted to input a name
3943
4044
**The name must contain only letters and numbers.**
4145

46+
> You don't have to append "Collection" to the name. It is automatically appended. See our [Naming Standards](../naming-standards.md) page for more information.
47+
4248
If you leave the name blank, the process will exit.
4349

4450
If you input an invalid name (like, "."), an error will be thrown:

docs/book/v1/component/command.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ If you input a module name which does not exist (like, "NonExistentModule"), an
3232
3333
and will keep prompting for a valid module name until you provide one.
3434

35+
Once an existing module name (like, "ExistingModule") is provided, `dot-maker` will output a success message:
36+
37+
> Found Module "ExistingModule"
38+
3539
## Name the Command
3640

3741
Once the target module has been identified, you will be prompted to input a name for the Command:
@@ -40,6 +44,8 @@ Once the target module has been identified, you will be prompted to input a name
4044
4145
**The name must contain only letters and numbers.**
4246

47+
> You don't have to append "Command" to the name. It is automatically appended. See our [Naming Standards](../naming-standards.md) page for more information.
48+
4349
If you leave the name blank, the process will exit.
4450

4551
If you input an invalid name (like, "."), an error will be thrown:

docs/book/v1/component/entity.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,77 @@
11
# Create Entity
2+
3+
> This page assumes that you have created a Composer "make" script as described on the [Setup page](../setup.md#add-dot-maker-to-composerjson).
4+
5+
## Run the command
6+
7+
To create an Entity, use either of the following commands:
8+
9+
```shell
10+
composer make entity
11+
```
12+
13+
OR
14+
15+
```shell
16+
./vendor/bin/dot-maker entity
17+
```
18+
19+
## Identify the target module
20+
21+
`dot-maker` needs to know in which module you want to create the new Entity.
22+
To determine this, it will prompt you to enter the name of an existing module:
23+
24+
> Existing module name:
25+
26+
If you input a module name which does not exist (like, "NonExistentModule"), an error will be thrown:
27+
28+
> Module "NonExistentModule" not found
29+
30+
and will keep prompting for a valid module name until you provide one.
31+
32+
Once an existing module name (like, "ExistingModule") is provided, `dot-maker` will output a success message:
33+
34+
> Found Module "ExistingModule"
35+
36+
## Name the Entity
37+
38+
Once the target module has been identified, you will be prompted to input a name for the Entity:
39+
40+
> Entity name:
41+
42+
**The name must contain only letters and numbers.**
43+
44+
> You don't have to append "Entity" to the name. See our [Naming Standards](../naming-standards.md) page for more information.
45+
46+
If you leave the name blank, the process will exit.
47+
48+
If you input an invalid name (like, "."), an error will be thrown:
49+
50+
> Invalid Entity name: "."
51+
52+
If you input the name of an existing Entity (like, "ExistingEntity"), an error will be thrown:
53+
54+
- for projects compatible with the Core architecture:
55+
56+
> Class "ExistingEntity" already exists at /path/to/project/src/Core/src/ExistingModule/src/Entity/ExistingEntity.php
57+
58+
- for projects which are NOT compatible with the Core architecture:
59+
60+
> Class "ExistingEntity" already exists at /path/to/project/src/ExistingModule/src/Entity/ExistingEntity.php
61+
62+
If you input a valid name (like, "NewEntity"), `dot-maker` will create the Entity and output a success message:
63+
64+
- for projects compatible with the Core architecture:
65+
66+
> Created Entity: /path/to/project/src/Core/src/ExistingModule/src/Entity/NewEntity.php
67+
> Created Repository: /path/to/project/src/Core/src/ExistingModule/src/Repository/NewEntityRepository.php
68+
69+
- for projects which are NOT compatible with the Core architecture:
70+
71+
> Created Entity: /path/to/project/src/ExistingModule/src/Entity/NewEntity.php
72+
> Created Repository: /path/to/project/src/ExistingModule/src/Repository/NewEntityRepository.php
73+
74+
## Create multiple Entities
75+
76+
To allow the creation of multiple Entities, the process will loop until you leave the name blank.
77+
Each iteration creates a new pair of Entity and Repository under the same module.
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,111 @@
11
# Create InputFilter
2+
3+
> This page assumes that you have created a Composer "make" script as described on the [Setup page](../setup.md#add-dot-maker-to-composerjson).
4+
5+
To create an InputFilter, use either of the following commands:
6+
7+
## Run the command
8+
9+
```shell
10+
composer make input-filter
11+
```
12+
13+
OR
14+
15+
```shell
16+
./vendor/bin/dot-maker input-filter
17+
```
18+
19+
## Identify the target module
20+
21+
`dot-maker` needs to know in which module you want to create the new InputFilter.
22+
To determine this, it will prompt you to enter the name of an existing module:
23+
24+
> Existing module name:
25+
26+
If you input a module name which does not exist (like, "NonExistentModule"), an error will be thrown:
27+
28+
> Module "NonExistentModule" not found
29+
30+
and will keep prompting for a valid module name until you provide one.
31+
32+
Once an existing module name (like, "ExistingModule") is provided, `dot-maker` will output a success message:
33+
34+
> Found Module "ExistingModule"
35+
36+
## Name the InputFilter
37+
38+
Once the target module has been identified, you will be prompted to input a name for the InputFilter:
39+
40+
> InputFilter name:
41+
42+
**The name must contain only letters and numbers.**
43+
44+
> You don't have to append "InputFilter" to the name. It is automatically appended. See our [Naming Standards](../naming-standards.md) page for more information.
45+
46+
If you leave the name blank, the process will exit.
47+
48+
If you input an invalid name (like, "."), an error will be thrown:
49+
50+
> Invalid InputFilter name: "."
51+
52+
If you input the name of an existing InputFilter (like, "ExistingInputFilter"), an error will be thrown:
53+
54+
> Class "ExistingInputFilter" already exists at /path/to/project/src/ExistingModule/src/InputFilter/ExistingInputFilter.php
55+
56+
Once you input a valid name (like, "Book"), `dot-maker` will prompt you to confirm which CRUD operations will be performed on the resource:
57+
58+
### Create resources
59+
60+
The prompt asks you whether you want to create resources:
61+
62+
> Allow creating Resources? [Y(es)/n(o)]:
63+
64+
On confirmation, the process will create the following file:
65+
66+
- `src/ExistingModule/src/InputFilter/CreateBookInputFilter.php`
67+
68+
Without confirmation, the process will skip to the next component.
69+
70+
### Delete resources
71+
72+
The prompt asks you whether you want to delete resources:
73+
74+
> Allow deleting Resources? [Y(es)/n(o)]:
75+
76+
On confirmation, the process will create the following file:
77+
78+
- `src/ExistingModule/src/InputFilter/DeleteBookInputFilter.php`
79+
80+
Without confirmation, the process will skip to the next component.
81+
82+
### Edit resources
83+
84+
The prompt asks you whether you want to edit resources:
85+
86+
> Allow editing Resources? [Y(es)/n(o)]:
87+
88+
On confirmation, the process will create the following file:
89+
90+
- `src/ExistingModule/src/InputFilter/EditBookInputFilter.php`
91+
92+
Without confirmation, the process will skip to the next component.
93+
94+
### Replace resources
95+
96+
> This file is created only when the project type is API.
97+
98+
The prompt asks you whether you want to replace resources:
99+
100+
> Allow replacing Resources? [Y(es)/n(o)]:
101+
102+
On confirmation, the process will create the following file:
103+
104+
- `src/ExistingModule/src/InputFilter/ReplaceBookInputFilter.php`
105+
106+
Without confirmation, the process will skip to the next component.
107+
108+
## Create multiple InputFilters
109+
110+
To allow the creation of multiple InputFilters, the process will loop until you leave the name blank.
111+
Each iteration creates a new set of InputFilters under the same module.

docs/book/v1/component/middleware.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ If you input a module name which does not exist (like, "NonExistentModule"), an
2929
3030
and will keep prompting for a valid module name until you provide one.
3131

32+
Once an existing module name (like, "ExistingModule") is provided, `dot-maker` will output a success message:
33+
34+
> Found Module "ExistingModule"
35+
3236
## Name the Middleware
3337

3438
Once the target module has been identified, you will be prompted to input a name for the Middleware:
@@ -37,6 +41,8 @@ Once the target module has been identified, you will be prompted to input a name
3741
3842
**The name must contain only letters and numbers.**
3943

44+
> You don't have to append "Middleware" to the name. It is automatically appended. See our [Naming Standards](../naming-standards.md) page for more information.
45+
4046
If you leave the name blank, the process will exit.
4147

4248
If you input an invalid name (like, "."), an error will be thrown:
@@ -47,7 +53,7 @@ If you input the name of an existing Middleware (like, "ExistingMiddleware"), an
4753

4854
> Class "ExistingMiddleware" already exists at /path/to/project/src/ExistingModule/src/Middleware/ExistingMiddleware.php
4955
50-
If you input a valid name (like, "NewMiddleware"), `dot-maker` will create the Command and output a success message:
56+
If you input a valid name (like, "NewMiddleware"), `dot-maker` will create the Middleware and output a success message:
5157

5258
> Created Middleware: /path/to/project/src/ExistingModule/src/Middleware/NewMiddleware.php
5359

docs/book/v1/component/module.md

Lines changed: 13 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,6 @@ OR
1616
./vendor/bin/dot-maker module
1717
```
1818

19-
## Debug
20-
21-
The first output is an info message confirming the project type, for example:
22-
23-
> Detected project type: Api
24-
25-
The second output is an info message confirming whether the project uses Core architecture, for example:
26-
27-
> Core architecture: Yes
28-
29-
These are detected by looking at the modules registered in `composer.json` under **autoload**.**psr-4**.
30-
3119
## Name the Module
3220

3321
You will be prompted to input a name for the Module:
@@ -67,7 +55,7 @@ On confirmation, the process will create the following files:
6755
- for projects compatible with the Core architecture:
6856
- `src/Core/src/<ModuleName>/src/Entity/<ModuleName>.php`
6957
- `src/Core/src/<ModuleName>/src/Repository/<ModuleName>Repository.php`
70-
- for projects which are not compatible with the Core architecture:
58+
- for projects which are NOT compatible with the Core architecture:
7159
- `src/<ModuleName>/src/Entity/<ModuleName>.php`
7260
- `src/<ModuleName>/src/Repository/<ModuleName>Repository.php`
7361

@@ -133,8 +121,8 @@ The prompt asks you whether you want to list resources:
133121
134122
On confirmation, the process will create the following files:
135123

136-
- `src/<ModuleName>/src/Collection/<ModuleName>Collection.php`
137-
- `src/<ModuleName>/src/Handler/Get<ModuleName>CollectionHandler.php`
124+
- `src/<ModuleName>/src/Collection/<ModuleName>Collection.php`: describes a resource-specific collection
125+
- `src/<ModuleName>/src/Handler/Get<ModuleName>CollectionHandler.php`: handles the resource collection representation
138126

139127
The matching Collection and ServiceInterface will be automatically injected into the Handler.
140128

@@ -148,7 +136,7 @@ The prompt asks you whether you want to view resources:
148136
149137
On confirmation, the process will create the following file:
150138

151-
- `src/<ModuleName>/src/Handler/Get<ModuleName>ResourceHandler.php`
139+
- `src/<ModuleName>/src/Handler/Get<ModuleName>ResourceHandler.php`: handles the resource representation
152140

153141
The matching ServiceInterface will be automatically injected into the Handler.
154142

@@ -162,8 +150,8 @@ The prompt asks you whether you want to create resources:
162150
163151
On confirmation, the process will create the following files:
164152

165-
- `src/<ModuleName>/src/Handler/Post<ModuleName>ResourceHandler.php`
166-
- `src/<ModuleName>/src/InputFilter/Create<ModuleName>InputFilter.php`
153+
- `src/<ModuleName>/src/Handler/Post<ModuleName>ResourceHandler.php`: handles the resource creation
154+
- `src/<ModuleName>/src/InputFilter/Create<ModuleName>InputFilter.php`: request payload validators
167155

168156
The matching InputFilter and ServiceInterface will be automatically injected into the Handler.
169157

@@ -177,7 +165,7 @@ The prompt asks you whether you want to delete resources:
177165
178166
On confirmation, the process will create the following files:
179167

180-
- `src/<ModuleName>/src/Handler/Delete<ModuleName>ResourceHandler.php`
168+
- `src/<ModuleName>/src/Handler/Delete<ModuleName>ResourceHandler.php`: handles the resource deletion
181169

182170
The matching ServiceInterface will be automatically injected into the Handler.
183171

@@ -191,8 +179,8 @@ The prompt asks you whether you want to edit resources:
191179
192180
On confirmation, the process will create the following files:
193181

194-
- `src/<ModuleName>/src/Handler/Patch<ModuleName>ResourceHandler.php`
195-
- `src/<ModuleName>/src/InputFilter/Edit<ModuleName>InputFilter.php`
182+
- `src/<ModuleName>/src/Handler/Patch<ModuleName>ResourceHandler.php`: handles the resource update
183+
- `src/<ModuleName>/src/InputFilter/Edit<ModuleName>InputFilter.php`: request payload validators
196184

197185
The matching InputFilter and ServiceInterface will be automatically injected into the Handler.
198186

@@ -206,8 +194,8 @@ The prompt asks you whether you want to replace resources:
206194
207195
On confirmation, the process will create the following files:
208196

209-
- `src/<ModuleName>/src/Handler/Put<ModuleName>ResourceHandler.php`
210-
- `src/<ModuleName>/src/InputFilter/Replace<ModuleName>InputFilter.php`
197+
- `src/<ModuleName>/src/Handler/Put<ModuleName>ResourceHandler.php`: handles the resource replacement
198+
- `src/<ModuleName>/src/InputFilter/Replace<ModuleName>InputFilter.php`: request payload validators
211199

212200
The matching InputFilter and ServiceInterface will be automatically injected into the Handler.
213201

@@ -223,8 +211,8 @@ The prompt asks you whether you want to list resources:
223211
224212
On confirmation, the process will create the following files:
225213

226-
- `src/<ModuleName>/src/Handler/Get<ModuleName>ListHandler.php`
227-
- `src/<ModuleName>/templates/<ModuleName>/<ModuleName>-list.html.twig`
214+
- `src/<ModuleName>/src/Handler/Get<ModuleName>ListHandler.php`: renders the resource list page
215+
- `src/<ModuleName>/templates/<ModuleName>/<ModuleName>-list.html.twig`: renders the resource list
228216

229217
The matching ServiceInterface will be automatically injected into the Handler.
230218

0 commit comments

Comments
 (0)