StopDoctrineLoadCliPostEventListener::attach()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
/**
3
 * @link     https://github.com/nnx-framework/zf2-test-toolkit
4
 * @author  Malofeykin Andrey  <[email protected]>
5
 */
6
namespace Nnx\ZF2TestToolkit\Listener;
7
8
use Zend\EventManager\AbstractListenerAggregate;
9
use Zend\EventManager\EventInterface;
10
use Zend\EventManager\EventManagerInterface;
11
12
/**
13
 * Class StopDoctrineLoadCliPostEventListener
14
 *
15
 * @package Nnx\ZF2TestToolkit\Listener
16
 */
17
class StopDoctrineLoadCliPostEventListener extends AbstractListenerAggregate
18
{
19
    /**
20
     * Подписываемся на событие инициализирующее работу с консолью doctrine
21
     *
22
     * @param EventManagerInterface $events
23
     */
24
    public function attach(EventManagerInterface $events)
25
    {
26
        $events->getSharedManager()->attach('doctrine', 'loadCli.post', [$this, 'onDoctrineLoadCliPost'], 100);
27
    }
28
29
    /**
30
     * Останавливаем обработку событий
31
     *
32
     * @param EventInterface $event
33
     */
34
    public function onDoctrineLoadCliPost(EventInterface $event)
35
    {
36
        $event->stopPropagation(true);
37
    }
38
}
39