Code Duplication    Length = 24-24 lines in 2 locations

eZ/Publish/Core/Persistence/Legacy/Content/Gateway/DoctrineDatabase.php 2 locations

@@ 2103-2126 (lines=24) @@
2100
     * @param int $contentId
2101
     * @param int $versionNo (optional) filter by versionNo
2102
     */
2103
    public function deleteTranslatedFields($languageCode, $contentId, $versionNo = null)
2104
    {
2105
        $query = $this->connection->createQueryBuilder();
2106
        $query
2107
            ->delete('ezcontentobject_attribute')
2108
            ->where('contentobject_id = :contentId')
2109
            ->andWhere('language_code = :languageCode')
2110
            ->setParameters(
2111
                [
2112
                    ':contentId' => $contentId,
2113
                    ':languageCode' => $languageCode,
2114
                ]
2115
            )
2116
        ;
2117
2118
        if (null !== $versionNo) {
2119
            $query
2120
                ->andWhere('version = :versionNo')
2121
                ->setParameter(':versionNo', $versionNo)
2122
            ;
2123
        }
2124
2125
        $query->execute();
2126
    }
2127
2128
    /**
2129
     * Delete the specified Translation from the given Version.
@@ 2159-2182 (lines=24) @@
2156
     * @param string $languageCode
2157
     * @param int $versionNo optional, if specified, apply to this Version only.
2158
     */
2159
    private function deleteTranslationFromContentNames($contentId, $languageCode, $versionNo = null)
2160
    {
2161
        $query = $this->connection->createQueryBuilder();
2162
        $query
2163
            ->delete('ezcontentobject_name')
2164
            ->where('contentobject_id=:contentId')
2165
            ->andWhere('real_translation=:languageCode')
2166
            ->setParameters(
2167
                [
2168
                    ':languageCode' => $languageCode,
2169
                    ':contentId' => $contentId,
2170
                ]
2171
            )
2172
        ;
2173
2174
        if (null !== $versionNo) {
2175
            $query
2176
                ->andWhere('content_version = :versionNo')
2177
                ->setParameter(':versionNo', $versionNo)
2178
            ;
2179
        }
2180
2181
        $query->execute();
2182
    }
2183
2184
    /**
2185
     * Remove language from language_mask of ezcontentobject.