1 | <?php |
||
17 | class UpdateLastActionFieldListener implements EventSubscriberInterface |
||
18 | { |
||
19 | /** |
||
20 | * @var ObjectManager |
||
21 | */ |
||
22 | private $om; |
||
23 | |||
24 | /** |
||
25 | * @var ClassMetadata |
||
26 | */ |
||
27 | private $classMetadata; |
||
28 | |||
29 | /** |
||
30 | * @var RequestStack |
||
31 | */ |
||
32 | private $requestStack; |
||
33 | |||
34 | /** |
||
35 | * Constructor. |
||
36 | * |
||
37 | * @param ObjectManager $om |
||
38 | * @param ClassMetadata $metadata |
||
39 | * @param RequestStack $requestStack |
||
40 | */ |
||
41 | 10 | public function __construct(ObjectManager $om, ClassMetadata $metadata, RequestStack $requestStack) |
|
47 | |||
48 | /** |
||
49 | * {@inheritdoc} |
||
50 | */ |
||
51 | 16 | public static function getSubscribedEvents() |
|
52 | { |
||
53 | return array( |
||
54 | 16 | Ma27ApiKeyAuthenticationEvents::AUTHENTICATION => array('onAuthentication', -20), // late event since custom listeners should be triggered earlier |
|
55 | Ma27ApiKeyAuthenticationEvents::FIREWALL_LOGIN => 'onFirewallLogin', |
||
56 | ); |
||
57 | } |
||
58 | |||
59 | /** |
||
60 | * Modifies the last action property on authentication. |
||
61 | * |
||
62 | * @param OnAuthenticationEvent $event |
||
63 | */ |
||
64 | 9 | public function onAuthentication(OnAuthenticationEvent $event) |
|
68 | |||
69 | /** |
||
70 | * Modifies the last action property on firewall authentication. |
||
71 | * |
||
72 | * @param OnFirewallAuthenticationEvent $event |
||
73 | */ |
||
74 | 7 | public function onFirewallLogin(OnFirewallAuthenticationEvent $event) |
|
81 | |||
82 | /** |
||
83 | * Modifies the last action property of a user object. |
||
84 | * |
||
85 | * @param AbstractUserEvent $event |
||
86 | */ |
||
87 | 10 | private function doModify(AbstractUserEvent $event) |
|
95 | } |
||
96 |