Skip to content

Commit 6c3fc90

Browse files
committed
feat: use php config
1 parent 781e045 commit 6c3fc90

6 files changed

Lines changed: 29 additions & 20 deletions

File tree

src/main/kotlin/de/shyim/shopware6/action/generator/php/NewPluginAction.kt

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import com.jetbrains.php.lang.PhpFileType
1313
import de.shyim.shopware6.action.generator.ActionUtil
1414
import de.shyim.shopware6.templates.ShopwareTemplates
1515
import icons.ShopwareToolBoxIcons
16-
import org.jetbrains.yaml.YAMLFileType
1716

1817
class NewPluginAction : DumbAwareAction("Create a Plugin", "Create a new Plugin", ShopwareToolBoxIcons.SHOPWARE) {
1918
override fun actionPerformed(e: AnActionEvent) {
@@ -83,23 +82,23 @@ class NewPluginAction : DumbAwareAction("Create a Plugin", "Create a new Plugin"
8382

8483
ActionUtil.createFile(
8584
e.project!!,
86-
YAMLFileType.YML,
87-
"services.yaml",
85+
PhpFileType.INSTANCE,
86+
"services.php",
8887
ShopwareTemplates.renderTemplate(
8988
e.project!!,
90-
ShopwareTemplates.SHOPWARE_PLUGIN_SERVICES_YAML,
89+
ShopwareTemplates.SHOPWARE_PLUGIN_SERVICES_PHP,
9190
config.toMap()
9291
),
9392
configFolder
9493
)
9594

9695
ActionUtil.createFile(
9796
e.project!!,
98-
YAMLFileType.YML,
99-
"routes.yaml",
97+
PhpFileType.INSTANCE,
98+
"routes.php",
10099
ShopwareTemplates.renderTemplate(
101100
e.project!!,
102-
ShopwareTemplates.SHOPWARE_PLUGIN_ROUTES_YAML,
101+
ShopwareTemplates.SHOPWARE_PLUGIN_ROUTES_PHP,
103102
config.toMap()
104103
),
105104
configFolder
@@ -124,4 +123,4 @@ class NewPluginAction : DumbAwareAction("Create a Plugin", "Create a new Plugin"
124123
directory
125124
)
126125
}
127-
}
126+
}

src/main/kotlin/de/shyim/shopware6/templates/ShopwareTemplates.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ class ShopwareTemplates : FileTemplateGroupDescriptorFactory {
104104
const val SHOPWARE_PLUGIN_BOOTSTRAP = "Shopware Plugin Bootstrap.php"
105105
const val SHOPWARE_PLUGIN_CHANGELOG = "Shopware Plugin Changelog.md"
106106
const val SHOPWARE_PLUGIN_COMPOSER_JSON = "Shopware Plugin composer.json"
107-
const val SHOPWARE_PLUGIN_SERVICES_YAML = "Shopware Plugin services.yaml"
108-
const val SHOPWARE_PLUGIN_ROUTES_YAML = "Shopware Plugin routes.yaml"
107+
const val SHOPWARE_PLUGIN_SERVICES_PHP = "Shopware Plugin services.php"
108+
const val SHOPWARE_PLUGIN_ROUTES_PHP = "Shopware Plugin routes.php"
109109
const val SHOPWARE_APP_HOOK = "Shopware App script.twig"
110110
const val SHOPWARE_APP_MANIFEST = "Shopware App manifest.xml"
111111
const val SHOPWARE_APP_CUSTOM_ENTITIES = "Shopware App custom entities.xml"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php declare(strict_types=1);
2+
3+
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
4+
5+
return static function (RoutingConfigurator $routes): void {
6+
$routes->import('../../Controller', 'attribute');
7+
};

src/main/resources/fileTemplates/j2ee/plugin/Shopware Plugin routes.yaml.ft

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php declare(strict_types=1);
2+
3+
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
4+
5+
return static function (ContainerConfigurator $configurator): void {
6+
$services = $configurator->services()
7+
->defaults()
8+
->autowire()
9+
->autoconfigure();
10+
11+
$services->load('${NAMESPACE}\\', '../*')
12+
->exclude('../{Resources,${NAME}.php}');
13+
};

src/main/resources/fileTemplates/j2ee/plugin/Shopware Plugin services.yaml.ft

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)