diff options
Diffstat (limited to 'src/Wallabag/CoreBundle/Event/Activity/Actions/Entry')
7 files changed, 157 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Event/Activity/Actions/Entry/EntryDeletedEvent.php b/src/Wallabag/CoreBundle/Event/Activity/Actions/Entry/EntryDeletedEvent.php new file mode 100644 index 00000000..1d413d41 --- /dev/null +++ b/src/Wallabag/CoreBundle/Event/Activity/Actions/Entry/EntryDeletedEvent.php | |||
@@ -0,0 +1,11 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Wallabag\CoreBundle\Event\Activity\Actions\Entry; | ||
4 | |||
5 | /** | ||
6 | * This event is fired as soon as an entry is deleted. | ||
7 | */ | ||
8 | class EntryDeletedEvent extends EntryEvent | ||
9 | { | ||
10 | const NAME = 'entry.deleted'; | ||
11 | } | ||
diff --git a/src/Wallabag/CoreBundle/Event/Activity/Actions/Entry/EntryEditedEvent.php b/src/Wallabag/CoreBundle/Event/Activity/Actions/Entry/EntryEditedEvent.php new file mode 100644 index 00000000..f7528bb4 --- /dev/null +++ b/src/Wallabag/CoreBundle/Event/Activity/Actions/Entry/EntryEditedEvent.php | |||
@@ -0,0 +1,11 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Wallabag\CoreBundle\Event\Activity\Actions\Entry; | ||
4 | |||
5 | /** | ||
6 | * This event is fired as soon as an entry was edited. | ||
7 | */ | ||
8 | class EntryEditedEvent extends EntryEvent | ||
9 | { | ||
10 | const NAME = 'entry.edited'; | ||
11 | } | ||
diff --git a/src/Wallabag/CoreBundle/Event/Activity/Actions/Entry/EntryEvent.php b/src/Wallabag/CoreBundle/Event/Activity/Actions/Entry/EntryEvent.php new file mode 100644 index 00000000..0e0c90d0 --- /dev/null +++ b/src/Wallabag/CoreBundle/Event/Activity/Actions/Entry/EntryEvent.php | |||
@@ -0,0 +1,41 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Wallabag\CoreBundle\Event\Activity\Actions\Entry; | ||
4 | |||
5 | use Symfony\Component\EventDispatcher\Event; | ||
6 | use Wallabag\CoreBundle\Entity\Entry; | ||
7 | |||
8 | /** | ||
9 | * This event is fired when entry-related stuff is made. | ||
10 | */ | ||
11 | abstract class EntryEvent extends Event | ||
12 | { | ||
13 | protected $entry; | ||
14 | |||
15 | /** | ||
16 | * EntryEvent constructor. | ||
17 | * @param Entry $entry | ||
18 | */ | ||
19 | public function __construct(Entry $entry) | ||
20 | { | ||
21 | $this->entry = $entry; | ||
22 | } | ||
23 | |||
24 | /** | ||
25 | * @return Entry | ||
26 | */ | ||
27 | public function getEntry() | ||
28 | { | ||
29 | return $this->entry; | ||
30 | } | ||
31 | |||
32 | /** | ||
33 | * @param Entry $entry | ||
34 | * @return EntryEvent | ||
35 | */ | ||
36 | public function setEntry(Entry $entry) | ||
37 | { | ||
38 | $this->entry = $entry; | ||
39 | return $this; | ||
40 | } | ||
41 | } | ||
diff --git a/src/Wallabag/CoreBundle/Event/Activity/Actions/Entry/EntryFavouriteEvent.php b/src/Wallabag/CoreBundle/Event/Activity/Actions/Entry/EntryFavouriteEvent.php new file mode 100644 index 00000000..98edb00d --- /dev/null +++ b/src/Wallabag/CoreBundle/Event/Activity/Actions/Entry/EntryFavouriteEvent.php | |||
@@ -0,0 +1,14 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Wallabag\CoreBundle\Event\Activity\Actions\Entry; | ||
4 | |||
5 | use Symfony\Component\EventDispatcher\Event; | ||
6 | use Wallabag\CoreBundle\Entity\Entry; | ||
7 | |||
8 | /** | ||
9 | * This event is fired as soon as an entry was favourited. | ||
10 | */ | ||
11 | class EntryFavouriteEvent extends EntryEvent | ||
12 | { | ||
13 | const NAME = 'entry.favourite'; | ||
14 | } | ||
diff --git a/src/Wallabag/CoreBundle/Event/Activity/Actions/Entry/EntryReadEvent.php b/src/Wallabag/CoreBundle/Event/Activity/Actions/Entry/EntryReadEvent.php new file mode 100644 index 00000000..be6e6b40 --- /dev/null +++ b/src/Wallabag/CoreBundle/Event/Activity/Actions/Entry/EntryReadEvent.php | |||
@@ -0,0 +1,14 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Wallabag\CoreBundle\Event\Activity\Actions\Entry; | ||
4 | |||
5 | use Symfony\Component\EventDispatcher\Event; | ||
6 | use Wallabag\CoreBundle\Entity\Entry; | ||
7 | |||
8 | /** | ||
9 | * This event is fired as soon as an entry was favourited. | ||
10 | */ | ||
11 | class EntryReadEvent extends EntryEvent | ||
12 | { | ||
13 | const NAME = 'entry.read'; | ||
14 | } | ||
diff --git a/src/Wallabag/CoreBundle/Event/Activity/Actions/Entry/EntrySavedEvent.php b/src/Wallabag/CoreBundle/Event/Activity/Actions/Entry/EntrySavedEvent.php new file mode 100644 index 00000000..20c623c5 --- /dev/null +++ b/src/Wallabag/CoreBundle/Event/Activity/Actions/Entry/EntrySavedEvent.php | |||
@@ -0,0 +1,11 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Wallabag\CoreBundle\Event\Activity\Actions\Entry; | ||
4 | |||
5 | /** | ||
6 | * This event is fired as soon as an entry was saved. | ||
7 | */ | ||
8 | class EntrySavedEvent extends EntryEvent | ||
9 | { | ||
10 | const NAME = 'entry.saved'; | ||
11 | } | ||
diff --git a/src/Wallabag/CoreBundle/Event/Activity/Actions/Entry/EntryTaggedEvent.php b/src/Wallabag/CoreBundle/Event/Activity/Actions/Entry/EntryTaggedEvent.php new file mode 100644 index 00000000..1ea8a7f1 --- /dev/null +++ b/src/Wallabag/CoreBundle/Event/Activity/Actions/Entry/EntryTaggedEvent.php | |||
@@ -0,0 +1,55 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Wallabag\CoreBundle\Event\Activity\Actions\Entry; | ||
4 | |||
5 | use Wallabag\CoreBundle\Entity\Entry; | ||
6 | use Wallabag\CoreBundle\Entity\Tag; | ||
7 | |||
8 | /** | ||
9 | * This event is fired as soon as a tag is added on an entry. | ||
10 | */ | ||
11 | class EntryTaggedEvent extends EntryEvent | ||
12 | { | ||
13 | const NAME = 'entry.tagged'; | ||
14 | |||
15 | /** @var Tag[] */ | ||
16 | protected $tags; | ||
17 | |||
18 | /** | ||
19 | * @var boolean | ||
20 | */ | ||
21 | protected $remove; | ||
22 | |||
23 | /** | ||
24 | * EntryTaggedEvent constructor. | ||
25 | * @param Entry $entry | ||
26 | * @param $tags | ||
27 | * @param bool $remove | ||
28 | */ | ||
29 | public function __construct(Entry $entry, $tags, $remove = false) | ||
30 | { | ||
31 | parent::__construct($entry); | ||
32 | |||
33 | if (false === is_array($tags)) { | ||
34 | $tags = [$tags]; | ||
35 | } | ||
36 | |||
37 | $this->tags = $tags; | ||
38 | } | ||
39 | |||
40 | /** | ||
41 | * @return Tag[] | ||
42 | */ | ||
43 | public function getTags() | ||
44 | { | ||
45 | return $this->tags; | ||
46 | } | ||
47 | |||
48 | /** | ||
49 | * @return bool | ||
50 | */ | ||
51 | public function isRemove() | ||
52 | { | ||
53 | return $this->remove; | ||
54 | } | ||
55 | } | ||