vendor/doctrine/doctrine-migrations-bundle/MigrationsFactory/ContainerAwareMigrationFactory.php line 29

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace Doctrine\Bundle\MigrationsBundle\MigrationsFactory;
  4. use Doctrine\Migrations\AbstractMigration;
  5. use Doctrine\Migrations\Version\MigrationFactory;
  6. use Symfony\Component\DependencyInjection\ContainerAwareInterface;
  7. use Symfony\Component\DependencyInjection\ContainerInterface;
  8. use function trigger_deprecation;
  9. /** @deprecated This class is not compatible with Symfony >= 7 */
  10. class ContainerAwareMigrationFactory implements MigrationFactory
  11. {
  12.     /** @var ContainerInterface */
  13.     private $container;
  14.     /** @var MigrationFactory */
  15.     private $migrationFactory;
  16.     public function __construct(MigrationFactory $migrationFactoryContainerInterface $container)
  17.     {
  18.         $this->container        $container;
  19.         $this->migrationFactory $migrationFactory;
  20.     }
  21.     public function createVersion(string $migrationClassName): AbstractMigration
  22.     {
  23.         $migration $this->migrationFactory->createVersion($migrationClassName);
  24.         if ($migration instanceof ContainerAwareInterface) {
  25.             trigger_deprecation('doctrine/doctrine-migrations-bundle''3.3''Migration "%s" implements "%s" to gain access to the application\'s service container. This method is deprecated and won\'t work with Symfony 7.'$migrationClassNameContainerAwareInterface::class);
  26.             $migration->setContainer($this->container);
  27.         }
  28.         return $migration;
  29.     }
  30. }