Skip to content

Commit

Permalink
Fix compatibility with contao-geoip2-country
Browse files Browse the repository at this point in the history
  • Loading branch information
aschempp committed Aug 27, 2024
1 parent 713910a commit 0a83984
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"symfony/security-core": "^5.0 || ^6.0 || ^7.0"
},
"require-dev": {
"terminal42/contao-geoip2-country": "^1.0",
"terminal42/contao-geoip2-country": "^1.4",
"contao/manager-plugin": "^2.0",
"terminal42/contao-build-tools": "dev-main"
},
Expand All @@ -47,7 +47,7 @@
},
"conflict": {
"contao/manager-plugin": "<2.0 || >=3.0",
"terminal42/contao-geoip2-country": ">= 2.0"
"terminal42/contao-geoip2-country": "< 1.4 || >= 2.0"
},
"autoload": {
"psr-4": {
Expand Down
4 changes: 3 additions & 1 deletion src/ContaoManager/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@
use Contao\ManagerPlugin\Bundle\Parser\ParserInterface;
use Contao\ManagerPlugin\Config\ContainerBuilder;
use Contao\ManagerPlugin\Config\ExtensionPluginInterface;
use Terminal42\Geoip2CountryBundle\Terminal42Geoip2CountryBundle;
use Terminal42\NodeBundle\Terminal42NodeBundle;

class Plugin implements BundlePluginInterface, ExtensionPluginInterface
{
public function getBundles(ParserInterface $parser): array
{
return [
BundleConfig::create(Terminal42NodeBundle::class)->setLoadAfter([ContaoCoreBundle::class, 'haste']),
BundleConfig::create(Terminal42NodeBundle::class)
->setLoadAfter([ContaoCoreBundle::class, 'haste', Terminal42Geoip2CountryBundle::class]),
];
}

Expand Down
10 changes: 3 additions & 7 deletions src/DependencyInjection/Terminal42NodeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@

use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Extension\Extension;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
use Symfony\Component\DependencyInjection\Reference;
use Terminal42\Geoip2CountryBundle\EventListener\DcaLoaderListener;
use Terminal42\Geoip2CountryBundle\DependencyInjection\Configuration;

class Terminal42NodeExtension extends Extension
{
Expand All @@ -19,10 +17,8 @@ public function load(array $configs, ContainerBuilder $container): void
$loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../../config'));
$loader->load('services.yml');

if (class_exists(DcaLoaderListener::class)) {
$definition = new Definition(DcaLoaderListener::class, [new Reference('database_connection'), new Reference('translator'), ['tl_node']]);
$definition->addTag('contao.hook', ['hook' => 'loadDataContainer']);
$container->setDefinition('terminal42_node.listener.geoip2country_dca_loader', $definition);
if (class_exists(Configuration::class)) {
Configuration::addDefaultTable('tl_node');
}
}
}

0 comments on commit 0a83984

Please sign in to comment.