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

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. /**
  9.  * @deprecated This class is not compatible with Symfony >= 7
  10.  */
  11. class ContainerAwareMigrationFactory implements MigrationFactory
  12. {
  13.     /**
  14.      * @var ContainerInterface
  15.      */
  16.     private $container;
  17.     /**
  18.      * @var MigrationFactory
  19.      */
  20.     private $migrationFactory;
  21.     public function __construct(MigrationFactory $migrationFactoryContainerInterface $container)
  22.     {
  23.         $this->container $container;
  24.         $this->migrationFactory $migrationFactory;
  25.     }
  26.     public function createVersion(string $migrationClassName): AbstractMigration
  27.     {
  28.         $migration $this->migrationFactory->createVersion($migrationClassName);
  29.         if ($migration instanceof ContainerAwareInterface) {
  30.             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);
  31.             $migration->setContainer($this->container);
  32.         }
  33.         return $migration;
  34.     }
  35. }