From 736e5d587250a7dee33c51b4ecd0453f4da8f15c Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos <1697880+AngelFQC@users.noreply.github.com> Date: Tue, 8 Oct 2024 22:01:42 -0500 Subject: [PATCH] Internal: Remove MessageFeedback entity --- src/CoreBundle/Entity/Message.php | 9 -- src/CoreBundle/Entity/MessageFeedback.php | 114 ------------------ .../Schema/V200/Version20230216122950.php | 12 -- .../Repository/Node/UserRepository.php | 1 - 4 files changed, 136 deletions(-) delete mode 100644 src/CoreBundle/Entity/MessageFeedback.php diff --git a/src/CoreBundle/Entity/Message.php b/src/CoreBundle/Entity/Message.php index 6eaf7b4551..e3536badf1 100644 --- a/src/CoreBundle/Entity/Message.php +++ b/src/CoreBundle/Entity/Message.php @@ -169,9 +169,6 @@ class Message )] protected Collection $attachments; - #[ORM\OneToMany(mappedBy: 'message', targetEntity: MessageFeedback::class, orphanRemoval: true)] - protected Collection $likes; - public function __construct() { $this->sendDate = new DateTime('now'); @@ -181,7 +178,6 @@ class Message $this->attachments = new ArrayCollection(); $this->children = new ArrayCollection(); $this->receivers = new ArrayCollection(); - $this->likes = new ArrayCollection(); $this->votes = 0; $this->status = 0; } @@ -477,9 +473,4 @@ class Message return $this; } - - public function getLikes(): Collection - { - return $this->likes; - } } diff --git a/src/CoreBundle/Entity/MessageFeedback.php b/src/CoreBundle/Entity/MessageFeedback.php deleted file mode 100644 index ab449757b5..0000000000 --- a/src/CoreBundle/Entity/MessageFeedback.php +++ /dev/null @@ -1,114 +0,0 @@ - false])] - private bool $liked = false; - - #[ORM\Column(name: 'disliked', type: 'boolean', options: ['default' => false])] - private bool $disliked = false; - - #[ORM\Column(name: 'updated_at', type: 'datetime', nullable: false)] - private DateTime $updatedAt; - - public function getId(): int - { - return $this->id; - } - - public function setId(int $id): self - { - $this->id = $id; - - return $this; - } - - public function getMessage(): Message - { - return $this->message; - } - - public function setMessage(Message $message): self - { - $this->message = $message; - - return $this; - } - - public function getUser(): User - { - return $this->user; - } - - public function setUser(User $user): self - { - $this->user = $user; - - return $this; - } - - public function isLiked(): bool - { - return $this->liked; - } - - public function setLiked(bool $liked): self - { - $this->liked = $liked; - - return $this; - } - - public function isDisliked(): bool - { - return $this->disliked; - } - - public function setDisliked(bool $disliked): self - { - $this->disliked = $disliked; - - return $this; - } - - public function getUpdatedAt(): DateTime - { - return $this->updatedAt; - } - - public function setUpdatedAt(DateTime $updatedAt): self - { - $this->updatedAt = $updatedAt; - - return $this; - } -} diff --git a/src/CoreBundle/Migrations/Schema/V200/Version20230216122950.php b/src/CoreBundle/Migrations/Schema/V200/Version20230216122950.php index 2f3bb10a5c..445c79fbf4 100644 --- a/src/CoreBundle/Migrations/Schema/V200/Version20230216122950.php +++ b/src/CoreBundle/Migrations/Schema/V200/Version20230216122950.php @@ -60,18 +60,6 @@ final class Version20230216122950 extends AbstractMigrationChamilo } } - if (!$schema->hasTable('message_feedback')) { - $this->addSql( - 'CREATE TABLE message_feedback (id INT AUTO_INCREMENT NOT NULL, message_id INT NOT NULL, user_id INT NOT NULL, liked TINYINT(1) DEFAULT 0 NOT NULL, disliked TINYINT(1) DEFAULT 0 NOT NULL, updated_at DATETIME NOT NULL COMMENT "(DC2Type:datetime)", INDEX IDX_DB0F8049537A1329 (message_id), INDEX IDX_DB0F8049A76ED395 (user_id), INDEX idx_message_feedback_uid_mid (message_id, user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC' - ); - $this->addSql( - 'ALTER TABLE message_feedback ADD CONSTRAINT FK_DB0F8049537A1329 FOREIGN KEY (message_id) REFERENCES message (id) ON DELETE CASCADE' - ); - $this->addSql( - 'ALTER TABLE message_feedback ADD CONSTRAINT FK_DB0F8049A76ED395 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE' - ); - } - if (!$schema->hasTable('portfolio_attachment')) { $this->addSql( 'CREATE TABLE portfolio_attachment (id INT AUTO_INCREMENT NOT NULL, path VARCHAR(255) NOT NULL, comment LONGTEXT DEFAULT NULL, size INT NOT NULL, filename VARCHAR(255) NOT NULL, origin_id INT NOT NULL, origin_type INT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC' diff --git a/src/CoreBundle/Repository/Node/UserRepository.php b/src/CoreBundle/Repository/Node/UserRepository.php index 4acffb072c..50d0cf5625 100644 --- a/src/CoreBundle/Repository/Node/UserRepository.php +++ b/src/CoreBundle/Repository/Node/UserRepository.php @@ -243,7 +243,6 @@ class UserRepository extends ResourceRepository implements PasswordUpgraderInter ['bundle' => 'CoreBundle', 'entity' => 'GradebookResultLog', 'field' => 'user', 'type' => 'object', 'action' => 'delete'], ['bundle' => 'CoreBundle', 'entity' => 'GradebookScoreLog', 'field' => 'user', 'type' => 'object', 'action' => 'delete'], ['bundle' => 'CoreBundle', 'entity' => 'Message', 'field' => 'sender', 'type' => 'object', 'action' => 'convert'], - ['bundle' => 'CoreBundle', 'entity' => 'MessageFeedback', 'field' => 'user', 'type' => 'object', 'action' => 'convert'], ['bundle' => 'CoreBundle', 'entity' => 'MessageRelUser', 'field' => 'receiver', 'type' => 'object', 'action' => 'delete'], ['bundle' => 'CoreBundle', 'entity' => 'MessageTag', 'field' => 'user', 'type' => 'object', 'action' => 'delete'], ['bundle' => 'CoreBundle', 'entity' => 'Notification', 'field' => 'destUserId', 'type' => 'int', 'action' => 'delete'],