Code Duplication    Length = 7-10 lines in 19 locations

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

@@ 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}
@@ 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}
@@ 149-157 (lines=9) @@
146
    /**
147
     * {@inheritdoc}
148
     */
149
    public function create($groupId, InputStruct $input)
150
    {
151
        $this->logger->logCall(__METHOD__, array('groupId' => $groupId, 'struct' => $input));
152
        $return = $this->persistenceHandler->objectStateHandler()->create($groupId, $input);
153
154
        $this->cache->deleteItem('ez-state-list-by-group-' . $groupId);
155
156
        return $return;
157
    }
158
159
    /**
160
     * {@inheritdoc}
@@ 202-210 (lines=9) @@
199
    /**
200
     * {@inheritdoc}
201
     */
202
    public function update($stateId, InputStruct $input)
203
    {
204
        $this->logger->logCall(__METHOD__, array('stateId' => $stateId, 'struct' => $input));
205
        $return = $this->persistenceHandler->objectStateHandler()->update($stateId, $input);
206
207
        $this->cache->invalidateTags(['state-' . $stateId]);
208
209
        return $return;
210
    }
211
212
    /**
213
     * {@inheritdoc}
@@ 215-223 (lines=9) @@
212
    /**
213
     * {@inheritdoc}
214
     */
215
    public function setPriority($stateId, $priority)
216
    {
217
        $this->logger->logCall(__METHOD__, array('stateId' => $stateId, 'priority' => $priority));
218
        $return = $this->persistenceHandler->objectStateHandler()->setPriority($stateId, $priority);
219
220
        $this->cache->invalidateTags(['state-' . $stateId]);
221
222
        return $return;
223
    }
224
225
    /**
226
     * {@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/ContentLanguageHandler.php 1 location

@@ 150-158 (lines=9) @@
147
    /**
148
     * {@inheritdoc}
149
     */
150
    public function delete($id)
151
    {
152
        $this->logger->logCall(__METHOD__, array('language' => $id));
153
        $return = $this->persistenceHandler->contentLanguageHandler()->delete($id);
154
155
        // As we don't have locale we clear cache by tag invalidation
156
        $this->cache->invalidateTags(['language-' . $id]);
157
158
        return $return;
159
    }
160
}
161

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

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

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

@@ 212-219 (lines=8) @@
209
    /**
210
     * {@inheritdoc}
211
     */
212
    public function expireUserToken($hash)
213
    {
214
        $this->logger->logCall(__METHOD__, array('hash' => $hash));
215
        $return = $this->persistenceHandler->userHandler()->expireUserToken($hash);
216
        $this->cache->deleteItems(['ez-user-' . $hash . '-by-account-key']);
217
218
        return $return;
219
    }
220
221
    /**
222
     * {@inheritdoc}
@@ 224-233 (lines=10) @@
221
    /**
222
     * {@inheritdoc}
223
     */
224
    public function delete($userId)
225
    {
226
        $this->logger->logCall(__METHOD__, array('user' => $userId));
227
        $return = $this->persistenceHandler->userHandler()->delete($userId);
228
229
        // user id == content id == group id
230
        $this->cache->invalidateTags(['content-fields-' . $userId, 'user-' . $userId]);
231
232
        return $return;
233
    }
234
235
    /**
236
     * {@inheritdoc}
@@ 395-401 (lines=7) @@
392
    /**
393
     * {@inheritdoc}
394
     */
395
    public function updateRole(RoleUpdateStruct $struct)
396
    {
397
        $this->logger->logCall(__METHOD__, array('struct' => $struct));
398
        $this->persistenceHandler->userHandler()->updateRole($struct);
399
400
        $this->cache->invalidateTags(['role-' . $struct->id]);
401
    }
402
403
    /**
404
     * {@inheritdoc}
@@ 449-457 (lines=9) @@
446
    /**
447
     * {@inheritdoc}
448
     */
449
    public function addPolicy($roleId, Policy $policy)
450
    {
451
        $this->logger->logCall(__METHOD__, array('role' => $roleId, 'struct' => $policy));
452
        $return = $this->persistenceHandler->userHandler()->addPolicy($roleId, $policy);
453
454
        $this->cache->invalidateTags(['role-' . $roleId]);
455
456
        return $return;
457
    }
458
459
    /**
460
     * {@inheritdoc}
@@ 475-481 (lines=7) @@
472
    /**
473
     * {@inheritdoc}
474
     */
475
    public function deletePolicy($policyId, $roleId)
476
    {
477
        $this->logger->logCall(__METHOD__, array('policy' => $policyId));
478
        $this->persistenceHandler->userHandler()->deletePolicy($policyId, $roleId);
479
480
        $this->cache->invalidateTags(['policy-' . $policyId, 'role-' . $roleId]);
481
    }
482
483
    /**
484
     * {@inheritdoc}
@@ 528-536 (lines=9) @@
525
    /**
526
     * {@inheritdoc}
527
     */
528
    public function removeRoleAssignment($roleAssignmentId)
529
    {
530
        $this->logger->logCall(__METHOD__, array('assignment' => $roleAssignmentId));
531
        $return = $this->persistenceHandler->userHandler()->removeRoleAssignment($roleAssignmentId);
532
533
        $this->cache->invalidateTags(['role-assignment-' . $roleAssignmentId]);
534
535
        return $return;
536
    }
537
}
538

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

@@ 222-230 (lines=9) @@
219
    /**
220
     * {@inheritdoc}
221
     */
222
    public function move($sourceId, $destinationParentId)
223
    {
224
        $this->logger->logCall(__METHOD__, array('source' => $sourceId, 'destination' => $destinationParentId));
225
        $return = $this->persistenceHandler->locationHandler()->move($sourceId, $destinationParentId);
226
227
        $this->cache->invalidateTags(['location-path-' . $sourceId]);
228
229
        return $return;
230
    }
231
232
    /**
233
     * {@inheritdoc}
@@ 244-252 (lines=9) @@
241
    /**
242
     * {@inheritdoc}
243
     */
244
    public function hide($locationId)
245
    {
246
        $this->logger->logCall(__METHOD__, array('location' => $locationId));
247
        $return = $this->persistenceHandler->locationHandler()->hide($locationId);
248
249
        $this->cache->invalidateTags(['location-path-data-' . $locationId]);
250
251
        return $return;
252
    }
253
254
    /**
255
     * {@inheritdoc}
@@ 272-278 (lines=7) @@
269
     *
270
     * @param int $id Location ID
271
     */
272
    public function setInvisible(int $id): void
273
    {
274
        $this->logger->logCall(__METHOD__, ['location' => $id]);
275
        $this->persistenceHandler->locationHandler()->setInvisible($id);
276
277
        $this->cache->invalidateTags(['location-path-data-' . $id]);
278
    }
279
280
    /**
281
     * Sets a location + all children to visible.
@@ 285-291 (lines=7) @@
282
     *
283
     * @param int $id Location ID
284
     */
285
    public function setVisible(int $id): void
286
    {
287
        $this->logger->logCall(__METHOD__, ['location' => $id]);
288
        $this->persistenceHandler->locationHandler()->setVisible($id);
289
290
        $this->cache->invalidateTags(['location-path-data-' . $id]);
291
    }
292
293
    /**
294
     * {@inheritdoc}