Skip to content

Fix autowiring type deprec & use ConsoleEvents::ERROR #570

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 30, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/AppBundle/Command/AddUserCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\Question;
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoder;
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;

/**
* A command console that creates users and stores them in the database.
Expand Down Expand Up @@ -47,7 +47,7 @@ class AddUserCommand extends Command
private $entityManager;
private $passwordEncoder;

public function __construct(EntityManagerInterface $em, UserPasswordEncoder $encoder)
public function __construct(EntityManagerInterface $em, UserPasswordEncoderInterface $encoder)
{
parent::__construct();

Expand Down
20 changes: 10 additions & 10 deletions src/AppBundle/EventListener/CheckRequirementsSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
namespace AppBundle\EventListener;

use Doctrine\DBAL\Exception\DriverException;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Console\ConsoleEvents;
use Symfony\Component\Console\Event\ConsoleExceptionEvent;
use Symfony\Component\Console\Event\ConsoleErrorEvent;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
Expand All @@ -30,13 +30,13 @@
*/
class CheckRequirementsSubscriber implements EventSubscriberInterface
{
/** @var EntityManager */
/** @var EntityManagerInterface */
private $entityManager;

/**
* @param EntityManager $entityManager
* @param EntityManagerInterface $entityManager
*/
public function __construct(EntityManager $entityManager)
public function __construct(EntityManagerInterface $entityManager)
{
$this->entityManager = $entityManager;
}
Expand All @@ -48,22 +48,22 @@ public function __construct(EntityManager $entityManager)
public static function getSubscribedEvents()
{
return [
// Exceptions are one of the events defined by the Console. See the
// Errors are one of the events defined by the Console. See the
// rest here: https://symfony.com/doc/current/components/console/events.html
ConsoleEvents::EXCEPTION => 'handleConsoleException',
ConsoleEvents::ERROR => 'handleConsoleError',
// See: http://api.symfony.com/master/Symfony/Component/HttpKernel/KernelEvents.html
KernelEvents::EXCEPTION => 'handleKernelException',
];
}

/**
* This method checks if there has been an exception in a command related to
* This method checks if there has been an error in a command related to
* the database and then, it checks if the 'sqlite3' PHP extension is enabled
* or not to display a better error message.
*
* @param ConsoleExceptionEvent $event
* @param ConsoleErrorEvent $event
*/
public function handleConsoleException(ConsoleExceptionEvent $event)
public function handleConsoleError(ConsoleErrorEvent $event)
{
$commandNames = ['doctrine:fixtures:load', 'doctrine:database:create', 'doctrine:schema:create', 'doctrine:database:drop'];

Expand Down