Skip to content

Commit

Permalink
Add migrations prepend to plugin extension class
Browse files Browse the repository at this point in the history
  • Loading branch information
marekrzytki committed Jun 3, 2024
1 parent 5f8bb4a commit 230c50a
Showing 1 changed file with 34 additions and 1 deletion.
35 changes: 34 additions & 1 deletion src/DependencyInjection/BitBagSyliusMailTemplateExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\Extension;
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;

final class BitBagSyliusMailTemplateExtension extends Extension
final class BitBagSyliusMailTemplateExtension extends Extension implements PrependExtensionInterface
{
public const ALLOWED_FILTERS_PARAMETER = 'bitbag_sylius_mail_template_plugin.mail_template.twig.allowed_filters';

Expand Down Expand Up @@ -71,4 +72,36 @@ public function getConfiguration(array $config, ContainerBuilder $container): Co
{
return new Configuration();
}

public function prepend(ContainerBuilder $container)

Check failure on line 76 in src/DependencyInjection/BitBagSyliusMailTemplateExtension.php

View workflow job for this annotation

GitHub Actions / Sylius ~1.13.0, PHP 8.2, Symfony ^5.4, MySQL 8.0

Method BitBag\SyliusMailTemplatePlugin\DependencyInjection\BitBagSyliusMailTemplateExtension::prepend() has no return type specified.

Check failure on line 76 in src/DependencyInjection/BitBagSyliusMailTemplateExtension.php

View workflow job for this annotation

GitHub Actions / Sylius ~1.13.0, PHP 8.1, Symfony ^5.4, MySQL 8.0

Method BitBag\SyliusMailTemplatePlugin\DependencyInjection\BitBagSyliusMailTemplateExtension::prepend() has no return type specified.

Check failure on line 76 in src/DependencyInjection/BitBagSyliusMailTemplateExtension.php

View workflow job for this annotation

GitHub Actions / Sylius ~1.13.0, PHP 8.1, Symfony ^5.4, MySQL 8.0

Method BitBag\SyliusMailTemplatePlugin\DependencyInjection\BitBagSyliusMailTemplateExtension::prepend() has no return type specified.

Check failure on line 76 in src/DependencyInjection/BitBagSyliusMailTemplateExtension.php

View workflow job for this annotation

GitHub Actions / Sylius ~1.12.0, PHP 8.2, Symfony ^5.4, MySQL 8.0

Method BitBag\SyliusMailTemplatePlugin\DependencyInjection\BitBagSyliusMailTemplateExtension::prepend() has no return type specified.

Check failure on line 76 in src/DependencyInjection/BitBagSyliusMailTemplateExtension.php

View workflow job for this annotation

GitHub Actions / Sylius ~1.12.0, PHP 8.1, Symfony ^5.4, MySQL 8.0

Method BitBag\SyliusMailTemplatePlugin\DependencyInjection\BitBagSyliusMailTemplateExtension::prepend() has no return type specified.

Check failure on line 76 in src/DependencyInjection/BitBagSyliusMailTemplateExtension.php

View workflow job for this annotation

GitHub Actions / Sylius ~1.13.0, PHP 8.2, Symfony ^5.4, MySQL 8.0

Method BitBag\SyliusMailTemplatePlugin\DependencyInjection\BitBagSyliusMailTemplateExtension::prepend() has no return type specified.

Check failure on line 76 in src/DependencyInjection/BitBagSyliusMailTemplateExtension.php

View workflow job for this annotation

GitHub Actions / Sylius ~1.12.0, PHP 8.2, Symfony ^5.4, MySQL 8.0

Method BitBag\SyliusMailTemplatePlugin\DependencyInjection\BitBagSyliusMailTemplateExtension::prepend() has no return type specified.

Check failure on line 76 in src/DependencyInjection/BitBagSyliusMailTemplateExtension.php

View workflow job for this annotation

GitHub Actions / Sylius ~1.13.0, PHP 8.1, Symfony ^5.4, MySQL 8.0

Method BitBag\SyliusMailTemplatePlugin\DependencyInjection\BitBagSyliusMailTemplateExtension::prepend() has no return type specified.

Check failure on line 76 in src/DependencyInjection/BitBagSyliusMailTemplateExtension.php

View workflow job for this annotation

GitHub Actions / Sylius ~1.13.0, PHP 8.1, Symfony ^5.4, MySQL 8.0

Method BitBag\SyliusMailTemplatePlugin\DependencyInjection\BitBagSyliusMailTemplateExtension::prepend() has no return type specified.

Check failure on line 76 in src/DependencyInjection/BitBagSyliusMailTemplateExtension.php

View workflow job for this annotation

GitHub Actions / Sylius ~1.13.0, PHP 8.2, Symfony ^5.4, MySQL 8.0

Method BitBag\SyliusMailTemplatePlugin\DependencyInjection\BitBagSyliusMailTemplateExtension::prepend() has no return type specified.

Check failure on line 76 in src/DependencyInjection/BitBagSyliusMailTemplateExtension.php

View workflow job for this annotation

GitHub Actions / Sylius ~1.13.0, PHP 8.2, Symfony ^5.4, MySQL 8.0

Method BitBag\SyliusMailTemplatePlugin\DependencyInjection\BitBagSyliusMailTemplateExtension::prepend() has no return type specified.

Check failure on line 76 in src/DependencyInjection/BitBagSyliusMailTemplateExtension.php

View workflow job for this annotation

GitHub Actions / Sylius ~1.12.0, PHP 8.1, Symfony ^5.4, MySQL 8.0

Method BitBag\SyliusMailTemplatePlugin\DependencyInjection\BitBagSyliusMailTemplateExtension::prepend() has no return type specified.
{
if (!$container->hasExtension('doctrine_migrations') || !$container->hasExtension('sylius_labs_doctrine_migrations_extra')) {
return;
}

if (
$container->hasParameter('sylius_core.prepend_doctrine_migrations') &&
false === $container->getParameter('sylius_core.prepend_doctrine_migrations')
) {
return;
}

/** @var array<int|string, mixed> $doctrineConfig */
$doctrineConfig = $container->getExtensionConfig('doctrine_migrations');
$migrationsPath = (array) \array_pop($doctrineConfig)['migrations_paths'];
$container->prependExtensionConfig('doctrine_migrations', [
'migrations_paths' => \array_merge(
$migrationsPath,
[
'BitBag\MailTemplatePlugin\Migrations' => '@BitBagSyliusMailTemplatePlugin/Migrations',
],
),
]);

$container->prependExtensionConfig('sylius_labs_doctrine_migrations_extra', [
'migrations' => [
'BitBag\MailTemplatePlugin\Migrations' => ['Sylius\Bundle\CoreBundle\Migrations'],
],
]);
}
}

0 comments on commit 230c50a

Please sign in to comment.