Code Duplication    Length = 7-10 lines in 14 locations

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

@@ 106-115 (lines=10) @@
103
    /**
104
     * {@inheritdoc}
105
     */
106
    public function update(User $user)
107
    {
108
        $this->logger->logCall(__METHOD__, array('struct' => $user));
109
        $return = $this->persistenceHandler->userHandler()->update($user);
110
111
        // Clear corresponding content cache as update of the User changes it's external data
112
        $this->cache->invalidateTags(['content-fields-' . $user->id, 'user-' . $user->id]);
113
114
        return $return;
115
    }
116
117
    /**
118
     * {@inheritdoc}
@@ 309-315 (lines=7) @@
306
    /**
307
     * {@inheritdoc}
308
     */
309
    public function updateRole(RoleUpdateStruct $struct)
310
    {
311
        $this->logger->logCall(__METHOD__, array('struct' => $struct));
312
        $this->persistenceHandler->userHandler()->updateRole($struct);
313
314
        $this->cache->invalidateTags(['role-' . $struct->id]);
315
    }
316
317
    /**
318
     * {@inheritdoc}
@@ 376-384 (lines=9) @@
373
    /**
374
     * {@inheritdoc}
375
     */
376
    public function updatePolicy(Policy $policy)
377
    {
378
        $this->logger->logCall(__METHOD__, array('struct' => $policy));
379
        $return = $this->persistenceHandler->userHandler()->updatePolicy($policy);
380
381
        $this->cache->invalidateTags(['policy-' . $policy->id, 'role-' . $policy->roleId]);
382
383
        return $return;
384
    }
385
386
    /**
387
     * {@inheritdoc}
@@ 389-395 (lines=7) @@
386
    /**
387
     * {@inheritdoc}
388
     */
389
    public function deletePolicy($policyId, $roleId)
390
    {
391
        $this->logger->logCall(__METHOD__, array('policy' => $policyId));
392
        $this->persistenceHandler->userHandler()->deletePolicy($policyId, $roleId);
393
394
        $this->cache->invalidateTags(['policy-' . $policyId, 'role-' . $roleId]);
395
    }
396
397
    /**
398
     * {@inheritdoc}
@@ 423-431 (lines=9) @@
420
    /**
421
     * {@inheritdoc}
422
     */
423
    public function unassignRole($contentId, $roleId)
424
    {
425
        $this->logger->logCall(__METHOD__, array('group' => $contentId, 'role' => $roleId));
426
        $return = $this->persistenceHandler->userHandler()->unassignRole($contentId, $roleId);
427
428
        $this->cache->invalidateTags(['role-assignment-group-list-' . $contentId, 'role-assignment-role-list-' . $roleId]);
429
430
        return $return;
431
    }
432
433
    /**
434
     * {@inheritdoc}
@@ 436-444 (lines=9) @@
433
    /**
434
     * {@inheritdoc}
435
     */
436
    public function removeRoleAssignment($roleAssignmentId)
437
    {
438
        $this->logger->logCall(__METHOD__, array('assignment' => $roleAssignmentId));
439
        $return = $this->persistenceHandler->userHandler()->removeRoleAssignment($roleAssignmentId);
440
441
        $this->cache->invalidateTags(['role-assignment-' . $roleAssignmentId]);
442
443
        return $return;
444
    }
445
446
    /**
447
     * Reusable function to return relevant role assignment tags so cache can be purged reliably.

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

@@ 107-115 (lines=9) @@
104
    /**
105
     * {@inheritdoc}
106
     */
107
    public function assign($sectionId, $contentId)
108
    {
109
        $this->logger->logCall(__METHOD__, array('section' => $sectionId, 'content' => $contentId));
110
        $return = $this->persistenceHandler->sectionHandler()->assign($sectionId, $contentId);
111
112
        $this->cache->invalidateTags(['content-' . $contentId]);
113
114
        return $return;
115
    }
116
117
    /**
118
     * {@inheritdoc}

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

@@ 32-41 (lines=10) @@
29
    /**
30
     * {@inheritdoc}
31
     */
32
    public function trashSubtree($locationId)
33
    {
34
        $this->logger->logCall(__METHOD__, array('locationId' => $locationId));
35
        $return = $this->persistenceHandler->trashHandler()->trashSubtree($locationId);
36
37
        $this->cache->invalidateTags(['location-' . $locationId, 'location-path-' . $locationId]);
38
39
        return $return;
40
    }
41
42
    /**
43
     * {@inheritdoc}
44
     */

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

@@ 216-222 (lines=7) @@
213
    /**
214
     * {@inheritdoc}
215
     */
216
    public function update(UpdateStruct $struct, $locationId)
217
    {
218
        $this->logger->logCall(__METHOD__, array('location' => $locationId, 'struct' => $struct));
219
        $this->persistenceHandler->locationHandler()->update($struct, $locationId);
220
221
        $this->cache->invalidateTags(['location-data-' . $locationId]);
222
    }
223
224
    /**
225
     * {@inheritdoc}
@@ 255-261 (lines=7) @@
252
    /**
253
     * {@inheritdoc}
254
     */
255
    public function setSectionForSubtree($locationId, $sectionId)
256
    {
257
        $this->logger->logCall(__METHOD__, array('location' => $locationId, 'section' => $sectionId));
258
        $this->persistenceHandler->locationHandler()->setSectionForSubtree($locationId, $sectionId);
259
260
        $this->cache->invalidateTags(['location-path-' . $locationId]);
261
    }
262
263
    /**
264
     * {@inheritdoc}
@@ 266-272 (lines=7) @@
263
    /**
264
     * {@inheritdoc}
265
     */
266
    public function changeMainLocation($contentId, $locationId)
267
    {
268
        $this->logger->logCall(__METHOD__, array('location' => $locationId, 'content' => $contentId));
269
        $this->persistenceHandler->locationHandler()->changeMainLocation($contentId, $locationId);
270
271
        $this->cache->invalidateTags(['content-' . $contentId]);
272
    }
273
274
    /**
275
     * Return relevant content and location tags so cache can be purged reliably.

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

@@ 123-131 (lines=9) @@
120
    /**
121
     * {@inheritdoc}
122
     */
123
    public function updateGroup($groupId, InputStruct $input)
124
    {
125
        $this->logger->logCall(__METHOD__, array('groupId' => $groupId, 'struct' => $input));
126
        $return = $this->persistenceHandler->objectStateHandler()->updateGroup($groupId, $input);
127
128
        $this->cache->invalidateTags(['state-group-' . $groupId]);
129
130
        return $return;
131
    }
132
133
    /**
134
     * {@inheritdoc}

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

@@ 252-260 (lines=9) @@
249
    /**
250
     * {@inheritdoc}
251
     */
252
    public function createDraft($modifierId, $typeId)
253
    {
254
        $this->logger->logCall(__METHOD__, array('modifier' => $modifierId, 'type' => $typeId));
255
        $draft = $this->persistenceHandler->contentTypeHandler()->createDraft($modifierId, $typeId);
256
257
        $this->cache->deleteItem('ez-content-type-' . $typeId . '-' . Type::STATUS_DRAFT);
258
259
        return $draft;
260
    }
261
262
    /**
263
     * {@inheritdoc}
@@ 390-397 (lines=8) @@
387
    /**
388
     * {@inheritdoc}
389
     */
390
    public function publish($typeId)
391
    {
392
        $this->logger->logCall(__METHOD__, array('type' => $typeId));
393
        $this->persistenceHandler->contentTypeHandler()->publish($typeId);
394
395
        // Clear type cache, map cache, and content cache which contains fields.
396
        $this->cache->invalidateTags(['type-' . $typeId, 'type-map', 'content-fields-type-' . $typeId]);
397
    }
398
399
    /**
400
     * {@inheritdoc}