Skip to content
This repository has been archived by the owner on Dec 14, 2021. It is now read-only.

Commit

Permalink
Merge pull request #1647 from ojs/hotfix/author-removal
Browse files Browse the repository at this point in the history
Make sure deleted authors are actually deleted
  • Loading branch information
behram authored Nov 13, 2016
2 parents b16cb6a + 184d2fa commit 3e5f01d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Ojs/JournalBundle/Controller/ArticleSubmissionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,13 @@ public function editAction(Request $request, $id)
);
$this->throw404IfNotFound($article);

$originalAuthors = new ArrayCollection();
$originalFiles = new ArrayCollection();

foreach ($article->getArticleAuthors() as $author) {
$originalAuthors->add($author);
}

foreach ($article->getArticleFiles() as $file) {
$originalFiles->add($file);
}
Expand All @@ -418,6 +423,12 @@ public function editAction(Request $request, $id)
$i++;
}

foreach ($originalAuthors as $author) {
if ($article->getArticleAuthors()->contains($author) === false) {
$em->remove($author);
}
}

foreach ($originalFiles as $file) {
if ($article->getArticleFiles()->contains($file) === false) {
$em->remove($file);
Expand Down

0 comments on commit 3e5f01d

Please sign in to comment.