| @@ 2018-2041 (lines=24) @@ | ||
| 2015 | * @param int $contentId |
|
| 2016 | * @param int $versionNo (optional) filter by versionNo |
|
| 2017 | */ |
|
| 2018 | public function deleteTranslatedFields($languageCode, $contentId, $versionNo = null) |
|
| 2019 | { |
|
| 2020 | $query = $this->connection->createQueryBuilder(); |
|
| 2021 | $query |
|
| 2022 | ->delete('ezcontentobject_attribute') |
|
| 2023 | ->where('contentobject_id = :contentId') |
|
| 2024 | ->andWhere('language_code = :languageCode') |
|
| 2025 | ->setParameters( |
|
| 2026 | [ |
|
| 2027 | ':contentId' => $contentId, |
|
| 2028 | ':languageCode' => $languageCode, |
|
| 2029 | ] |
|
| 2030 | ) |
|
| 2031 | ; |
|
| 2032 | ||
| 2033 | if (null !== $versionNo) { |
|
| 2034 | $query |
|
| 2035 | ->andWhere('version = :versionNo') |
|
| 2036 | ->setParameter(':versionNo', $versionNo) |
|
| 2037 | ; |
|
| 2038 | } |
|
| 2039 | ||
| 2040 | $query->execute(); |
|
| 2041 | } |
|
| 2042 | ||
| 2043 | /** |
|
| 2044 | * Delete translation from the ezcontentobject_name table. |
|
| @@ 2050-2073 (lines=24) @@ | ||
| 2047 | * @param string $languageCode |
|
| 2048 | * @param int $versionNo optional, if specified, apply to this Version only. |
|
| 2049 | */ |
|
| 2050 | private function deleteTranslationFromContentNames($contentId, $languageCode, $versionNo = null) |
|
| 2051 | { |
|
| 2052 | $query = $this->connection->createQueryBuilder(); |
|
| 2053 | $query |
|
| 2054 | ->delete('ezcontentobject_name') |
|
| 2055 | ->where('contentobject_id=:contentId') |
|
| 2056 | ->andWhere('real_translation=:languageCode') |
|
| 2057 | ->setParameters( |
|
| 2058 | [ |
|
| 2059 | ':languageCode' => $languageCode, |
|
| 2060 | ':contentId' => $contentId, |
|
| 2061 | ] |
|
| 2062 | ) |
|
| 2063 | ; |
|
| 2064 | ||
| 2065 | if (null !== $versionNo) { |
|
| 2066 | $query |
|
| 2067 | ->andWhere('content_version = :versionNo') |
|
| 2068 | ->setParameter(':versionNo', $versionNo) |
|
| 2069 | ; |
|
| 2070 | } |
|
| 2071 | ||
| 2072 | $query->execute(); |
|
| 2073 | } |
|
| 2074 | ||
| 2075 | /** |
|
| 2076 | * Remove language from language_mask of ezcontentobject. |
|