Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/DependencyInjection/SyliusThemeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
* (c) Sylius Sp. z o.o.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand All @@ -19,7 +19,7 @@
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\Extension;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;

final class SyliusThemeExtension extends Extension
{
Expand All @@ -32,30 +32,30 @@ final class SyliusThemeExtension extends Extension
public function load(array $configs, ContainerBuilder $container): void
{
$config = $this->processConfiguration($this->getConfiguration([], $container), $configs);
$loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
$loader->load('services.xml');
$loader = new PhpFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
$loader->load('services.php');

if ($config['assets']['enabled']) {
$loader->load('services/integrations/assets.xml');
$loader->load('services/integrations/assets.php');

if ($config['legacy_mode']) {
$loader->load('services/integrations/legacy_assets.xml');
$loader->load('services/integrations/legacy_assets.php');
}
}

if ($config['templating']['enabled']) {
$loader->load('services/integrations/templates.xml');
$loader->load('services/integrations/templates.php');

if ($config['legacy_mode']) {
$loader->load('services/integrations/legacy_templates.xml');
$loader->load('services/integrations/legacy_templates.php');
}
}

if ($config['translations']['enabled']) {
$loader->load('services/integrations/translations.xml');
$loader->load('services/integrations/translations.php');

if ($config['legacy_mode']) {
$loader->load('services/integrations/legacy_translations.xml');
$loader->load('services/integrations/legacy_translations.php');
}
}

Expand Down
46 changes: 46 additions & 0 deletions src/Resources/config/services.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php

/*
* This file is part of the Sylius package.
*
* (c) Sylius Sp. z o.o.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

declare(strict_types=1);

namespace Symfony\Component\DependencyInjection\Loader\Configurator;

use Sylius\Bundle\ThemeBundle\Context\EmptyThemeContext;
use Sylius\Bundle\ThemeBundle\Context\SettableThemeContext;
use Sylius\Bundle\ThemeBundle\Context\ThemeContextInterface;
use Sylius\Bundle\ThemeBundle\HierarchyProvider\ThemeHierarchyProvider;
use Sylius\Bundle\ThemeBundle\HierarchyProvider\ThemeHierarchyProviderInterface;
use Sylius\Bundle\ThemeBundle\Repository\InMemoryThemeRepository;
use Sylius\Bundle\ThemeBundle\Repository\ThemeRepositoryInterface;

return static function (ContainerConfigurator $container) {
$services = $container->services();
$container->import('services/*.php');

$services->set(ThemeContextInterface::class, EmptyThemeContext::class);

$services->set(SettableThemeContext::class)
->args([service('sylius.theme.hierarchy_provider')]);

$services->alias('sylius.theme.context.settable', SettableThemeContext::class)
->deprecate('sylius/theme-bundle', '2.0', '"%alias_id%" service is deprecated since Sylius/ThemeBundle 2.0 and will be removed in 3.0.');

$services->set(ThemeRepositoryInterface::class, InMemoryThemeRepository::class)
->args([service('sylius.theme.loader')]);

$services->alias('sylius.repository.theme', ThemeRepositoryInterface::class)
->deprecate('sylius/theme-bundle', '2.0', '"%alias_id%" service is deprecated since Sylius/ThemeBundle 2.0 and will be removed in 3.0.');

$services->set(ThemeHierarchyProviderInterface::class, ThemeHierarchyProvider::class);

$services->alias('sylius.theme.hierarchy_provider', ThemeHierarchyProviderInterface::class)
->deprecate('sylius/theme-bundle', '2.0', '"%alias_id%" service is deprecated since Sylius/ThemeBundle 2.0 and will be removed in 3.0.');
};
41 changes: 0 additions & 41 deletions src/Resources/config/services.xml

This file was deleted.

44 changes: 44 additions & 0 deletions src/Resources/config/services/configuration.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php

/*
* This file is part of the Sylius package.
*
* (c) Sylius Sp. z o.o.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

declare(strict_types=1);

namespace Symfony\Component\DependencyInjection\Loader\Configurator;

use Sylius\Bundle\ThemeBundle\Configuration\CompositeConfigurationProvider;
use Sylius\Bundle\ThemeBundle\Configuration\ConfigurationProcessorInterface;
use Sylius\Bundle\ThemeBundle\Configuration\ConfigurationProviderInterface;
use Sylius\Bundle\ThemeBundle\Configuration\ThemeConfiguration;
use Symfony\Component\Config\Definition\Processor;

return static function (ContainerConfigurator $container) {
$services = $container->services();

$services->set(ThemeConfiguration::class);

$services->alias('sylius.theme.configuration', ThemeConfiguration::class)
->deprecate('sylius/theme-bundle', '2.0', '"%alias_id%" service is deprecated since Sylius/ThemeBundle 2.0 and will be removed in 3.0.');

$services->set(ConfigurationProcessorInterface::class, \Sylius\Bundle\ThemeBundle\Configuration\SymfonyConfigurationProcessor::class)
->args([
service('sylius.theme.configuration'),
inline_service(Processor::class),
]);

$services->alias('sylius.theme.configuration.processor', ConfigurationProcessorInterface::class)
->deprecate('sylius/theme-bundle', '2.0', '"%alias_id%" service is deprecated since Sylius/ThemeBundle 2.0 and will be removed in 3.0.');

$services->set(ConfigurationProviderInterface::class, CompositeConfigurationProvider::class)
->args([[]]);

$services->alias('sylius.theme.configuration.provider', ConfigurationProviderInterface::class)
->deprecate('sylius/theme-bundle', '2.0', '"%alias_id%" service is deprecated since Sylius/ThemeBundle 2.0 and will be removed in 3.0.');
};
38 changes: 0 additions & 38 deletions src/Resources/config/services/configuration.xml

This file was deleted.

33 changes: 33 additions & 0 deletions src/Resources/config/services/debug.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

/*
* This file is part of the Sylius package.
*
* (c) Sylius Sp. z o.o.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

declare(strict_types=1);

namespace Symfony\Component\DependencyInjection\Loader\Configurator;

use Sylius\Bundle\ThemeBundle\Collector\ThemeCollector;
use Sylius\Bundle\ThemeBundle\Command\ListCommand;

return static function (ContainerConfigurator $container) {
$services = $container->services();

$services->set(ListCommand::class)
->args([service('sylius.repository.theme')])
->tag('console.command');

$services->set(ThemeCollector::class)
->args([
service('sylius.repository.theme'),
service('sylius.context.theme'),
service('sylius.theme.hierarchy_provider'),
])
->tag('data_collector', ['template' => '@SyliusTheme/Collector/theme', 'id' => 'sylius_theme']);
};
28 changes: 0 additions & 28 deletions src/Resources/config/services/debug.xml

This file was deleted.

29 changes: 29 additions & 0 deletions src/Resources/config/services/form.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

/*
* This file is part of the Sylius package.
*
* (c) Sylius Sp. z o.o.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

declare(strict_types=1);

namespace Symfony\Component\DependencyInjection\Loader\Configurator;

use Sylius\Bundle\ThemeBundle\Form\Type\ThemeChoiceType;
use Sylius\Bundle\ThemeBundle\Form\Type\ThemeNameChoiceType;

return static function (ContainerConfigurator $container) {
$services = $container->services();

$services->set(ThemeChoiceType::class)
->args([service('sylius.repository.theme')])
->tag('form.type');

$services->set(ThemeNameChoiceType::class)
->args([service('sylius.repository.theme')])
->tag('form.type');
};
26 changes: 0 additions & 26 deletions src/Resources/config/services/form.xml

This file was deleted.

Loading
Loading