if (!isset($articles[$articleNumber][$tmpLanguageId])) {
continue;
}
// Grab the first article - it doesnt matter which one.
$tmpArticle = $articles[$articleNumber][$tmpLanguageId];
// Copy all the translations requested.
$newArticles = $tmpArticle->copy($f_destination_publication_id, $f_destination_issue_number, $f_destination_section_number, $g_user->getUserId(), $languageArray);
// Set properties for each new copy.
foreach ($newArticles as $newArticle) {
// Set the name of the new copy
$newArticle->setTitle($articleNames[$articleNumber][$newArticle->getLanguageId()]);
// Set the default "comment enabled" status based
// on the publication config settings.
if ($f_destination_publication_id > 0) {
$tmpPub = new Publication($f_destination_publication_id);
$commentDefault = $tmpPub->commentsArticleDefaultEnabled();
$newArticle->setCommentsEnabled($commentDefault);
}
foreach ($events as $event) {
//$repo->add($timeSet, $articleId, 'schedule');
$newEvent = $ArticleDatetimeRepository->getEmpty();
$newEvent->setArticleId($newArticle->getArticleNumber());
$newEvent->setArticleType($event->getArticleType());
$newEvent->setStartDate($event->getStartDate());
$newEvent->setStartTime($event->getStartTime());
$newEvent->setEndDate($event->getEndDate());
$newEvent->setEndTime($event->getEndTime());
$newEvent->setRecurring($event->getRecurring());
$newEvent->setFieldName($event->getFieldName());
$em->persist($newEvent);
}