diff options
Diffstat (limited to 'src/Wallabag/CoreBundle/Event/EntryTaggedEvent.php')
-rw-r--r-- | src/Wallabag/CoreBundle/Event/EntryTaggedEvent.php | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Event/EntryTaggedEvent.php b/src/Wallabag/CoreBundle/Event/EntryTaggedEvent.php new file mode 100644 index 00000000..88856fb1 --- /dev/null +++ b/src/Wallabag/CoreBundle/Event/EntryTaggedEvent.php | |||
@@ -0,0 +1,42 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Wallabag\CoreBundle\Event; | ||
4 | |||
5 | use Symfony\Component\EventDispatcher\Event; | ||
6 | use Wallabag\CoreBundle\Entity\Entry; | ||
7 | use Wallabag\CoreBundle\Entity\Tag; | ||
8 | |||
9 | /** | ||
10 | * This event is fired as soon as a tag is added on an entry. | ||
11 | */ | ||
12 | class EntryTaggedEvent extends Event | ||
13 | { | ||
14 | const NAME = 'entry.tagged'; | ||
15 | |||
16 | /** @var Entry */ | ||
17 | protected $entry; | ||
18 | |||
19 | /** @var Tag[] */ | ||
20 | protected $tags; | ||
21 | |||
22 | public function __construct(Entry $entry, $tags) | ||
23 | { | ||
24 | $this->entry = $entry; | ||
25 | |||
26 | if (false === is_array($tags)) { | ||
27 | $tags = [$tags]; | ||
28 | } | ||
29 | |||
30 | $this->tags = $tags; | ||
31 | } | ||
32 | |||
33 | public function getEntry() | ||
34 | { | ||
35 | return $this->entry; | ||
36 | } | ||
37 | |||
38 | public function getTags() | ||
39 | { | ||
40 | return $this->tags; | ||
41 | } | ||
42 | } | ||