diff --git a/Classes/Command/MigrationsCommandController.php b/Classes/Command/MigrationsCommandController.php index 7cbef12..34a6887 100644 --- a/Classes/Command/MigrationsCommandController.php +++ b/Classes/Command/MigrationsCommandController.php @@ -3,16 +3,15 @@ namespace Netlogix\Migrations\Command; -use Doctrine\Common\Persistence\ObjectManager as DoctrineObjectManager; use Doctrine\DBAL\Connection; -use Doctrine\ORM\EntityManager as DoctrineEntityManager; +use Doctrine\ORM\EntityManagerInterface; +use Neos\Flow\Annotations as Flow; use Neos\Flow\Cli\CommandController; use Neos\Flow\Log\ThrowableStorageInterface; use Neos\Flow\Log\Utility\LogEnvironment; use Netlogix\Migrations\Domain\Service\MigrationExecutor; use Netlogix\Migrations\Domain\Service\MigrationService; use Psr\Log\LoggerInterface; -use Neos\Flow\Annotations as Flow; use RuntimeException; /** @@ -41,16 +40,16 @@ class MigrationsCommandController extends CommandController private $logger; /** - * @var DoctrineObjectManager + * @var EntityManagerInterface */ - private $doctrineObjectManager; + protected $entityManager; public function __construct( MigrationService $migrationService, MigrationExecutor $migrationExecutor, ThrowableStorageInterface $throwableStorage, LoggerInterface $logger, - DoctrineObjectManager $doctrineObjectManager + EntityManagerInterface $entityManager ) { parent::__construct(); @@ -58,7 +57,8 @@ public function __construct( $this->migrationExecutor = $migrationExecutor; $this->throwableStorage = $throwableStorage; $this->logger = $logger; - $this->doctrineObjectManager = $doctrineObjectManager; + $this->entityManager = $entityManager; + } /** @@ -83,7 +83,7 @@ public function migrateCommand(bool $quiet = false) if (false === $quiet) { $this->outputLine('Executed Migration "' . $version . '".'); } - } catch (\Exception $exception) { + } catch (\Exception $exception) { $this->handleException($exception); } } @@ -120,10 +120,10 @@ protected function handleException(\Exception $exception) protected function increaseDatabaseTimeout($timeout = 3600): void { ini_set('default_socket_timeout', (string)$timeout); - if (!$this->doctrineObjectManager instanceof DoctrineEntityManager) { + if (!$this->entityManager instanceof EntityManagerInterface) { throw new RuntimeException('No Doctrine EntityManager found, cannot increase MySQL timeout'); } - $connection = $this->doctrineObjectManager->getConnection(); + $connection = $this->entityManager->getConnection(); if (!$connection || !$connection instanceof Connection) { throw new RuntimeException('No Doctrine Connection found, cannot increase MySQL timeout'); } diff --git a/Classes/Domain/Service/FileSystemMigrationsResolver.php b/Classes/Domain/Service/FileSystemMigrationsResolver.php index ec2365d..957f4d9 100644 --- a/Classes/Domain/Service/FileSystemMigrationsResolver.php +++ b/Classes/Domain/Service/FileSystemMigrationsResolver.php @@ -36,7 +36,7 @@ public function findMigrationFiles(): array { $classNames = []; /** @var PackageInterface[] $packages */ - $packages = $this->packageManager->getFilteredPackages('available', 'Application'); + $packages = $this->packageManager->getFilteredPackages('available'); foreach ($packages as $package) { $path = Files::concatenatePaths([ diff --git a/composer.json b/composer.json index 18d3c69..2a89c61 100644 --- a/composer.json +++ b/composer.json @@ -6,7 +6,7 @@ "type": "neos-package", "require": { "php": "^7.2", - "neos/flow": "^5.0" + "neos/flow": "^5.0 || ^6.0" }, "autoload": { "psr-4": {