Code Duplication    Length = 7-10 lines in 14 locations

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}

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

@@ 105-114 (lines=10) @@
102
    /**
103
     * {@inheritdoc}
104
     */
105
    public function update(User $user)
106
    {
107
        $this->logger->logCall(__METHOD__, array('struct' => $user));
108
        $return = $this->persistenceHandler->userHandler()->update($user);
109
110
        // Clear corresponding content cache as update of the User changes it's external data
111
        $this->cache->invalidateTags(['content-fields-' . $user->id, 'user-' . $user->id]);
112
113
        return $return;
114
    }
115
116
    /**
117
     * {@inheritdoc}
@@ 317-323 (lines=7) @@
314
    /**
315
     * {@inheritdoc}
316
     */
317
    public function updateRole(RoleUpdateStruct $struct)
318
    {
319
        $this->logger->logCall(__METHOD__, array('struct' => $struct));
320
        $this->persistenceHandler->userHandler()->updateRole($struct);
321
322
        $this->cache->invalidateTags(['role-' . $struct->id]);
323
    }
324
325
    /**
326
     * {@inheritdoc}
@@ 384-392 (lines=9) @@
381
    /**
382
     * {@inheritdoc}
383
     */
384
    public function updatePolicy(Policy $policy)
385
    {
386
        $this->logger->logCall(__METHOD__, array('struct' => $policy));
387
        $return = $this->persistenceHandler->userHandler()->updatePolicy($policy);
388
389
        $this->cache->invalidateTags(['policy-' . $policy->id, 'role-' . $policy->roleId]);
390
391
        return $return;
392
    }
393
394
    /**
395
     * {@inheritdoc}
@@ 397-403 (lines=7) @@
394
    /**
395
     * {@inheritdoc}
396
     */
397
    public function deletePolicy($policyId, $roleId)
398
    {
399
        $this->logger->logCall(__METHOD__, array('policy' => $policyId));
400
        $this->persistenceHandler->userHandler()->deletePolicy($policyId, $roleId);
401
402
        $this->cache->invalidateTags(['policy-' . $policyId, 'role-' . $roleId]);
403
    }
404
405
    /**
406
     * {@inheritdoc}
@@ 431-439 (lines=9) @@
428
    /**
429
     * {@inheritdoc}
430
     */
431
    public function unassignRole($contentId, $roleId)
432
    {
433
        $this->logger->logCall(__METHOD__, array('group' => $contentId, 'role' => $roleId));
434
        $return = $this->persistenceHandler->userHandler()->unassignRole($contentId, $roleId);
435
436
        $this->cache->invalidateTags(['role-assignment-group-list-' . $contentId, 'role-assignment-role-list-' . $roleId]);
437
438
        return $return;
439
    }
440
441
    /**
442
     * {@inheritdoc}
@@ 444-452 (lines=9) @@
441
    /**
442
     * {@inheritdoc}
443
     */
444
    public function removeRoleAssignment($roleAssignmentId)
445
    {
446
        $this->logger->logCall(__METHOD__, array('assignment' => $roleAssignmentId));
447
        $return = $this->persistenceHandler->userHandler()->removeRoleAssignment($roleAssignmentId);
448
449
        $this->cache->invalidateTags(['role-assignment-' . $roleAssignmentId]);
450
451
        return $return;
452
    }
453
}
454