Skip to content

Commit

Permalink
v3.1.1 -- Updates for symfony 6.3.x deprecations.
Browse files Browse the repository at this point in the history
  • Loading branch information
gdbrown committed Jul 11, 2023
1 parent 91ffb98 commit 81ca7b2
Show file tree
Hide file tree
Showing 14 changed files with 35 additions and 31 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG-3.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
This changelog references the relevant changes done in 3.x versions.


## v3.1.1
* Updates for symfony 6.3.x deprecations.


## v3.1.0
* Require gdbots/pbjx-bundle 3.1.x
* Use new symfony/php attributes instead of annotations.
Expand Down
2 changes: 1 addition & 1 deletion src/Command/CreateSearchStorageCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function __construct(protected ContainerInterface $container, protected N
parent::__construct();
}

protected function configure()
protected function configure(): void
{
$provider = $this->container->getParameter('gdbots_ncr.ncr_search.provider');

Expand Down
2 changes: 1 addition & 1 deletion src/Command/CreateStorageCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function __construct(protected ContainerInterface $container, protected N
parent::__construct();
}

protected function configure()
protected function configure(): void
{
$provider = $this->container->getParameter('gdbots_ncr.ncr.provider');

Expand Down
2 changes: 1 addition & 1 deletion src/Command/DescribeSearchStorageCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function __construct(protected ContainerInterface $container, protected N
parent::__construct();
}

protected function configure()
protected function configure(): void
{
$provider = $this->container->getParameter('gdbots_ncr.ncr_search.provider');

Expand Down
2 changes: 1 addition & 1 deletion src/Command/DescribeStorageCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function __construct(protected ContainerInterface $container, protected N
parent::__construct();
}

protected function configure()
protected function configure(): void
{
$provider = $this->container->getParameter('gdbots_ncr.ncr.provider');

Expand Down
2 changes: 1 addition & 1 deletion src/Command/ExportNodesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function __construct(protected ContainerInterface $container, protected N
parent::__construct();
}

protected function configure()
protected function configure(): void
{
$provider = $this->container->getParameter('gdbots_ncr.ncr.provider');

Expand Down
2 changes: 1 addition & 1 deletion src/Command/GetNodeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function __construct(protected ContainerInterface $container, protected N
parent::__construct();
}

protected function configure()
protected function configure(): void
{
$provider = $this->container->getParameter('gdbots_ncr.ncr.provider');

Expand Down
2 changes: 1 addition & 1 deletion src/Command/ReindexNodesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function __construct(
parent::__construct();
}

protected function configure()
protected function configure(): void
{
$provider = $this->container->getParameter('gdbots_ncr.ncr.provider');
$searchProvider = $this->container->getParameter('gdbots_ncr.ncr_search.provider');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/SyncNodeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function __construct(
parent::__construct();
}

protected function configure()
protected function configure(): void
{
$provider = $this->container->getParameter('gdbots_ncr.ncr.provider');
$searchProvider = $this->container->getParameter('gdbots_ncr.ncr_search.provider');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/SyncNodesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function __construct(
parent::__construct();
}

protected function configure()
protected function configure(): void
{
$provider = $this->container->getParameter('gdbots_ncr.ncr.provider');
$searchProvider = $this->container->getParameter('gdbots_ncr.ncr_search.provider');
Expand Down
2 changes: 1 addition & 1 deletion src/DependencyInjection/Compiler/ValidateNcrPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
final class ValidateNcrPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
public function process(ContainerBuilder $container): void
{
if (!$container->hasParameter('gdbots_ncr.ncr.provider')) {
return;
Expand Down
2 changes: 1 addition & 1 deletion src/DependencyInjection/Compiler/ValidateNcrSearchPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/
final class ValidateNcrSearchPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
public function process(ContainerBuilder $container): void
{
if (!$container->hasParameter('gdbots_ncr.ncr_search.provider')) {
return;
Expand Down
38 changes: 19 additions & 19 deletions src/DependencyInjection/GdbotsNcrExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@

final class GdbotsNcrExtension extends Extension
{
public function load(array $config, ContainerBuilder $container)
public function load(array $configs, ContainerBuilder $container): void
{
$processor = new Processor();
$configuration = new Configuration();

$config = $processor->processConfiguration($configuration, $config);
$configs = $processor->processConfiguration($configuration, $configs);
$loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../../config'));
$loader->load('ncr.xml');
$loader->load('ncr_cache.xml');
Expand All @@ -31,33 +31,33 @@ public function load(array $config, ContainerBuilder $container)
$loader->load('twig.xml');

// ncr
$container->setParameter('gdbots_ncr.ncr.provider', $config['ncr']['provider']);
if ($config['ncr']['memoizing']['enabled']) {
$container->setParameter('gdbots_ncr.ncr.memoizing.read_through', $config['ncr']['memoizing']['read_through']);
$container->setParameter('gdbots_ncr.ncr.provider', $configs['ncr']['provider']);
if ($configs['ncr']['memoizing']['enabled']) {
$container->setParameter('gdbots_ncr.ncr.memoizing.read_through', $configs['ncr']['memoizing']['read_through']);
} else {
$container->removeDefinition('gdbots_ncr.ncr.memoizing');
}
$this->configurePsr6Ncr($config, $container);
$this->configureDynamoDbNcr($config, $container, $config['ncr']['provider']);
$this->configurePsr6Ncr($configs, $container);
$this->configureDynamoDbNcr($configs, $container, $configs['ncr']['provider']);

// ncr_cache
$container->setParameter('gdbots_ncr.ncr_cache.max_items', $config['ncr_cache']['max_items']);
$container->setParameter('gdbots_ncr.ncr_cache.max_items', $configs['ncr_cache']['max_items']);
$container->setAlias(NcrCache::class, 'ncr_cache');
$container->setAlias(NcrLazyLoader::class, 'ncr_lazy_loader');
$container->setAlias(NcrPreloader::class, 'ncr_preloader');

// ncr_search
$container->setParameter('gdbots_ncr.ncr_search.provider', $config['ncr_search']['provider']);
$this->configureElasticaNcrSearch($config, $container, $config['ncr_search']['provider']);
$container->setParameter('gdbots_ncr.ncr_search.provider', $configs['ncr_search']['provider']);
$this->configureElasticaNcrSearch($configs, $container, $configs['ncr_search']['provider']);

// node_idempotency_validator
$container->setParameter('gdbots_ncr.node_idempotency_validator.ttl', $config['node_idempotency_validator']['ttl']);
$container->setParameter('gdbots_ncr.node_idempotency_validator.ttl', $configs['node_idempotency_validator']['ttl']);
}

protected function configurePsr6Ncr(array $config, ContainerBuilder $container): void
protected function configurePsr6Ncr(array $configs, ContainerBuilder $container): void
{
$service = 'gdbots_ncr.ncr.psr6';
$psr6 = $config['ncr']['psr6'];
$psr6 = $configs['ncr']['psr6'];

if (!$psr6['enabled']) {
$container->removeDefinition($service);
Expand All @@ -72,17 +72,17 @@ protected function configurePsr6Ncr(array $config, ContainerBuilder $container):
}
}

protected function configureDynamoDbNcr(array $config, ContainerBuilder $container, ?string $provider): void
protected function configureDynamoDbNcr(array $configs, ContainerBuilder $container, ?string $provider): void
{
$service = 'gdbots_ncr.ncr.dynamodb';

if (!isset($config['ncr']['dynamodb']) || 'dynamodb' !== $provider) {
if (!isset($configs['ncr']['dynamodb']) || 'dynamodb' !== $provider) {
$container->removeDefinition($service);
$container->removeDefinition("{$service}.table_manager");
return;
}

$dynamodb = $config['ncr']['dynamodb'];
$dynamodb = $configs['ncr']['dynamodb'];
$container->setParameter("{$service}.class", $dynamodb['class']);
$container->setParameter("{$service}.table_manager.class", $dynamodb['table_manager']['class']);
$container->setParameter("{$service}.table_manager.table_name_prefix", $dynamodb['table_manager']['table_name_prefix']);
Expand All @@ -96,18 +96,18 @@ protected function configureDynamoDbNcr(array $config, ContainerBuilder $contain
$container->setAlias(Ncr::class, 'ncr');
}

protected function configureElasticaNcrSearch(array $config, ContainerBuilder $container, ?string $provider): void
protected function configureElasticaNcrSearch(array $configs, ContainerBuilder $container, ?string $provider): void
{
$service = 'gdbots_ncr.ncr_search.elastica';

if (!isset($config['ncr_search']['elastica']) || 'elastica' !== $provider) {
if (!isset($configs['ncr_search']['elastica']) || 'elastica' !== $provider) {
$container->removeDefinition($service);
$container->removeDefinition("{$service}.client_manager");
$container->removeDefinition("{$service}.index_manager");
return;
}

$elastica = $config['ncr_search']['elastica'];
$elastica = $configs['ncr_search']['elastica'];
$container->setParameter("{$service}.class", $elastica['class']);
$container->setParameter("{$service}.index_manager.class", $elastica['index_manager']['class']);
$container->setParameter("{$service}.index_manager.index_prefix", $elastica['index_manager']['index_prefix']);
Expand Down
2 changes: 1 addition & 1 deletion src/GdbotsNcrBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public function getPath(): string
return \dirname(__DIR__);
}

public function build(ContainerBuilder $container)
public function build(ContainerBuilder $container): void
{
parent::build($container);
$container->addCompilerPass(new ValidateNcrPass());
Expand Down

0 comments on commit 81ca7b2

Please sign in to comment.