Code Duplication    Length = 11-13 lines in 2 locations

module/Applications/src/Applications/Repository/Event/UpdateFilesPermissionsSubscriber.php 1 location

@@ 57-67 (lines=11) @@
54
            foreach ($documents as $document) {
55
                $permissions = $document->getPermissions();
56
               
57
                foreach ($document->getAttachments() as $attachment) {
58
                    $attachment->getPermissions()
59
                               ->clear()
60
                               ->inherit($permissions);
61
                    if ($isUpdate) {
62
                        $uow->computeChangeSet(
63
                            $dm->getClassMetadata(get_class($attachment)),
64
                            $attachment
65
                        );
66
                    }
67
                }
68
                
69
                if ($image = $document->contact->image) {
70
                    $image->getPermissions()

module/Core/src/Core/Repository/DoctrineMongoODM/Event/AbstractUpdateFilesPermissionsSubscriber.php 1 location

@@ 91-103 (lines=13) @@
88
            $perms = $document->getPermissions();
89
            $files = $this->getFiles($document);
90
91
            foreach ($files as $file) {
92
                $file
93
                    ->getPermissions()
94
                    ->clear()
95
                    ->inherit($perms);
96
97
                if ($dm) {
98
                    $uow->computeChangeSet(
99
                        $dm->getClassMetadata(get_class($file)),
100
                        $file
101
                    );
102
                }
103
            }
104
        }
105
    }
106