Cancel document for specified target language

@param
$documentTicket
Document ticket to cancel
@param
$locale
Target locale to cancel
358127
function cancelTargetByDocumentTicket($documentTicket, $locale) {
			$cancelDocumentRequest = new cancelTargetByDocumentId ();
			$dticket = new DocumentTicket ();
			$dticket->ticketId = $documentTicket;
			$cancelDocumentRequest->documentId = $dticket;
			$cancelDocumentRequest->targetLocale = $locale;
			return $this->targetService->cancelTargetByDocumentId ( $cancelDocumentRequest );

	}
1137378
public function removeTranslation(\Haven\CoreBundle\Entity\CultureTranslation $translations) {
        $this->translations->removeElement($translations);
    }
709953
protected function updateSinglePageSelection(
        array &$structureArray,
        PropertyMetadata $property,
        $localeSource,
        $localeDestination
    ) {
        if (!array_key_exists($property->getName(), $structureArray) || !$structureArray[$property->getName()]) {
            return;
        }

        $targetDocumentDestination = $this->getTargetDocumentDestination(
            $structureArray[$property->getName()],
            $localeSource,
            $localeDestination
        );

        if (!$targetDocumentDestination) {
            return;
        }

        $structureArray[$property->getName()] = $targetDocumentDestination->getUuid();
    }
34371
private function persistDocument($data, $document, $locale, $articleUuid)
    {
        if (array_key_exists('title', $data)) {
            throw new ParameterNotAllowedException('title', get_class($document));
        }

        $article = $this->getDocumentManager()->find($articleUuid, $locale);

        if (!array_key_exists('template', $data)) {
            $data['template'] = $article->getStructureType();
        }

        $formType = $this->getMetadataFactory()->getMetadataForAlias('article_page')->getFormType();

        $form = $this->createForm(
            $formType,
            $document,
            [
                // disable csrf protection, since we can't produce a token, because the form is cached on the client
                'csrf_protection' => false,
            ]
        );
        $form->submit($data, false);

        $document->setParent($article);

        if (!$form->isValid()) {
            throw new InvalidFormException($form);
        }

        $this->getDocumentManager()->persist(
            $document,
            $locale,
            [
                'user' => $this->getUser()->getId(),
                'clear_missing_content' => false,
                'auto_name' => false,
                'auto_rename' => false,
            ]
        );
    }
1234881
public function resetForLocaleTranslatables(LocaleEntity $locale, $translatables)
    {
        $this->resetForLocale($locale);
        $translatableIDs = [];
        if ($translatables) {
            if ($translatables instanceof TranslatableEntity) {
                $translatableIDs[] = $translatables->getID();
            } elseif (is_int($translatables)) {
                $translatableIDs[] = $translatables;
            } elseif (is_array($translatables)) {
                foreach ($translatables as $translatable) {
                    if ($translatable instanceof TranslatableEntity) {
                        $translatableIDs[] = $translatable->getID();
                    } elseif (is_int($translatable)) {
                        $translatableIDs[] = $translatable;
                    } else {
                        throw new UserMessageException(t('Invalid translatable string specified'));
                    }
                }
            }
        }
        if (empty($translatableIDs)) {
            throw new UserMessageException(t('Invalid translatable string specified'));
        }
        $this->getEntityManager()->getConnection()->executeQuery(
            '
                delete s.*
                from CommunityTranslationStats as s
                inner join CommunityTranslationTranslatablePlaces as p on s.packageVersion = p.packageVersion
                where s.locale = ?
                and (p.translatable = ' . implode(' or p.translatable = ', $translatableIDs) . ')
            ',
            [$locale->getID()]
        );
    }
69694
public function setLocale($locale)
    {
        $locale = substr($locale, 0, 2);
        if (in_array($locale, $this->locales)) {
            $this->locale = $locale;
            return true;
        }
        return false;
    }
85499
public function setLocale($locale)
    {
        $this->locale = LanguageNormalize::toLanguageTag($locale);

        $this->localises[$locale] = null;

        return $this;
    }
776543
public function registerDocument($document, NodeInterface $node, $locale)
    {
        $oid = $this->getObjectIdentifier($document);
        $uuid = $node->getIdentifier();

        // do not allow nodes without UUIDs or reregistration of documents
        $this->validateDocumentRegistration($document, $locale, $node, $oid, $uuid);

        $this->documentMap[$oid] = $document;
        $this->documentNodeMap[$oid] = $uuid;
        $this->nodeMap[$node->getIdentifier()] = $node;
        $this->nodeDocumentMap[$this->getNodeLocaleKey($node->getIdentifier(), $locale)] = $document;
        $this->documentLocaleMap[$oid] = $locale;
    }
924426
private function doRemoveAllTranslations($document, ClassMetadata $metadata)
    {
        if (!$this->isDocumentTranslatable($metadata)) {
            return;
        }

        $node = $this->session->getNode($this->getDocumentId($document));
        $strategy = $this->dm->getTranslationStrategy($metadata->translator);
        $strategy->removeAllTranslations($document, $node, $metadata);
    }
412287
public function deleteDocumentIndexes(string $documentName, ?int $maxTimeMs = null, ?WriteConcern $writeConcern = null) : void
    {
        $class = $this->dm->getClassMetadata($documentName);
        if ($class->isMappedSuperclass || $class->isEmbeddedDocument || $class->isQueryResultDocument) {
            throw new InvalidArgumentException('Cannot delete document indexes for mapped super classes, embedded documents or query result documents.');
        }

        $this->dm->getDocumentCollection($documentName)->dropIndexes($this->getWriteOptions($maxTimeMs, $writeConcern));
    }
578017
public function removeTranslation($locale = null) {
        $translation = $this->translate($locale);

        if(! is_null($translation))
            $translation->delete();

        return $this;
    }
514247
public static void setLocale(@NonNull Locale locale) {
        if (!locale.equals(Locale.getDefault())) {
            LocalizationHelper.locale = locale;
            Locale.setDefault(locale);
        }
    }
402149
public function resetForLocale(LocaleEntity $locale)
    {
        $this->createQueryBuilder('t')
            ->delete()
            ->where('t.locale = :locale')->setParameter('locale', $locale)
            ->getQuery()->execute();
    }
1319157
public function setDefaultLocale($locale)
    {
        $this->defaultLocale = $locale;

        if (null === $this->locale) {
            $this->setPhpDefaultLocale($locale);
        }
    }
1063556
public function getAvailableLocalization(StructureBehavior $document, $locale)
    {
        $availableLocales = $this->inspector->getLocales($document);

        if (in_array($locale, $availableLocales)) {
            return $locale;
        }

        $fallbackLocale = null;

        if ($document instanceof WebspaceBehavior) {
            $fallbackLocale = $this->localizationFinder->findAvailableLocale(
                $this->inspector->getWebspace($document),
                $availableLocales,
                $locale
            );
        }

        if (!$fallbackLocale) {
            $fallbackLocale = reset($availableLocales);
        }

        if (!$fallbackLocale) {
            $fallbackLocale = $this->documentRegistry->getDefaultLocale();
        }

        return $fallbackLocale;
    }
137338
private function persistDocument($data, $document, $locale)
    {
        $formType = $this->getMetadataFactory()->getMetadataForAlias('article')->getFormType();
        $form = $this->createForm(
            $formType,
            $document,
            [
                // disable csrf protection, since we can't produce a token, because the form is cached on the client
                'csrf_protection' => false,
            ]
        );
        $form->submit($data, false);

        if (!$form->isValid()) {
            throw new InvalidFormException($form);
        }

        if (array_key_exists('author', $data) && null === $data['author']) {
            $document->setAuthor(null);
        }

        if (array_key_exists('additionalWebspaces', $data) && null === $data['additionalWebspaces']) {
            $document->setAdditionalWebspaces(null);
        }

        $this->getDocumentManager()->persist(
            $document,
            $locale,
            [
                'user' => $this->getUser()->getId(),
                'clear_missing_content' => false,
            ]
        );
    }
168571
public function forgetTranslation(string $key, string $locale)
    {
        $translations = $this->getTranslations($key);

        unset($translations[ $locale ]);

        $this->setAttribute($key, $translations);

        return $this;
    }