diff options
author | ArthurHoaro <arthur@hoa.ro> | 2020-01-18 10:01:06 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-18 10:01:06 +0100 |
commit | 3fb29fdda04ca86e04422d49b86cf646d53c4f9d (patch) | |
tree | adf8512f93f5559ba87d0c9931969ae4ebea7133 /application/History.php | |
parent | 796c4c57d085ae4589b53dfe8369ae9ba30ffdaf (diff) | |
parent | e26e2060f5470ce8bf4c5973284bae07b8af170a (diff) | |
download | Shaarli-3fb29fdda04ca86e04422d49b86cf646d53c4f9d.tar.gz Shaarli-3fb29fdda04ca86e04422d49b86cf646d53c4f9d.tar.zst Shaarli-3fb29fdda04ca86e04422d49b86cf646d53c4f9d.zip |
Store bookmarks as PHP objects and add a service layer to retriā¦ (#1307)
Store bookmarks as PHP objects and add a service layer to retrieve them
Diffstat (limited to 'application/History.php')
-rw-r--r-- | application/History.php | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/application/History.php b/application/History.php index a5846652..4fd2f294 100644 --- a/application/History.php +++ b/application/History.php | |||
@@ -3,6 +3,7 @@ namespace Shaarli; | |||
3 | 3 | ||
4 | use DateTime; | 4 | use DateTime; |
5 | use Exception; | 5 | use Exception; |
6 | use Shaarli\Bookmark\Bookmark; | ||
6 | 7 | ||
7 | /** | 8 | /** |
8 | * Class History | 9 | * Class History |
@@ -20,7 +21,7 @@ use Exception; | |||
20 | * - UPDATED: link updated | 21 | * - UPDATED: link updated |
21 | * - DELETED: link deleted | 22 | * - DELETED: link deleted |
22 | * - SETTINGS: the settings have been updated through the UI. | 23 | * - SETTINGS: the settings have been updated through the UI. |
23 | * - IMPORT: bulk links import | 24 | * - IMPORT: bulk bookmarks import |
24 | * | 25 | * |
25 | * Note: new events are put at the beginning of the file and history array. | 26 | * Note: new events are put at the beginning of the file and history array. |
26 | */ | 27 | */ |
@@ -96,31 +97,31 @@ class History | |||
96 | /** | 97 | /** |
97 | * Add Event: new link. | 98 | * Add Event: new link. |
98 | * | 99 | * |
99 | * @param array $link Link data. | 100 | * @param Bookmark $link Link data. |
100 | */ | 101 | */ |
101 | public function addLink($link) | 102 | public function addLink($link) |
102 | { | 103 | { |
103 | $this->addEvent(self::CREATED, $link['id']); | 104 | $this->addEvent(self::CREATED, $link->getId()); |
104 | } | 105 | } |
105 | 106 | ||
106 | /** | 107 | /** |
107 | * Add Event: update existing link. | 108 | * Add Event: update existing link. |
108 | * | 109 | * |
109 | * @param array $link Link data. | 110 | * @param Bookmark $link Link data. |
110 | */ | 111 | */ |
111 | public function updateLink($link) | 112 | public function updateLink($link) |
112 | { | 113 | { |
113 | $this->addEvent(self::UPDATED, $link['id']); | 114 | $this->addEvent(self::UPDATED, $link->getId()); |
114 | } | 115 | } |
115 | 116 | ||
116 | /** | 117 | /** |
117 | * Add Event: delete existing link. | 118 | * Add Event: delete existing link. |
118 | * | 119 | * |
119 | * @param array $link Link data. | 120 | * @param Bookmark $link Link data. |
120 | */ | 121 | */ |
121 | public function deleteLink($link) | 122 | public function deleteLink($link) |
122 | { | 123 | { |
123 | $this->addEvent(self::DELETED, $link['id']); | 124 | $this->addEvent(self::DELETED, $link->getId()); |
124 | } | 125 | } |
125 | 126 | ||
126 | /** | 127 | /** |
@@ -134,7 +135,7 @@ class History | |||
134 | /** | 135 | /** |
135 | * Add Event: bulk import. | 136 | * Add Event: bulk import. |
136 | * | 137 | * |
137 | * Note: we don't store links add/update one by one since it can have a huge impact on performances. | 138 | * Note: we don't store bookmarks add/update one by one since it can have a huge impact on performances. |
138 | */ | 139 | */ |
139 | public function importLinks() | 140 | public function importLinks() |
140 | { | 141 | { |