Code Duplication    Length = 7-13 lines in 19 locations

eZ/Publish/Core/Persistence/Cache/BookmarkHandler.php 1 location

@@ 35-44 (lines=10) @@
32
    /**
33
     * {@inheritdoc}
34
     */
35
    public function delete(int $bookmarkId): void
36
    {
37
        $this->logger->logCall(__METHOD__, [
38
            'id' => $bookmarkId,
39
        ]);
40
41
        $this->persistenceHandler->bookmarkHandler()->delete($bookmarkId);
42
43
        $this->cache->invalidateTags(['bookmark-' . $bookmarkId]);
44
    }
45
46
    /**
47
     * {@inheritdoc}

eZ/Publish/Core/Persistence/Cache/ContentLanguageHandler.php 2 locations

@@ 33-41 (lines=9) @@
30
    /**
31
     * {@inheritdoc}
32
     */
33
    public function update(Language $struct)
34
    {
35
        $this->logger->logCall(__METHOD__, array('struct' => $struct));
36
        $return = $this->persistenceHandler->contentLanguageHandler()->update($struct);
37
38
        $this->cache->invalidateTags(['language-' . $struct->id]);
39
40
        return $return;
41
    }
42
43
    /**
44
     * {@inheritdoc}
@@ 96-104 (lines=9) @@
93
    /**
94
     * {@inheritdoc}
95
     */
96
    public function delete($id)
97
    {
98
        $this->logger->logCall(__METHOD__, array('language' => $id));
99
        $return = $this->persistenceHandler->contentLanguageHandler()->delete($id);
100
101
        $this->cache->invalidateTags(['language-' . $id]);
102
103
        return $return;
104
    }
105
}
106

eZ/Publish/Core/Persistence/Cache/ContentTypeHandler.php 2 locations

@@ 41-49 (lines=9) @@
38
    /**
39
     * {@inheritdoc}
40
     */
41
    public function updateGroup(GroupUpdateStruct $struct)
42
    {
43
        $this->logger->logCall(__METHOD__, array('struct' => $struct));
44
        $group = $this->persistenceHandler->contentTypeHandler()->updateGroup($struct);
45
46
        $this->cache->invalidateTags(['type-group-' . $struct->id]);
47
48
        return $group;
49
    }
50
51
    /**
52
     * {@inheritdoc}
@@ 54-62 (lines=9) @@
51
    /**
52
     * {@inheritdoc}
53
     */
54
    public function deleteGroup($groupId)
55
    {
56
        $this->logger->logCall(__METHOD__, array('group' => $groupId));
57
        $return = $this->persistenceHandler->contentTypeHandler()->deleteGroup($groupId);
58
59
        $this->cache->invalidateTags(['type-group-' . $groupId]);
60
61
        return $return;
62
    }
63
64
    /**
65
     * {@inheritdoc}

eZ/Publish/Core/Persistence/Cache/LocationHandler.php 6 locations

@@ 175-183 (lines=9) @@
172
    /**
173
     * {@inheritdoc}
174
     */
175
    public function hide($locationId)
176
    {
177
        $this->logger->logCall(__METHOD__, array('location' => $locationId));
178
        $return = $this->persistenceHandler->locationHandler()->hide($locationId);
179
180
        $this->cache->invalidateTags(['location-path-data-' . $locationId]);
181
182
        return $return;
183
    }
184
185
    /**
186
     * {@inheritdoc}
@@ 188-196 (lines=9) @@
185
    /**
186
     * {@inheritdoc}
187
     */
188
    public function unHide($locationId)
189
    {
190
        $this->logger->logCall(__METHOD__, array('location' => $locationId));
191
        $return = $this->persistenceHandler->locationHandler()->unHide($locationId);
192
193
        $this->cache->invalidateTags(['location-path-data-' . $locationId]);
194
195
        return $return;
196
    }
197
198
    /**
199
     * {@inheritdoc}
@@ 221-227 (lines=7) @@
218
    /**
219
     * {@inheritdoc}
220
     */
221
    public function update(UpdateStruct $struct, $locationId)
222
    {
223
        $this->logger->logCall(__METHOD__, array('location' => $locationId, 'struct' => $struct));
224
        $this->persistenceHandler->locationHandler()->update($struct, $locationId);
225
226
        $this->cache->invalidateTags(['location-data-' . $locationId]);
227
    }
228
229
    /**
230
     * {@inheritdoc}
@@ 247-255 (lines=9) @@
244
    /**
245
     * {@inheritdoc}
246
     */
247
    public function removeSubtree($locationId)
248
    {
249
        $this->logger->logCall(__METHOD__, array('location' => $locationId));
250
        $return = $this->persistenceHandler->locationHandler()->removeSubtree($locationId);
251
252
        $this->cache->invalidateTags(['location-path-' . $locationId]);
253
254
        return $return;
255
    }
256
257
    /**
258
     * {@inheritdoc}
@@ 260-266 (lines=7) @@
257
    /**
258
     * {@inheritdoc}
259
     */
260
    public function setSectionForSubtree($locationId, $sectionId)
261
    {
262
        $this->logger->logCall(__METHOD__, array('location' => $locationId, 'section' => $sectionId));
263
        $this->persistenceHandler->locationHandler()->setSectionForSubtree($locationId, $sectionId);
264
265
        $this->cache->invalidateTags(['location-path-' . $locationId]);
266
    }
267
268
    /**
269
     * {@inheritdoc}
@@ 271-277 (lines=7) @@
268
    /**
269
     * {@inheritdoc}
270
     */
271
    public function changeMainLocation($contentId, $locationId)
272
    {
273
        $this->logger->logCall(__METHOD__, array('location' => $locationId, 'content' => $contentId));
274
        $this->persistenceHandler->locationHandler()->changeMainLocation($contentId, $locationId);
275
276
        $this->cache->invalidateTags(['content-' . $contentId]);
277
    }
278
279
    /**
280
     * Return relevant content and location tags so cache can be purged reliably.

eZ/Publish/Core/Persistence/Cache/ObjectStateHandler.php 2 locations

@@ 136-144 (lines=9) @@
133
    /**
134
     * {@inheritdoc}
135
     */
136
    public function deleteGroup($groupId)
137
    {
138
        $this->logger->logCall(__METHOD__, array('groupId' => $groupId));
139
        $return = $this->persistenceHandler->objectStateHandler()->deleteGroup($groupId);
140
141
        $this->cache->invalidateTags(['state-group-' . $groupId]);
142
143
        return $return;
144
    }
145
146
    /**
147
     * {@inheritdoc}
@@ 228-236 (lines=9) @@
225
    /**
226
     * {@inheritdoc}
227
     */
228
    public function delete($stateId)
229
    {
230
        $this->logger->logCall(__METHOD__, array('stateId' => $stateId));
231
        $return = $this->persistenceHandler->objectStateHandler()->delete($stateId);
232
233
        $this->cache->invalidateTags(['state-' . $stateId]);
234
235
        return $return;
236
    }
237
238
    /**
239
     * {@inheritdoc}

eZ/Publish/Core/Persistence/Cache/SectionHandler.php 1 location

@@ 94-102 (lines=9) @@
91
    /**
92
     * {@inheritdoc}
93
     */
94
    public function delete($id)
95
    {
96
        $this->logger->logCall(__METHOD__, array('section' => $id));
97
        $return = $this->persistenceHandler->sectionHandler()->delete($id);
98
99
        $this->cache->invalidateTags(['section-' . $id]);
100
101
        return $return;
102
    }
103
104
    /**
105
     * {@inheritdoc}

eZ/Publish/Core/Persistence/Cache/ContentHandler.php 1 location

@@ 372-384 (lines=13) @@
369
    /**
370
     * {@inheritdoc}
371
     */
372
    public function deleteTranslationFromContent($contentId, $languageCode)
373
    {
374
        $this->logger->logCall(
375
            __METHOD__,
376
            [
377
                'contentId' => $contentId,
378
                'languageCode' => $languageCode,
379
            ]
380
        );
381
382
        $this->persistenceHandler->contentHandler()->deleteTranslationFromContent($contentId, $languageCode);
383
        $this->cache->invalidateTags(['content-' . $contentId]);
384
    }
385
386
    /**
387
     * {@inheritdoc}

eZ/Publish/Core/Persistence/Cache/UserHandler.php 4 locations

@@ 28-37 (lines=10) @@
25
    /**
26
     * {@inheritdoc}
27
     */
28
    public function create(User $user)
29
    {
30
        $this->logger->logCall(__METHOD__, array('struct' => $user));
31
        $return = $this->persistenceHandler->userHandler()->create($user);
32
33
        // Clear corresponding content cache as creation of the User changes it's external data
34
        $this->cache->invalidateTags(['content-fields-' . $user->id]);
35
36
        return $return;
37
    }
38
39
    /**
40
     * {@inheritdoc}
@@ 355-361 (lines=7) @@
352
    /**
353
     * {@inheritdoc}
354
     */
355
    public function updateRole(RoleUpdateStruct $struct)
356
    {
357
        $this->logger->logCall(__METHOD__, array('struct' => $struct));
358
        $this->persistenceHandler->userHandler()->updateRole($struct);
359
360
        $this->cache->invalidateTags(['role-' . $struct->id]);
361
    }
362
363
    /**
364
     * {@inheritdoc}
@@ 435-441 (lines=7) @@
432
    /**
433
     * {@inheritdoc}
434
     */
435
    public function deletePolicy($policyId, $roleId)
436
    {
437
        $this->logger->logCall(__METHOD__, array('policy' => $policyId));
438
        $this->persistenceHandler->userHandler()->deletePolicy($policyId, $roleId);
439
440
        $this->cache->invalidateTags(['policy-' . $policyId, 'role-' . $roleId]);
441
    }
442
443
    /**
444
     * {@inheritdoc}
@@ 488-496 (lines=9) @@
485
    /**
486
     * {@inheritdoc}
487
     */
488
    public function removeRoleAssignment($roleAssignmentId)
489
    {
490
        $this->logger->logCall(__METHOD__, array('assignment' => $roleAssignmentId));
491
        $return = $this->persistenceHandler->userHandler()->removeRoleAssignment($roleAssignmentId);
492
493
        $this->cache->invalidateTags(['role-assignment-' . $roleAssignmentId]);
494
495
        return $return;
496
    }
497
498
    /**
499
     * Reusable function to return relevant role assignment tags so cache can be purged reliably.