Skip to content

Commit

Permalink
pkp#10060 Fixed removal of announcements
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasraoni committed Jun 15, 2024
1 parent 067db41 commit 16db0e4
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions classes/announcement/AnnouncementTypeDAO.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,18 +156,15 @@ public function deleteObject($announcementType)
}

/**
* Delete an announcement type by announcement type ID. Note that all announcements with
* this type ID are also deleted.
*
* @param int $typeId
* Delete an announcement type by announcement type ID. Note that all announcements with this type ID are also deleted.
*/
public function deleteById($typeId)
public function deleteById(int $typeId): void
{
$this->update('DELETE FROM announcement_type_settings WHERE type_id = ?', [(int) $typeId]);
$this->update('DELETE FROM announcement_types WHERE type_id = ?', [(int) $typeId]);

$collector = Repo::announcement()->getCollector()->filterByTypeIds([(int) $typeId]);
$collector = Repo::announcement()->getCollector()->filterByTypeIds([$typeId]);
Repo::announcement()->deleteMany($collector);
DB::table('announcement_types')
->where('type_id', '=', $typeId)
->delete();
}

/**
Expand Down

0 comments on commit 16db0e4

Please sign in to comment.