Skip to content

Commit

Permalink
Merge pull request #150 from dpfaffenbauer/fix-export-runners
Browse files Browse the repository at this point in the history
Fix export runners
  • Loading branch information
dpfaffenbauer authored Feb 26, 2019
2 parents 26325a6 + 3b3e2ab commit 7c18b19
Show file tree
Hide file tree
Showing 7 changed files with 109 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ protected function getConfigInterpreters(): array
*/
protected function getConfigRunners(): array
{
return $this->getParameter('import_definition.runners');
return $this->getParameter('import_definition.export_runners');
}

/**
Expand All @@ -417,4 +417,4 @@ protected function getConfigFetchers(): array
{
return $this->getParameter('import_definition.fetchers');
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php
/**
* Import Definitions.
*
* LICENSE
*
* This source file is subject to the GNU General Public License version 3 (GPLv3)
* For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt
* files that are distributed with this source code.
*
* @copyright Copyright (c) 2016-2018 w-vision AG (https://www.w-vision.ch)
* @license https://github.com/w-vision/ImportDefinitions/blob/master/gpl-3.0.txt GNU General Public License version 3 (GPLv3)
*/

namespace ImportDefinitionsBundle\DependencyInjection\Compiler;

final class ExportRunnerRegistryCompilerPass extends AbstractServiceRegistryCompilerPass
{
public function __construct()
{
parent::__construct(
'import_definition.registry.export_runner',
'import_definition.export_runners',
'import_definition.export_runner'
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
->add('provider', ProviderChoiceType::class)
->add('fetcher', FetcherChoiceType::class)
->add('class', ClassChoiceType::class)
->add('runner', RunnerChoiceType::class)
->add('runner', ExportRunnerChoiceType::class)
->add('name', TextType::class)
->add('stopOnException', CheckboxType::class)
->add('fetchUnpublished', CheckboxType::class)
Expand Down
61 changes: 61 additions & 0 deletions src/ImportDefinitionsBundle/Form/Type/ExportRunnerChoiceType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?php
/**
* Import Definitions.
*
* LICENSE
*
* This source file is subject to the GNU General Public License version 3 (GPLv3)
* For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt
* files that are distributed with this source code.
*
* @copyright Copyright (c) 2016-2018 w-vision AG (https://www.w-vision.ch)
* @license https://github.com/w-vision/ImportDefinitions/blob/master/gpl-3.0.txt GNU General Public License version 3 (GPLv3)
*/

namespace ImportDefinitionsBundle\Form\Type;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\OptionsResolver\OptionsResolver;

final class ExportRunnerChoiceType extends AbstractType
{
/**
* @var array
*/
private $runners;

/**
* @param array $runners
*/
public function __construct(array $runners)
{
$this->runners = $runners;
}

/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'choices' => array_flip($this->runners),
]);
}

/**
* {@inheritdoc}
*/
public function getParent()
{
return ChoiceType::class;
}

/**
* {@inheritdoc}
*/
public function getBlockPrefix()
{
return 'import_definitions_export_runner_choice';
}
}
4 changes: 3 additions & 1 deletion src/ImportDefinitionsBundle/ImportDefinitionsBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use CoreShop\Bundle\ResourceBundle\CoreShopResourceBundle;
use ImportDefinitionsBundle\DependencyInjection\Compiler\CleanerRegistryCompilerPass;
use ImportDefinitionsBundle\DependencyInjection\Compiler\ExportProviderRegistryCompilerPass;
use ImportDefinitionsBundle\DependencyInjection\Compiler\ExportRunnerRegistryCompilerPass;
use ImportDefinitionsBundle\DependencyInjection\Compiler\FetcherRegistryCompilerPass;
use ImportDefinitionsBundle\DependencyInjection\Compiler\FilterRegistryCompilerPass;
use ImportDefinitionsBundle\DependencyInjection\Compiler\GetterRegistryCompilerPass;
Expand Down Expand Up @@ -70,6 +71,7 @@ public function build(ContainerBuilder $builder)
$builder->addCompilerPass(new GetterRegistryCompilerPass());
$builder->addCompilerPass(new FetcherRegistryCompilerPass());
$builder->addCompilerPass(new ExportProviderRegistryCompilerPass());
$builder->addCompilerPass(new ExportRunnerRegistryCompilerPass());
}

/**
Expand Down Expand Up @@ -140,4 +142,4 @@ public function getEditmodeCssPaths()
{
return [];
}
}
}
8 changes: 7 additions & 1 deletion src/ImportDefinitionsBundle/Resources/config/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ services:
class: ImportDefinitionsBundle\Exporter\Exporter
arguments:
- '@import_definition.registry.fetcher'
- '@import_definition.registry.runner'
- '@import_definition.registry.export_runner'
- '@import_definition.registry.interpreter'
- '@import_definition.registry.getter'
- '@import_definition.registry.export_provider'
Expand Down Expand Up @@ -123,6 +123,12 @@ services:
- ImportDefinitionsBundle\Runner\RunnerInterface
- 'Import Definition Runners'

import_definition.registry.export_runner:
class: CoreShop\Component\Registry\ServiceRegistry
arguments:
- ImportDefinitionsBundle\Runner\ExportRunnerInterface
- 'Export Definition Runners'

### CLEANER
import_definition.cleaner.deleter:
class: ImportDefinitionsBundle\Cleaner\Deleter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,11 @@ services:
arguments: ['@import_definitions.repository.definition']
tags:
- { name: form.type }


import_definition.form.export_runner_choice_type:
class: ImportDefinitionsBundle\Form\Type\ExportRunnerChoiceType
arguments: ['%import_definition.export_runners%']
tags:
- { name: form.type }

0 comments on commit 7c18b19

Please sign in to comment.