12
12
namespace AppBundle \EventListener ;
13
13
14
14
use Doctrine \DBAL \Exception \DriverException ;
15
- use Doctrine \ORM \EntityManager ;
15
+ use Doctrine \ORM \EntityManagerInterface ;
16
16
use Symfony \Component \Console \ConsoleEvents ;
17
- use Symfony \Component \Console \Event \ConsoleExceptionEvent ;
17
+ use Symfony \Component \Console \Event \ConsoleErrorEvent ;
18
18
use Symfony \Component \Console \Style \SymfonyStyle ;
19
19
use Symfony \Component \EventDispatcher \EventSubscriberInterface ;
20
20
use Symfony \Component \HttpKernel \Event \GetResponseForExceptionEvent ;
30
30
*/
31
31
class CheckRequirementsSubscriber implements EventSubscriberInterface
32
32
{
33
- /** @var EntityManager */
33
+ /** @var EntityManagerInterface */
34
34
private $ entityManager ;
35
35
36
36
/**
37
- * @param EntityManager $entityManager
37
+ * @param EntityManagerInterface $entityManager
38
38
*/
39
- public function __construct (EntityManager $ entityManager )
39
+ public function __construct (EntityManagerInterface $ entityManager )
40
40
{
41
41
$ this ->entityManager = $ entityManager ;
42
42
}
@@ -48,22 +48,22 @@ public function __construct(EntityManager $entityManager)
48
48
public static function getSubscribedEvents ()
49
49
{
50
50
return [
51
- // Exceptions are one of the events defined by the Console. See the
51
+ // Errors are one of the events defined by the Console. See the
52
52
// rest here: https://symfony.com/doc/current/components/console/events.html
53
- ConsoleEvents::EXCEPTION => 'handleConsoleException ' ,
53
+ ConsoleEvents::ERROR => 'handleConsoleError ' ,
54
54
// See: http://api.symfony.com/master/Symfony/Component/HttpKernel/KernelEvents.html
55
55
KernelEvents::EXCEPTION => 'handleKernelException ' ,
56
56
];
57
57
}
58
58
59
59
/**
60
- * This method checks if there has been an exception in a command related to
60
+ * This method checks if there has been an error in a command related to
61
61
* the database and then, it checks if the 'sqlite3' PHP extension is enabled
62
62
* or not to display a better error message.
63
63
*
64
- * @param ConsoleExceptionEvent $event
64
+ * @param ConsoleErrorEvent $event
65
65
*/
66
- public function handleConsoleException ( ConsoleExceptionEvent $ event )
66
+ public function handleConsoleError ( ConsoleErrorEvent $ event )
67
67
{
68
68
$ commandNames = ['doctrine:fixtures:load ' , 'doctrine:database:create ' , 'doctrine:schema:create ' , 'doctrine:database:drop ' ];
69
69
0 commit comments