This page assumes that you have created a Composer "make" script as described on the Setup page.
dot-maker
will look for a matching ServiceInterface in the module (e.g.: BookServiceInterface — BookHandler). If it finds one, it will automatically inject it into the Handler.
To create a Handler, use either of the following commands:
composer make handler
OR
./vendor/bin/dot-maker handler
dot-maker
needs to know in which module you want to create the new Handler.
To determine this, it will prompt you to enter the name of an existing module:
Existing module name:
If you input a module name which does not exist (like, "NonExistentModule"), an error will be thrown:
Module "NonExistentModule" not found
and will keep prompting for a valid module name until you provide one.
Once an existing module name (like, "ExistingModule") is provided, dot-maker
will output a success message:
Found Module "ExistingModule"
Once the target module has been identified, you will be prompted to input a name for the Handler:
Handler name:
The name must contain only letters and numbers.
You don't have to append "Handler" to the name. It is automatically appended when necessary. See our Naming Standards page for more information.
If you leave the name blank, the process will exit.
If you input an invalid name (like, "."), an error will be thrown:
Invalid Handler name: "."
If you input the name of an existing Handler (like, "ExistingHandler"), an error will be thrown:
Class "ExistingHandler" already exists at /path/to/project/src/ExistingModule/src/Handler/ExistingHandler.php
Once you input a valid name (like, "Book"), the process will iterate over a list of CRUD operations, asking you to confirm whether the Module needs a request Handler for each operation.
The prompt asks you whether you want to list resources:
Allow listing Resources? [Y(es)/n(o)]:
On confirmation, the process will create the following files:
src/ExistingModule/src/Collection/BookCollection.php
: describes a resource-specific collectionsrc/ExistingModule/src/Handler/Book/GetBookCollectionHandler.php
: handles the resource collection representationThe matching Collection and ServiceInterface will be automatically injected into the Handler.
Without confirmation, the process will skip to the next component.
The prompt asks you whether you want to view resources:
Allow viewing Resources? [Y(es)/n(o)]:
On confirmation, the process will create the following file:
src/ExistingModule/src/Handler/Book/GetBookResourceHandler.php
: handles the resource representationThe matching ServiceInterface will be automatically injected into the Handler.
Without confirmation, the process will skip to the next component.
The prompt asks you whether you want to create resources:
Allow creating Resources? [Y(es)/n(o)]:
On confirmation, the process will create the following files:
src/ExistingModule/src/Handler/Book/PostBookResourceHandler.php
: handles the resource creationsrc/ExistingModule/src/InputFilter/CreateBookInputFilter.php
: request payload validatorsThe matching InputFilter and ServiceInterface will be automatically injected into the Handler.
Without confirmation, the process will skip to the next component.
The prompt asks you whether you want to delete resources:
Allow deleting Resources? [Y(es)/n(o)]:
On confirmation, the process will create the following files:
src/ExistingModule/src/Handler/Book/DeleteBookResourceHandler.php
: handles the resource deletionThe matching ServiceInterface will be automatically injected into the Handler.
Without confirmation, the process will skip to the next component.
The prompt asks you whether you want to edit resources:
Allow editing Resources? [Y(es)/n(o)]:
On confirmation, the process will create the following files:
src/ExistingModule/src/Handler/Book/PatchBookResourceHandler.php
: handles the resource updatesrc/ExistingModule/src/InputFilter/EditBookInputFilter.php
: request payload validatorsThe matching InputFilter and ServiceInterface will be automatically injected into the Handler.
Without confirmation, the process will skip to the next component.
The prompt asks you whether you want to replace resources:
Allow replacing Resources? [Y(es)/n(o)]:
On confirmation, the process will create the following files:
src/ExistingModule/src/Handler/Book/PutBookResourceHandler.php
: handles the resource replacementsrc/ExistingModule/src/InputFilter/ReplaceBookInputFilter.php
: request payload validatorsThe matching InputFilter and ServiceInterface will be automatically injected into the Handler.
Without confirmation, the process will skip to the next component.
The prompt asks you whether you want to list resources:
Allow listing Resources? [Y(es)/n(o)]:
On confirmation, the process will create the following files:
src/ExistingModule/src/Handler/Book/GetBookListHandler.php
: renders the resource list pagesrc/ExistingModule/templates/existing-module/book-list.html.twig
: renders the resource listThe matching ServiceInterface will be automatically injected into the Handler.
Without confirmation, the process will skip to the next component.
The prompt asks you whether you want to view resources:
Allow viewing Resources? [Y(es)/n(o)]:
On confirmation, the process will create the following files:
src/ExistingModule/src/Handler/Book/GetBookViewHandler.php
: renders the resource pagesrc/ExistingModule/templates/existing-module/book-view.html.twig
: renders the resourceThe matching ServiceInterface will be automatically injected into the Handler.
Without confirmation, the process will skip to the next component.
The prompt asks you whether you want to create resources:
Allow creating Resources? [Y(es)/n(o)]:
On confirmation, the process will create the following files:
src/ExistingModule/src/Handler/Book/GetBookCreateFormHandler.php
: renders the resource creation form pagesrc/ExistingModule/src/Handler/Book/PostBookCreateHandler.php
: handles the resource creationsrc/ExistingModule/src/Form/CreateBookForm.php
: form fieldssrc/ExistingModule/src/InputFilter/CreateBookInputFilter.php
: form field validatorssrc/ExistingModule/templates/existing-module/book-view.html.twig
: renders the resource creation formThe matching Form and ServiceInterface will be automatically injected into the Handler.
Without confirmation, the process will skip to the next component.
The prompt asks you whether you want to delete resources:
Allow deleting Resources? [Y(es)/n(o)]:
On confirmation, the process will create the following files:
src/ExistingModule/src/Handler/Book/GetBookDeleteFormHandler.php
: renders the resource deletion form pagesrc/ExistingModule/src/Handler/Book/PostBookDeleteHandler.php
: handles the resource deletionsrc/ExistingModule/src/Form/DeleteBookForm.php
: form fieldssrc/ExistingModule/src/InputFilter/DeleteBookInputFilter.php
: form field validatorssrc/ExistingModule/src/InputFilter/Input/ConfirmDeleteBookInput.php
: checkbox input for deletion confirmationsrc/ExistingModule/templates/existing-module/book-delete-form.html.twig
: renders the resource deletion formThe matching ServiceInterface will be automatically injected into the Handler.
Without confirmation, the process will skip to the next component.
The prompt asks you whether you want to edit resources:
Allow editing Resources? [Y(es)/n(o)]:
On confirmation, the process will create the following files:
src/ExistingModule/src/Handler/Book/GetBookEditFormHandler.php
: renders the resource edit form pagesrc/ExistingModule/src/Handler/Book/PostBookEditHandler.php
: handles the resource updatesrc/ExistingModule/src/Form/EditBookForm.php
: form fieldssrc/ExistingModule/src/InputFilter/EditBookInputFilter.php
: form field validatorssrc/ExistingModule/templates/existing-module/book-edit-form.html.twig
: renders the resource creation formThe matching InputFilter and ServiceInterface will be automatically injected into the Handler.
Without confirmation, the process will skip to the next component.
To allow the creation of multiple Handlers, the process will loop until you leave the name blank. Each iteration creates a new set of Handlers(, Forms), InputFilters and Inputs under the same module.