2022-04-27 11:30:43 +02:00

31 lines
1.4 KiB
YAML

description: 'Generate & Register a controller'
help: 'The <info>generate:controller</info> command helps you generate a new controller.'
welcome: 'Welcome to the Drupal Controller generator'
options:
module: 'The Module name.'
class: 'Controller Class name'
routes: 'The routes, must be an array containing [title, method, path]'
services: 'Load services from the container.'
test: 'Generate a test class'
questions:
module: 'Enter the module name'
class: 'Enter the Controller class name'
title: 'Enter the Controller method title (to stop adding more methods, leave this empty)'
method: 'Enter the action method name'
path: 'Enter the route path'
services: 'Enter your service'
test: 'Do you want to generate a unit test class?'
messages:
title-empty: 'Title must contain a value (you must enter at least one method)'
title-already-added: 'Title was already added'
method-name-already-added: 'Method name was already added'
path-already-added: 'Path was already added'
examples:
- description: 'Generate controller specifying the module name, the class name and its routes'
execution: |
drupal generate:controller \
--module="modulename" \
--class="DefaultController" \
--routes='"title":"ControllerMethod", "name":"modulename.default_controller_hello", "method":"hello", "path":"/modulename/hello/{name}"' \
--test