help: 'The <info>generate:controller</info> command helps you generate a new controller.'
welcome: 'Welcome to the Drupal Controller generator'
options:
- module: common.options.module
- class: 'Controller Class name'
- routes: 'The routes, must be an array containing [title, method, path]'
- services: common.options.services
- test: 'Generate a test class'
+ 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: common.questions.module
- 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: common.questions.services
- test: 'Do you want to generate a unit test class'
+ 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'
+ 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
\ No newline at end of file