/**
  * Publishes URL aliases in all languages for the given parameters.
  *
  * @throws \Exception
  *
  * @param int|string $locationId
  * @param int|string $parentLocationId
  * @param int|string $contentId
  *
  * @return int
  */
 protected function publishAliases($locationId, $parentLocationId, $contentId)
 {
     $content = $this->contentService->loadContent($contentId);
     $urlAliasNames = $this->nameSchemaResolver->resolveUrlAliasSchema($content);
     foreach ($urlAliasNames as $languageCode => $name) {
         try {
             $this->setMigrationTable();
             $this->urlAliasHandler->publishUrlAliasForLocation($locationId, $parentLocationId, $name, $languageCode, $content->contentInfo->alwaysAvailable);
             $this->setDefaultTable();
         } catch (Exception $e) {
             $this->setDefaultTable();
             throw $e;
         }
     }
     return count($urlAliasNames);
 }