Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove 'local' pickup points #98

Open
wants to merge 1 commit into
base: 2.x
Choose a base branch
from
Open
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
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
"symfony/http-foundation": "^5.4 || ^6.0",
"symfony/http-kernel": "^5.4 || ^6.0",
"symfony/intl": "^5.4 || ^6.0",
"symfony/messenger": "^5.4 || ^6.0",
"symfony/options-resolver": "^5.4 || ^6.0",
"symfony/routing": "^5.4 || ^6.0",
"symfony/security-bundle": "^5.4 || ^6.0",
Expand Down
78 changes: 0 additions & 78 deletions src/Command/LoadPickupPointsCommand.php

This file was deleted.

14 changes: 0 additions & 14 deletions src/DependencyInjection/Compiler/RegisterProvidersPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

use InvalidArgumentException;
use Setono\SyliusPickupPointPlugin\Provider\CachedProvider;
use Setono\SyliusPickupPointPlugin\Provider\LocalProvider;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
Expand All @@ -22,7 +21,6 @@ public function process(ContainerBuilder $container): void

$registry = $container->getDefinition('setono_sylius_pickup_point.registry.provider');
$cacheEnabled = $container->getParameter('setono_sylius_pickup_point.cache.enabled') === true;
$localEnabled = $container->getParameter('setono_sylius_pickup_point.local') === true;

$typeToLabelMap = [];
foreach ($container->findTaggedServiceIds('setono_sylius_pickup_point.provider') as $id => $tagged) {
Expand All @@ -45,18 +43,6 @@ public function process(ContainerBuilder $container): void
$container->setDefinition($id, $cachedDefinition);
}

if ($localEnabled) {
$decoratedId = $id;
$id .= '.local'; // overwrite the id
$cachedDefinition = new Definition(LocalProvider::class, [
new Reference($id . '.inner'),
new Reference('setono_sylius_pickup_point.repository.pickup_point'),
]);
$cachedDefinition->setDecoratedService($decoratedId, null, 512);

$container->setDefinition($id, $cachedDefinition);
}

$registry->addMethodCall('register', [$attributes['code'], new Reference($id)]);
}
}
Expand Down
36 changes: 0 additions & 36 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,7 @@
use Setono\DAOBundle\SetonoDAOBundle;
use Setono\GlsWebserviceBundle\SetonoGlsWebserviceBundle;
use Setono\PostNordBundle\SetonoPostNordBundle;
use Setono\SyliusPickupPointPlugin\Doctrine\ORM\PickupPointRepository;
use Setono\SyliusPickupPointPlugin\Model\PickupPoint;
use Sylius\Bundle\ResourceBundle\Controller\ResourceController;
use Sylius\Bundle\ResourceBundle\Form\Type\DefaultResourceType;
use Sylius\Bundle\ResourceBundle\SyliusResourceBundle;
use Sylius\Component\Resource\Factory\Factory;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;

Expand All @@ -40,11 +34,6 @@ public function getConfigTreeBuilder(): TreeBuilder
->end()
->end()
->end()
->booleanNode('local')
->defaultValue(true)
->info('Whether to use the local database when timeouts occur in third party HTTP calls. Remember to run the setono-sylius-pickup-point:load-pickup-points command periodically to populate the local database with pickup points')
->example(true)
->end()
->arrayNode('providers')
->addDefaultsIfNotSet()
->children()
Expand Down Expand Up @@ -72,31 +61,6 @@ public function getConfigTreeBuilder(): TreeBuilder
->end()
;

$this->addResourcesSection($rootNode);

return $treeBuilder;
}

private function addResourcesSection(ArrayNodeDefinition $node): void
{
/** @psalm-suppress MixedMethodCall,PossiblyUndefinedMethod,PossiblyNullReference */
$node
->children()
->arrayNode('resources')
->addDefaultsIfNotSet()
->children()
->arrayNode('pickup_point')
->addDefaultsIfNotSet()
->children()
->variableNode('options')->end()
->arrayNode('classes')
->addDefaultsIfNotSet()
->children()
->scalarNode('model')->defaultValue(PickupPoint::class)->cannotBeEmpty()->end()
->scalarNode('controller')->defaultValue(ResourceController::class)->cannotBeEmpty()->end()
->scalarNode('repository')->defaultValue(PickupPointRepository::class)->cannotBeEmpty()->end()
->scalarNode('form')->defaultValue(DefaultResourceType::class)->end()
->scalarNode('factory')->defaultValue(Factory::class)->end()
;
}
}
3 changes: 0 additions & 3 deletions src/DependencyInjection/SetonoSyliusPickupPointExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ public function load(array $configs, ContainerBuilder $container): void
/** @psalm-suppress PossiblyNullArgument */
$config = $this->processConfiguration($this->getConfiguration([], $container), $configs);
$loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
$container->setParameter('setono_sylius_pickup_point.local', $config['local']);

$this->registerResources('setono_sylius_pickup_point', $config['driver'], $config['resources'], $container);

$loader->load('services.xml');

Expand Down
61 changes: 0 additions & 61 deletions src/Doctrine/ORM/PickupPointRepository.php

This file was deleted.

16 changes: 16 additions & 0 deletions src/Factory/PickupPointFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

declare(strict_types=1);

namespace Setono\SyliusPickupPointPlugin\Factory;

use Setono\SyliusPickupPointPlugin\Model\PickupPoint;
use Setono\SyliusPickupPointPlugin\Model\PickupPointInterface;

final class PickupPointFactory implements PickupPointFactoryInterface
{
public function createNew(): PickupPointInterface
{
return new PickupPoint();
}
}
12 changes: 12 additions & 0 deletions src/Factory/PickupPointFactoryInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

declare(strict_types=1);

namespace Setono\SyliusPickupPointPlugin\Factory;

use Setono\SyliusPickupPointPlugin\Model\PickupPointInterface;

interface PickupPointFactoryInterface
{
public function createNew(): PickupPointInterface;
}
9 changes: 0 additions & 9 deletions src/Message/Command/CommandInterface.php

This file was deleted.

33 changes: 0 additions & 33 deletions src/Message/Command/LoadPickupPoints.php

This file was deleted.

Loading