Passed
Push — develop ( 34195e...b04746 )
by Stone
08:36 queued 03:47
created

deleteCommentFromDatabase()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace App\EventSubscriber\Comment;
4
5
use App\Entity\Comment;
6
use App\Event\Comment\CommentDeletedEvent;
7
use App\FlashMessage\FlashMessageCategory;
8
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
9
10
class CommentDeletedSubscriber extends CommentSubscriber implements EventSubscriberInterface
11
{
12
    /**
13
     * Deletes a comment
14
     * @param CommentDeletedEvent $event
15
     */
16
    public function deleteCommentFromDatabase(CommentDeletedEvent $event)
17
    {
18
        $this->deleteFromDatabase($event);
19
        $this->addFlash(FlashMessageCategory::SUCCESS, 'Comment Deleted');
20
    }
21
22
    /**
23
     * @return array The event names to listen to
24
     */
25
    public static function getSubscribedEvents()
26
    {
27
        return [
28
            CommentDeletedEvent::NAME => 'deleteCommentFromDatabase'
29
        ];
30
    }
31
}