Skip to content

Commit

Permalink
Remove calls to deprecated method where possible
Browse files Browse the repository at this point in the history
  • Loading branch information
alcaeus committed Jun 12, 2019
1 parent 5720cde commit c10424a
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions Command/LoadDataFixturesDoctrineCommand.php
Expand Up @@ -85,9 +85,15 @@ protected function execute(InputInterface $input, OutputInterface $output)
{
$ui = new SymfonyStyle($input, $output);

/** @var ManagerRegistry $doctrine */
$doctrine = $this->getContainer()->get('doctrine');
$em = $doctrine->getManager($input->getOption('em'));
// @todo The method_exists call can be removed once the DoctrineBundle dependency has been bumped to at least 1.10
if (method_exists($this, 'getDotrine')) {
$doctrine = $this->getDoctrine();
} else {
/** @var ManagerRegistry $doctrine */
$doctrine = $this->getContainer()->get('doctrine');
}

$em = $doctrine->getManager($input->getOption('em'));

if (! $input->getOption('append')) {
if (! $ui->confirm(sprintf('Careful, database "%s" will be purged. Do you want to continue?', $em->getConnection()->getDatabase()), ! $input->isInteractive())) {
Expand Down

0 comments on commit c10424a

Please sign in to comment.