Skip to content

Commit

Permalink
Extension: Register magic command only in case of Baraja PackageManag…
Browse files Browse the repository at this point in the history
…er Console does not exist.
  • Loading branch information
janbarasek authored Sep 11, 2019
1 parent 09448fa commit b69729b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/DatabaseExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Baraja\Doctrine;


use Baraja\PackageManager\Console;
use Doctrine\Common\Cache\ApcuCache;
use Doctrine\Common\Cache\SQLite3Cache;
use Nette\DI\CompilerExtension;
Expand Down Expand Up @@ -37,7 +38,7 @@ public function afterCompile(ClassType $class): void
. '$entityManager->getConfiguration()->addCustomNumericFunction(\'rand\', ' . Rand::class . '::class);' . "\n"
. '$entityManager->buildCache();' . "\n"
. $initialize->getBody()
. (PHP_SAPI === 'cli' ? "\n"
. (PHP_SAPI === 'cli' && class_exists(Console::class) === false ? "\n"
. OrmSchemaUpdateTool::class . '::setContainer($this);' . "\n"
. 'register_shutdown_function([' . OrmSchemaUpdateTool::class . '::class, \'run\']);' : '')
);
Expand Down Expand Up @@ -82,4 +83,4 @@ private function processCache(): string
return 'null /* CACHE DOES NOT EXIST! */';
}

}
}

0 comments on commit b69729b

Please sign in to comment.