mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-05 20:57:12 +00:00
Resolve addcommand method based on existance to support both 6.4 and 8 of Symfony
This commit is contained in:
parent
451d58bb07
commit
7a93349169
1 changed files with 13 additions and 2 deletions
|
|
@ -70,7 +70,7 @@ final class InstallerContext implements Context
|
||||||
public function iRunSyliusCommandLineInstaller(): void
|
public function iRunSyliusCommandLineInstaller(): void
|
||||||
{
|
{
|
||||||
$this->application = new Application($this->kernel);
|
$this->application = new Application($this->kernel);
|
||||||
$this->application->addCommand(new SetupCommand(
|
$this->addCommandHelper(new SetupCommand(
|
||||||
$this->entityManager,
|
$this->entityManager,
|
||||||
$this->commandDirectoryChecker,
|
$this->commandDirectoryChecker,
|
||||||
$this->currencySetup,
|
$this->currencySetup,
|
||||||
|
|
@ -91,7 +91,7 @@ final class InstallerContext implements Context
|
||||||
public function iRunSyliusInstallSampleDataCommand(): void
|
public function iRunSyliusInstallSampleDataCommand(): void
|
||||||
{
|
{
|
||||||
$this->application = new Application($this->kernel);
|
$this->application = new Application($this->kernel);
|
||||||
$this->application->addCommand(new InstallSampleDataCommand(
|
$this->addCommandHelper(new InstallSampleDataCommand(
|
||||||
$this->entityManager,
|
$this->entityManager,
|
||||||
$this->commandDirectoryChecker,
|
$this->commandDirectoryChecker,
|
||||||
$this->publicDir,
|
$this->publicDir,
|
||||||
|
|
@ -158,4 +158,15 @@ final class InstallerContext implements Context
|
||||||
} catch (\Exception) {
|
} catch (\Exception) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function addCommandHelper(Command $command): void
|
||||||
|
{
|
||||||
|
if (method_exists($this->application, 'addCommand')) {
|
||||||
|
$this->application->addCommand($command);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->application->add($command);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue