Code Duplication    Length = 19-27 lines in 2 locations

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

@@ 23-41 (lines=19) @@
20
    /**
21
     * {@inheritdoc}
22
     */
23
    public function updateUrl($id, URLUpdateStruct $struct)
24
    {
25
        $this->logger->logCall(__METHOD__, [
26
            'url' => $id,
27
            'struct' => $struct,
28
        ]);
29
30
        $url = $this->persistenceHandler->urlHandler()->updateUrl($id, $struct);
31
32
        $this->cache->invalidateTags(['url-' . $id]);
33
34
        if ($struct->url !== null) {
35
            $this->cache->invalidateTags(array_map(function ($id) {
36
                return 'content-' . $id;
37
            }, $this->persistenceHandler->urlHandler()->findUsages($id)));
38
        }
39
40
        return $url;
41
    }
42
43
    /**
44
     * {@inheritdoc}

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

@@ 236-262 (lines=27) @@
233
    /**
234
     * {@inheritdoc}
235
     */
236
    public function deleteContent($contentId)
237
    {
238
        $this->logger->logCall(__METHOD__, array('content' => $contentId));
239
240
        // Load reverse field relations first
241
        $reverseRelations = $this->persistenceHandler->contentHandler()->loadReverseRelations(
242
            $contentId,
243
            APIRelation::FIELD
244
        );
245
246
        $return = $this->persistenceHandler->contentHandler()->deleteContent($contentId);
247
248
        $this->cache->invalidateTags(['content-' . $contentId]);
249
        if (!empty($reverseRelations)) {
250
            $this->cache->invalidateTags(
251
                array_map(
252
                    function ($relation) {
253
                        // only the full content object *with* fields is affected by this
254
                        return 'content-fields-' . $relation->sourceContentId;
255
                    },
256
                    $reverseRelations
257
                )
258
            );
259
        }
260
261
        return $return;
262
    }
263
264
    /**
265
     * {@inheritdoc}