Skip to content

Commit

Permalink
new functionality: configuration generator
Browse files Browse the repository at this point in the history
  • Loading branch information
luigimassa committed May 23, 2024
1 parent ba99763 commit e8da307
Show file tree
Hide file tree
Showing 15 changed files with 804 additions and 171 deletions.
77 changes: 77 additions & 0 deletions config/modules.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
parameters:
templates_module_generator_base_path: /fop_console/src/Resources/templates/generate_module_command/module

services:
fop.console.module_generator.file_generator:
abstract: true
class: FOP\Console\Generator\FileGenerator
arguments:
- '@twig'

# configuration generation
fop.console.module_generator.configuration.yaml_file:
public: true
parent: fop.console.module_generator.file_generator
class: FOP\Console\Generator\YamlFileGenerator
calls:
- [ setTemplateName, [ 'configuration.yml.twig' ] ]
- [ setTemplatesBaseFolder,[ '%templates_module_generator_base_path%/configuration' ] ]
- [ setFileNameModule, ['/admin/configuration.yml']]
tags:
- { name: fop.console.module_generator.configuration_generator }

fop.console.module_generator.configuration.form_class_file:
public: true
parent: fop.console.module_generator.file_generator
class: FOP\Console\Generator\ClassFileGenerator
calls:
- [ setTemplateName, [ 'configuration_form.php.twig' ] ]
- [ setTemplatesBaseFolder,[ '%templates_module_generator_base_path%/configuration' ] ]
- [ setClassFolderName,[ 'src/Form/' ] ]
- [ setFileNameModule,[ 'ConfigurationForm.php' ] ]
tags:
- { name: fop.console.module_generator.configuration_generator }

fop.console.module_generator.configuration.text_data_class_file:
public: true
parent: fop.console.module_generator.file_generator
class: FOP\Console\Generator\ClassFileGenerator
calls:
- [ setTemplateName, [ 'text_data_configuration.php.twig' ] ]
- [ setTemplatesBaseFolder,[ '%templates_module_generator_base_path%/configuration' ] ]
- [ setClassFolderName,[ 'src/Configuration/' ] ]
- [ setFileNameModule,[ 'TextDataConfiguration.php' ] ]
tags:
- { name: fop.console.module_generator.configuration_generator }

fop.console.module_generator.configuration.text_data_provider_class_file:
public: true
parent: fop.console.module_generator.file_generator
class: FOP\Console\Generator\ClassFileGenerator
calls:
- [ setTemplateName, [ 'text_data_provider.php.twig' ] ]
- [ setTemplatesBaseFolder,[ '%templates_module_generator_base_path%/configuration' ] ]
- [ setClassFolderName,[ 'src/Provider/' ] ]
- [ setFileNameModule,[ 'ConfigurationTextFormDataProvider.php' ] ]

fop.console.module_generator.configuration.controller_twig_file:
public: true
parent: fop.console.module_generator.file_generator
class: FOP\Console\Generator\TwigFileGenerator
calls:
- [ setTemplateName, [ 'template_configuration.twig' ] ]
- [ setTemplatesBaseFolder,[ '%templates_module_generator_base_path%/configuration' ] ]
- [ setFileNameModule,[ 'configuration_view.html.twig' ] ]
- [ setModuleFolder,[ 'views/templates/admin/controller' ] ]
tags:
- { name: fop.console.module_generator.configuration_generator }

fop.console.module_generator.configuration.display_code_controller:
public: true
parent: fop.console.module_generator.file_generator
class: FOP\Console\Generator\CodeDisplayGenerator
calls:
- [ setTemplateName, [ 'code_controller.php.twig' ] ]
- [ setTemplatesBaseFolder,[ '%templates_module_generator_base_path%/configuration' ] ]
tags:
- { name: fop.console.module_generator.configuration_generator }
3 changes: 3 additions & 0 deletions config/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ services:

fop.console.module.generate.command:
class: FOP\Console\Commands\Module\ModuleGenerate
calls:
- [ setGeneratorConfigurationServices, [ !tagged_iterator fop.console.module_generator.configuration_generator ] ]

Check failure on line 119 in config/services.yml

View workflow job for this annotation

GitHub Actions / Yaml Lint

Tags support is not enabled. Enable the "Yaml::PARSE_CUSTOM_TAGS" flag to use "!tagged_iterator" at line 119 (near "- [ setGeneratorConfigurationServices, [ !tagged_iterator fop.console.module_generator.configuration_generator ] ]").
tags: [ console.command ]

fop.console.override.make.command:
Expand Down Expand Up @@ -144,3 +146,4 @@ services:

imports:
- { resource: overriders.yml }
- { resource: modules.yml }
Loading

0 comments on commit e8da307

Please sign in to comment.