protected function deleteLocaleData($localeCode, OutputInterface $output)
{
$entityManager = $this->doctrineHelper->getEntityManager();
$metadata = $this->doctrineHelper->getAllMetadata();
$locale = $this->localeRepository->findOneBy(['code' => $localeCode]);
if (!$locale instanceof LocaleInterface) {
throw new InvalidArgumentException(sprintf('Wrong locale code "%s" was given', $localeCode));
}
foreach ($metadata as $classMetadata) {
$reflectionClass = $classMetadata->getReflectionClass();
if ($reflectionClass->implementsInterface(\WellCommerce\Bundle\LocaleBundle\Entity\LocaleAwareInterface::class)) {
$repository = $entityManager->getRepository($reflectionClass->getName());
$this->deleteTranslatableEntities($repository, $locale, $output);
}
}
$entityManager->remove($locale);
}