Code Duplication    Length = 7-10 lines in 19 locations

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

@@ 185-193 (lines=9) @@
182
    /**
183
     * {@inheritdoc}
184
     */
185
    public function move($sourceId, $destinationParentId)
186
    {
187
        $this->logger->logCall(__METHOD__, array('source' => $sourceId, 'destination' => $destinationParentId));
188
        $return = $this->persistenceHandler->locationHandler()->move($sourceId, $destinationParentId);
189
190
        $this->cache->invalidateTags(['location-path-' . $sourceId]);
191
192
        return $return;
193
    }
194
195
    /**
196
     * {@inheritdoc}
@@ 207-215 (lines=9) @@
204
    /**
205
     * {@inheritdoc}
206
     */
207
    public function hide($locationId)
208
    {
209
        $this->logger->logCall(__METHOD__, array('location' => $locationId));
210
        $return = $this->persistenceHandler->locationHandler()->hide($locationId);
211
212
        $this->cache->invalidateTags(['location-path-data-' . $locationId]);
213
214
        return $return;
215
    }
216
217
    /**
218
     * {@inheritdoc}
@@ 235-241 (lines=7) @@
232
     *
233
     * @param int $id Location ID
234
     */
235
    public function setInvisible(int $id): void
236
    {
237
        $this->logger->logCall(__METHOD__, ['location' => $id]);
238
        $this->persistenceHandler->locationHandler()->setInvisible($id);
239
240
        $this->cache->invalidateTags(['location-path-data-' . $id]);
241
    }
242
243
    /**
244
     * Sets a location + all children to visible.
@@ 248-254 (lines=7) @@
245
     *
246
     * @param int $id Location ID
247
     */
248
    public function setVisible(int $id): void
249
    {
250
        $this->logger->logCall(__METHOD__, ['location' => $id]);
251
        $this->persistenceHandler->locationHandler()->setVisible($id);
252
253
        $this->cache->invalidateTags(['location-path-data-' . $id]);
254
    }
255
256
    /**
257
     * {@inheritdoc}

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

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

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

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

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

@@ 216-223 (lines=8) @@
213
    /**
214
     * {@inheritdoc}
215
     */
216
    public function expireUserToken($hash)
217
    {
218
        $this->logger->logCall(__METHOD__, array('hash' => $hash));
219
        $return = $this->persistenceHandler->userHandler()->expireUserToken($hash);
220
        $this->cache->deleteItems(['ez-user-' . $hash . '-by-account-key']);
221
222
        return $return;
223
    }
224
225
    /**
226
     * {@inheritdoc}
@@ 228-237 (lines=10) @@
225
    /**
226
     * {@inheritdoc}
227
     */
228
    public function delete($userId)
229
    {
230
        $this->logger->logCall(__METHOD__, array('user' => $userId));
231
        $return = $this->persistenceHandler->userHandler()->delete($userId);
232
233
        // user id == content id == group id
234
        $this->cache->invalidateTags(['content-fields-' . $userId, 'user-' . $userId]);
235
236
        return $return;
237
    }
238
239
    /**
240
     * {@inheritdoc}
@@ 399-405 (lines=7) @@
396
    /**
397
     * {@inheritdoc}
398
     */
399
    public function updateRole(RoleUpdateStruct $struct)
400
    {
401
        $this->logger->logCall(__METHOD__, array('struct' => $struct));
402
        $this->persistenceHandler->userHandler()->updateRole($struct);
403
404
        $this->cache->invalidateTags(['role-' . $struct->id]);
405
    }
406
407
    /**
408
     * {@inheritdoc}
@@ 453-461 (lines=9) @@
450
    /**
451
     * {@inheritdoc}
452
     */
453
    public function addPolicy($roleId, Policy $policy)
454
    {
455
        $this->logger->logCall(__METHOD__, array('role' => $roleId, 'struct' => $policy));
456
        $return = $this->persistenceHandler->userHandler()->addPolicy($roleId, $policy);
457
458
        $this->cache->invalidateTags(['role-' . $roleId]);
459
460
        return $return;
461
    }
462
463
    /**
464
     * {@inheritdoc}
@@ 479-485 (lines=7) @@
476
    /**
477
     * {@inheritdoc}
478
     */
479
    public function deletePolicy($policyId, $roleId)
480
    {
481
        $this->logger->logCall(__METHOD__, array('policy' => $policyId));
482
        $this->persistenceHandler->userHandler()->deletePolicy($policyId, $roleId);
483
484
        $this->cache->invalidateTags(['policy-' . $policyId, 'role-' . $roleId]);
485
    }
486
487
    /**
488
     * {@inheritdoc}
@@ 532-540 (lines=9) @@
529
    /**
530
     * {@inheritdoc}
531
     */
532
    public function removeRoleAssignment($roleAssignmentId)
533
    {
534
        $this->logger->logCall(__METHOD__, array('assignment' => $roleAssignmentId));
535
        $return = $this->persistenceHandler->userHandler()->removeRoleAssignment($roleAssignmentId);
536
537
        $this->cache->invalidateTags(['role-assignment-' . $roleAssignmentId]);
538
539
        return $return;
540
    }
541
}
542