Skip to content

Commit

Permalink
Merge pull request concretecms#11831 from bikerdave/delete-user-Annou…
Browse files Browse the repository at this point in the history
…ncementUserViews

Delete AnnouncementUserView entities when deleting User entities
  • Loading branch information
aembler authored Dec 7, 2023
2 parents a129be0 + b493b6f commit 4075c46
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
2 changes: 1 addition & 1 deletion concrete/config/concrete.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/
'version' => '9.2.3',
'version_installed' => '9.2.3',
'version_db' => '20231002142400', // the key of the latest database migration
'version_db' => '20231207100748', // the key of the latest database migration

/*
* Installation status
Expand Down
2 changes: 1 addition & 1 deletion concrete/src/Entity/Announcement/AnnouncementUserView.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class AnnouncementUserView
/**
* @ORM\Id
* @ORM\ManyToOne(targetEntity="Concrete\Core\Entity\User\User")
* @ORM\JoinColumn(name="uID", referencedColumnName="uID")
* @ORM\JoinColumn(name="uID", referencedColumnName="uID", onDelete="CASCADE")
*/
protected $user;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

declare(strict_types=1);

namespace Concrete\Core\Updater\Migrations\Migrations;

use Concrete\Core\Entity\Announcement\AnnouncementUserView;
use Concrete\Core\Updater\Migrations\AbstractMigration;
use Concrete\Core\Updater\Migrations\RepeatableMigrationInterface;

final class Version20231207100748 extends AbstractMigration implements RepeatableMigrationInterface
{
/**
* {@inheritdoc}
*
* @see \Concrete\Core\Updater\Migrations\AbstractMigration::upgradeDatabase()
*/
public function upgradeDatabase()
{
$this->refreshEntities([
// Fix deleting rows in UserFavoriteFolders table when deleting a user.
AnnouncementUserView::class,
]);
}
}

0 comments on commit 4075c46

Please sign in to comment.