diff --git a/src/Extensions/Shopware/Install/Command/ShopwareInstallVcsCommand.php b/src/Extensions/Shopware/Install/Command/ShopwareInstallVcsCommand.php
index 6b128d7a..6c4689a3 100644
--- a/src/Extensions/Shopware/Install/Command/ShopwareInstallVcsCommand.php
+++ b/src/Extensions/Shopware/Install/Command/ShopwareInstallVcsCommand.php
@@ -9,7 +9,7 @@
class ShopwareInstallVcsCommand extends BaseCommand
{
- const MAIN_BRANCH = '5.4';
+ const MAIN_BRANCH = '5.5';
/**
* {@inheritdoc}
diff --git a/src/Extensions/Shopware/PluginCreator/Command/CreatePluginCommand.php b/src/Extensions/Shopware/PluginCreator/Command/CreatePluginCommand.php
index 216179c7..599e2184 100644
--- a/src/Extensions/Shopware/PluginCreator/Command/CreatePluginCommand.php
+++ b/src/Extensions/Shopware/PluginCreator/Command/CreatePluginCommand.php
@@ -1,17 +1,11 @@
%command.name% creates a new plugin.
EOF
);
- ;
}
-
-
public function interact(InputInterface $input, OutputInterface $output)
{
/** @var \Symfony\Component\Console\Helper\QuestionHelper $helper */
@@ -144,14 +135,16 @@ public function interact(InputInterface $input, OutputInterface $output)
// for backend / api the backendModel is mandatory
if (($input->getOption('haveBackend') || $input->getOption('haveApi')) && empty($backendModel)) {
- $question = new Question('Please specify the main model for your backend application: ' . $defaultModel . ': ');
- $question->setValidator($this->validateModel($input));
+ $question = new Question('Please specify the main model for your backend application: ' . $defaultModel . ': ', $defaultModel);
+ $question->setValidator($this->validateModel());
$modelName = $helper->ask($input, $output, $question);
$input->setOption('backendModel', $modelName);
}
// a backend implicitly sets "haveModel" to true, if the backend model is not a default model
- if ($input->getOption('haveBackend') && strpos($input->getOption('backendModel'), 'Shopware\Models') === false) {
+ if ($input->getOption('haveBackend')
+ && strpos($input->getOption('backendModel'), 'Shopware\Models') === false
+ ) {
$input->setOption('haveModels', true);
}
}
@@ -163,7 +156,18 @@ public function interact(InputInterface $input, OutputInterface $output)
*/
public function normalizeBooleanFields(InputInterface $input)
{
- foreach (['haveBackend', 'haveFrontend', 'haveModels', 'haveCommands', 'haveWidget', 'haveApi', 'haveFilter', self::LEGACY_OPTION] as $key) {
+ $inputOptions = [
+ 'haveBackend',
+ 'haveFrontend',
+ 'haveModels',
+ 'haveCommands',
+ 'haveWidget',
+ 'haveApi',
+ 'haveFilter',
+ self::LEGACY_OPTION
+ ];
+
+ foreach ($inputOptions as $key) {
switch (strtolower($input->getOption($key))) {
case 'false':
case '0':
@@ -191,8 +195,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$configuration = $this->getConfigurationObject($input);
$configuration->pluginConfig = $this->getConfig()->offsetGet('PluginConfig');
- $generatorFactory = new GeneratorFactory();
- $generator = $generatorFactory->create($configuration);
+ $generator = (new GeneratorFactory())->create($configuration);
$generator->run();
}
@@ -209,8 +212,6 @@ protected function validateName($name)
if (count($parts) <= 1) {
throw new \InvalidArgumentException('Name must be in CamelCase and have at least two components. Don\'t forget you developer-prefix');
}
-
- return $name;
}
/**
@@ -243,13 +244,11 @@ public function validateNamespace($input)
/**
* Check the entered model (check might be somewhat more sufisticated)
*
- * @param $input
* @throws \InvalidArgumentException
- * @return $input
*/
- public function validateModel($input)
+ public function validateModel()
{
- return function () use ($input) {
+ return function ($input) {
if (empty($input)) {
throw new \InvalidArgumentException('You need to enter a model name like »Shopware\Models\Article\Article«');
}
diff --git a/src/Extensions/Shopware/PluginCreator/Services/Generator.php b/src/Extensions/Shopware/PluginCreator/Services/Generator.php
index 9fae2df8..62828c62 100644
--- a/src/Extensions/Shopware/PluginCreator/Services/Generator.php
+++ b/src/Extensions/Shopware/PluginCreator/Services/Generator.php
@@ -3,19 +3,7 @@
namespace Shopware\PluginCreator\Services;
use Shopware\PluginCreator\Services\IoAdapter\IoAdapter;
-use Shopware\PluginCreator\Services\TemplateFileProvider\ApiFileProvider;
-use Shopware\PluginCreator\Services\TemplateFileProvider\BackendControllerFileProvider;
-use Shopware\PluginCreator\Services\TemplateFileProvider\BackendFileProvider;
-use Shopware\PluginCreator\Services\TemplateFileProvider\CommandFileProvider;
-use Shopware\PluginCreator\Services\TemplateFileProvider\ControllerPathFileProvider;
-use Shopware\PluginCreator\Services\TemplateFileProvider\DefaultFileProvider;
-use Shopware\PluginCreator\Services\TemplateFileProvider\FileProviderInterface;
use Shopware\PluginCreator\Services\TemplateFileProvider\FileProviderLoaderInterface;
-use Shopware\PluginCreator\Services\TemplateFileProvider\FilterFileProvider;
-use Shopware\PluginCreator\Services\TemplateFileProvider\FrontendFileProvider;
-use Shopware\PluginCreator\Services\TemplateFileProvider\LegacyOptionFileProviderLoader;
-use Shopware\PluginCreator\Services\TemplateFileProvider\ModelFileProvider;
-use Shopware\PluginCreator\Services\TemplateFileProvider\WidgetFileProvider;
use Shopware\PluginCreator\Services\WorkingDirectoryProvider\OutputDirectoryProviderInterface;
use Shopware\PluginCreator\Struct\Configuration;
diff --git a/src/Extensions/Shopware/PluginCreator/template/current/Controllers/Backend.tpl b/src/Extensions/Shopware/PluginCreator/template/current/Controllers/Backend.tpl
index df52d3b0..ae836a71 100644
--- a/src/Extensions/Shopware/PluginCreator/template/current/Controllers/Backend.tpl
+++ b/src/Extensions/Shopware/PluginCreator/template/current/Controllers/Backend.tpl
@@ -7,14 +7,13 @@
*/
class Shopware_Controllers_Backend_= $configuration->name; ?> extends Shopware_Controllers_Backend_Application
{
- protected $model = '\= $configuration->name; ?>\Models\= $configuration->backendModel; ?>';
+ protected $model = \= $configuration->backendModel; ?>::class;
+
protected $alias = '= $names->under_score_model; ?>';
class Shopware_Controllers_Backend_= $configuration->name; ?> extends Shopware_Controllers_Backend_ExtJs
{
-
-
hasWidget) { ?>
/**
* Loads data for the backend widget