From 219913250eeb9ed8d3b0c9b10695367ac03ffc0d Mon Sep 17 00:00:00 2001 From: Patrizio Bekerle <patrizio.bekerle@tugraz.at> Date: Tue, 26 Apr 2022 09:10:09 +0200 Subject: [PATCH] Migrate to "example" from "template" --- README.md | 16 ++++++++-------- src/DependencyInjection/Configuration.php | 2 +- tests/Kernel.php | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 3399aba..0227c43 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# Relay Template Bundle +# Relay Example Bundle -This Symfony bundle can be used as a template for creating new bundles for the +This Symfony bundle can be used as an example for creating new bundles for the DBP Relay project. When including this bundle into your API server it will gain the following @@ -12,17 +12,17 @@ features: ## TL;DR -The quickest way to make use of this template bundle is to feed your desired names +The quickest way to make use of this example bundle is to feed your desired names to one command and generate a ready-to-use bundle with the correct naming. See [Generate DBP Symfony bundle](https://dbp-demo.tugraz.at/dev-guide/relay/naming/#generate-dbp-symfony-bundle) for more information. -## Using the Bundle as a Template +## Using the Bundle as an example * Copy the repo contents * Adjust the package name in `composer.json`, in this example we'll pretend you named your bundle `dbp/relay-your-bundle` * Invent a new PHP namespace and adjust it in all PHP files -* Rename `src/DbpRelayTemplateBundle` and `DependencyInjection/DbpRelayTemplateExtension` to match the new project name +* Rename `src/DbpRelayExampleBundle` and `DependencyInjection/DbpRelayExampleExtension` to match the new project name ## Integration into the API Server @@ -61,16 +61,16 @@ DBP\API\CoreBundle\DbpCoreBundle::class => ['all' => true], The bundle has a `example_config` configuration value that you can specify in your app, either by hard-coding it, or by referencing an environment variable. -For this create `config/packages/dbp_relay_template.yaml` in the app with the following +For this create `config/packages/dbp_relay_example.yaml` in the app with the following content: ```yaml -dbp_relay_template: +dbp_relay_example: example_config: 42 # example_config: '%env(EXAMPLE_CONFIG)%' ``` -The value gets read in `DbpRelayTemplateExtension` (your extension will be named differently) +The value gets read in `DbpRelayExampleExtension` (your extension will be named differently) and passed when creating the `MyCustomService` service. For more info on bundle configuration see [Symfony bundles configuration](https://symfony.com/doc/current/bundles/configuration.html). diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index 4e38e5a..86353cb 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -11,7 +11,7 @@ class Configuration implements ConfigurationInterface { public function getConfigTreeBuilder(): TreeBuilder { - $treeBuilder = new TreeBuilder('dbp_relay_template'); + $treeBuilder = new TreeBuilder('dbp_relay_example'); $treeBuilder->getRootNode() ->children() diff --git a/tests/Kernel.php b/tests/Kernel.php index a2aa1c7..d3ee50e 100644 --- a/tests/Kernel.php +++ b/tests/Kernel.php @@ -47,7 +47,7 @@ class Kernel extends BaseKernel 'secret' => '', ]); - $container->extension('dbp_relay_template', [ + $container->extension('dbp_relay_example', [ 'example_config' => 'test-42', ]); } -- GitLab