Skip to content

Commit

Permalink
Delete FavoriteFolder entities when deleting User entities
Browse files Browse the repository at this point in the history
  • Loading branch information
mlocati committed Oct 2, 2023
1 parent e72536a commit 7a6f4ff
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.2a1',
'version_installed' => '9.2.2a1',
'version_db' => '20230812015937', // the key of the latest database migration
'version_db' => '20231002142400', // the key of the latest database migration

/*
* Installation status
Expand Down
2 changes: 1 addition & 1 deletion concrete/src/Entity/File/Folder/FavoriteFolder.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class FavoriteFolder
* @var User
* @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 $owner = null;

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\File\Folder\FavoriteFolder;
use Concrete\Core\Updater\Migrations\AbstractMigration;
use Concrete\Core\Updater\Migrations\RepeatableMigrationInterface;

final class Version20231002142400 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.
FavoriteFolder::class,
]);
}
}

0 comments on commit 7a6f4ff

Please sign in to comment.