-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor services definition from XML to PHP files
- Loading branch information
Showing
19 changed files
with
436 additions
and
197 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Symfony\Component\DependencyInjection\Loader\Configurator; | ||
|
||
return static function (ContainerConfigurator $containerConfigurator) { | ||
$containerConfigurator->import('services/*.php'); | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Symfony\Component\DependencyInjection\Loader\Configurator; | ||
|
||
use Akeneo\Pim\ApiClient\AkeneoPimClient; | ||
use Akeneo\Pim\ApiClient\AkeneoPimClientBuilder; | ||
use Akeneo\Pim\ApiClient\AkeneoPimClientInterface; | ||
|
||
return static function (ContainerConfigurator $containerConfigurator) { | ||
$services = $containerConfigurator->services(); | ||
|
||
$services->set('webgriffe_sylius_akeneo.api_client.factory', AkeneoPimClientBuilder::class) | ||
->args([ | ||
param('webgriffe_sylius_akeneo.api_client.base_url'), | ||
]) | ||
; | ||
|
||
$services->set('webgriffe_sylius_akeneo.api_client', AkeneoPimClient::class) | ||
->factory([service('webgriffe_sylius_akeneo.api_client.factory'), 'buildAuthenticatedByPassword']) | ||
->args([ | ||
param('webgriffe_sylius_akeneo.api_client.client_id'), | ||
param('webgriffe_sylius_akeneo.api_client.secret'), | ||
param('webgriffe_sylius_akeneo.api_client.username'), | ||
param('webgriffe_sylius_akeneo.api_client.password'), | ||
]) | ||
; | ||
|
||
$services->alias(AkeneoPimClientInterface::class, 'webgriffe_sylius_akeneo.api_client'); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Symfony\Component\DependencyInjection\Loader\Configurator; | ||
|
||
use Webgriffe\SyliusAkeneoPlugin\AttributeOptions\Importer; | ||
|
||
return static function (ContainerConfigurator $containerConfigurator) { | ||
$services = $containerConfigurator->services(); | ||
|
||
$services->set('webgriffe_sylius_akeneo.attribute_options.importer', Importer::class) | ||
->args([ | ||
service('webgriffe_sylius_akeneo.api_client'), | ||
service('sylius.repository.product_attribute'), | ||
service('event_dispatcher'), | ||
service('sylius.repository.product_option'), | ||
service('sylius.translation_locale_provider.admin'), | ||
service('sylius.factory.product_option_value_translation'), | ||
service('sylius.factory.product_option_value'), | ||
service('sylius.factory.product_option_translation'), | ||
service('translator'), | ||
]) | ||
->tag('webgriffe_sylius_akeneo.importer') | ||
; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Symfony\Component\DependencyInjection\Loader\Configurator; | ||
|
||
use Webgriffe\SyliusAkeneoPlugin\Command\ImportCommand; | ||
use Webgriffe\SyliusAkeneoPlugin\Command\ItemImportResultCleanupCommand; | ||
use Webgriffe\SyliusAkeneoPlugin\Command\ReconcileCommand; | ||
|
||
return static function (ContainerConfigurator $containerConfigurator) { | ||
$services = $containerConfigurator->services(); | ||
|
||
$services->set('webgriffe_sylius_akeneo.command.import', ImportCommand::class) | ||
->args([ | ||
service('webgriffe_sylius_akeneo.date_time_builder'), | ||
service('webgriffe_sylius_akeneo.importer_registry'), | ||
service('webgriffe_sylius_akeneo.command_bus'), | ||
]) | ||
->tag('console.command') | ||
; | ||
|
||
$services->set('webgriffe_sylius_akeneo.command.reconcile', ReconcileCommand::class) | ||
->args([ | ||
service('webgriffe_sylius_akeneo.reconciler_registry'), | ||
]) | ||
->tag('console.command') | ||
; | ||
|
||
$services->set('webgriffe_sylius_akeneo.command.item_import_result_cleanup', ItemImportResultCleanupCommand::class) | ||
->args([ | ||
service('webgriffe_sylius_akeneo.repository.item_import_result'), | ||
]) | ||
->tag('console.command') | ||
; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Symfony\Component\DependencyInjection\Loader\Configurator; | ||
|
||
use Psr\Container\ContainerInterface; | ||
use Webgriffe\SyliusAkeneoPlugin\Controller\ProductImportController; | ||
use Webgriffe\SyliusAkeneoPlugin\Controller\WebhookController; | ||
|
||
return static function (ContainerConfigurator $containerConfigurator) { | ||
$services = $containerConfigurator->services(); | ||
|
||
$services->set('webgriffe_sylius_akeneo.controller.product_import_controller', ProductImportController::class) | ||
->args([ | ||
service('sylius.repository.product'), | ||
service('webgriffe_sylius_akeneo.command_bus'), | ||
service('translator'), | ||
]) | ||
->call('setContainer', [service(ContainerInterface::class)]) | ||
->tag('controller.service_arguments') | ||
; | ||
|
||
$services->set('webgriffe_sylius_akeneo.controller.webhook', WebhookController::class) | ||
->args([ | ||
service('monolog.logger.webgriffe_sylius_akeneo_plugin'), | ||
service('webgriffe_sylius_akeneo.command_bus'), | ||
param('webgriffe_sylius_akeneo.webhook.secret'), | ||
service('event_dispatcher'), | ||
]) | ||
->call('setContainer', [service(ContainerInterface::class)]) | ||
->tag('controller.service_arguments') | ||
; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Symfony\Component\DependencyInjection\Loader\Configurator; | ||
|
||
use Webgriffe\SyliusAkeneoPlugin\Converter\UnitMeasurementValueConverter; | ||
use Webgriffe\SyliusAkeneoPlugin\Converter\ValueConverter; | ||
|
||
return static function (ContainerConfigurator $containerConfigurator) { | ||
$services = $containerConfigurator->services(); | ||
|
||
$services->set('webgriffe_sylius_akeneo.converter.value', ValueConverter::class) | ||
->args([ | ||
service('translator'), | ||
]) | ||
; | ||
|
||
$services->set('webgriffe_sylius_akeneo.converter.unit_measurement_value', UnitMeasurementValueConverter::class) | ||
->args([ | ||
service('webgriffe_sylius_akeneo.api_client'), | ||
]) | ||
; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Symfony\Component\DependencyInjection\Loader\Configurator; | ||
|
||
use Webgriffe\SyliusAkeneoPlugin\DateTimeBuilder; | ||
use Webgriffe\SyliusAkeneoPlugin\DateTimeBuilderInterface; | ||
|
||
return static function (ContainerConfigurator $containerConfigurator) { | ||
$services = $containerConfigurator->services(); | ||
|
||
$services->set('webgriffe_sylius_akeneo.date_time_builder', DateTimeBuilder::class); | ||
|
||
$services->alias(DateTimeBuilderInterface::class, 'webgriffe_sylius_akeneo.date_time_builder'); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Symfony\Component\DependencyInjection\Loader\Configurator; | ||
|
||
use Webgriffe\SyliusAkeneoPlugin\Menu\AdminMenuListener; | ||
|
||
return static function (ContainerConfigurator $containerConfigurator) { | ||
$services = $containerConfigurator->services(); | ||
|
||
$services->set('webgriffe_sylius_akeneo.event_listener.admin_menu_listener', AdminMenuListener::class) | ||
->tag('kernel.event_listener', [ | ||
'event' => 'sylius.menu.admin.main', | ||
'method' => 'addAdminMenuItems', | ||
]) | ||
; | ||
}; |
Oops, something went wrong.