aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Event/EntryTaggedEvent.php
blob: 88856fb147259add909589153ce140a1ad367406 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php

namespace Wallabag\CoreBundle\Event;

use Symfony\Component\EventDispatcher\Event;
use Wallabag\CoreBundle\Entity\Entry;
use Wallabag\CoreBundle\Entity\Tag;

/**
 * This event is fired as soon as a tag is added on an entry.
 */
class EntryTaggedEvent extends Event
{
    const NAME = 'entry.tagged';

    /** @var Entry */
    protected $entry;

    /** @var Tag[] */
    protected $tags;

    public function __construct(Entry $entry, $tags)
    {
        $this->entry = $entry;

        if (false === is_array($tags)) {
            $tags = [$tags];
        }

        $this->tags = $tags;
    }

    public function getEntry()
    {
        return $this->entry;
    }

    public function getTags()
    {
        return $this->tags;
    }
}