drupal-code-generator
drupal-code-generator copied to clipboard
Missing info.yml while generating a content entity
While generating a content entity and creating a new module in the process there won't be a generated *.info.yml
It seems to me this is because the command is extending the src/Command/ModuleGenerator.php Class, and the yml is created by the src/Command/Module.php class.
That needs steps to reproduce.
Sorry, for more clarification:
run drush generate entity:content
Make sure you create a new module. Default al following steps:
Welcome to content-entity generator!
––––––––––––––––––––––––––––––––––––––
Module machine name [web]:
➤ new_module
Entity type label [New module]:
➤
Entity type ID [new_module]:
➤
Entity base path [/new-module]:
➤
Make the entity type fieldable? [Yes]:
➤
Make the entity type revisionable? [No]:
➤
Make the entity type translatable? [No]:
➤
The entity type has bundle? [No]:
➤
Create canonical page? [Yes]:
➤
Create entity template? [Yes]:
➤
Create CRUD permissions? [No]:
➤
Add "label" base field? [Yes]:
➤
Add "status" base field? [Yes]:
➤
Add "created" base field? [Yes]:
➤
Add "changed" base field? [Yes]:
➤
Add "author" base field? [Yes]:
➤
Add "description" base field? [Yes]:
➤
Create REST configuration for the entity? [No]:
➤
The following directories and files have been created or updated:
–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
• /var/www/html/web/modules/custom/new_module/new_module.links.action.yml
• /var/www/html/web/modules/custom/new_module/new_module.links.contextual.yml
• /var/www/html/web/modules/custom/new_module/new_module.links.menu.yml
• /var/www/html/web/modules/custom/new_module/new_module.links.task.yml
• /var/www/html/web/modules/custom/new_module/new_module.module
• /var/www/html/web/modules/custom/new_module/new_module.permissions.yml
• /var/www/html/web/modules/custom/new_module/new_module.routing.yml
• /var/www/html/web/modules/custom/new_module/src/NewModuleInterface.php
• /var/www/html/web/modules/custom/new_module/src/NewModuleListBuilder.php
• /var/www/html/web/modules/custom/new_module/src/Entity/NewModule.php
• /var/www/html/web/modules/custom/new_module/src/Form/NewModuleForm.php
• /var/www/html/web/modules/custom/new_module/src/Form/NewModuleSettingsForm.php
• /var/www/html/web/modules/custom/new_module/templates/new-module.html.twig
In the list of created files aswell as the actual file system you'll see a missing new_module.info.yml, which is required.
Tested with: Drush 11.0.9 Drupal 9.4.1
The entity type is supposed to be generated for an existing module. Actually almost all generators work that way. We should probably add a validator for "Module machine name" question to make sure the module already exists.
Yea or maybe just refactor the first question: Module machine name => Existing module machine name, the validator sounds like a nice feat aswell, but clarifying this is intended for existing modules is a good hint for people to know what is expected.
That has been fixed in 3.x. The info file generated automatically when needed. Thank you.