Skip to content

Commit

Permalink
FEATURE: Allow Flow 6
Browse files Browse the repository at this point in the history
  • Loading branch information
saschanowak committed Sep 9, 2020
1 parent d06b624 commit 336121a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
20 changes: 10 additions & 10 deletions Classes/Command/MigrationsCommandController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down Expand Up @@ -41,24 +40,25 @@ 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();

$this->migrationService = $migrationService;
$this->migrationExecutor = $migrationExecutor;
$this->throwableStorage = $throwableStorage;
$this->logger = $logger;
$this->doctrineObjectManager = $doctrineObjectManager;
$this->entityManager = $entityManager;

}

/**
Expand All @@ -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);
}
}
Expand Down Expand Up @@ -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');
}
Expand Down
2 changes: 1 addition & 1 deletion Classes/Domain/Service/FileSystemMigrationsResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -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([
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"type": "neos-package",
"require": {
"php": "^7.2",
"neos/flow": "^5.0"
"neos/flow": "^5.0 || ^6.0"
},
"autoload": {
"psr-4": {
Expand Down

0 comments on commit 336121a

Please sign in to comment.