Internal: Remove MessageFeedback entity

pull/5846/head
Angel Fernando Quiroz Campos 11 months ago
parent 6e6d6bef22
commit 736e5d5872
No known key found for this signature in database
GPG Key ID: B284841AE3E562CD
  1. 9
      src/CoreBundle/Entity/Message.php
  2. 114
      src/CoreBundle/Entity/MessageFeedback.php
  3. 12
      src/CoreBundle/Migrations/Schema/V200/Version20230216122950.php
  4. 1
      src/CoreBundle/Repository/Node/UserRepository.php

@ -169,9 +169,6 @@ class Message
)] )]
protected Collection $attachments; protected Collection $attachments;
#[ORM\OneToMany(mappedBy: 'message', targetEntity: MessageFeedback::class, orphanRemoval: true)]
protected Collection $likes;
public function __construct() public function __construct()
{ {
$this->sendDate = new DateTime('now'); $this->sendDate = new DateTime('now');
@ -181,7 +178,6 @@ class Message
$this->attachments = new ArrayCollection(); $this->attachments = new ArrayCollection();
$this->children = new ArrayCollection(); $this->children = new ArrayCollection();
$this->receivers = new ArrayCollection(); $this->receivers = new ArrayCollection();
$this->likes = new ArrayCollection();
$this->votes = 0; $this->votes = 0;
$this->status = 0; $this->status = 0;
} }
@ -477,9 +473,4 @@ class Message
return $this; return $this;
} }
public function getLikes(): Collection
{
return $this->likes;
}
} }

@ -1,114 +0,0 @@
<?php
declare(strict_types=1);
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Entity;
use DateTime;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Table(
name: 'message_feedback'
)]
#[ORM\Index(
name: 'idx_message_feedback_uid_mid',
columns: ['message_id', 'user_id']
)]
#[ORM\Entity]
class MessageFeedback
{
#[ORM\Column(name: 'id', type: 'integer')]
#[ORM\Id()]
#[ORM\GeneratedValue()]
private int $id;
#[ORM\ManyToOne(targetEntity: Message::class, inversedBy: 'likes')]
#[ORM\JoinColumn(name: 'message_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')]
private Message $message;
#[ORM\ManyToOne(targetEntity: User::class)]
#[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', nullable: false, onDelete: 'CASCADE')]
private User $user;
#[ORM\Column(name: 'liked', type: 'boolean', options: ['default' => 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;
}
}

@ -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')) { if (!$schema->hasTable('portfolio_attachment')) {
$this->addSql( $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' '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'

@ -243,7 +243,6 @@ class UserRepository extends ResourceRepository implements PasswordUpgraderInter
['bundle' => 'CoreBundle', 'entity' => 'GradebookResultLog', 'field' => 'user', 'type' => 'object', 'action' => 'delete'], ['bundle' => 'CoreBundle', 'entity' => 'GradebookResultLog', 'field' => 'user', 'type' => 'object', 'action' => 'delete'],
['bundle' => 'CoreBundle', 'entity' => 'GradebookScoreLog', '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' => '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' => 'MessageRelUser', 'field' => 'receiver', 'type' => 'object', 'action' => 'delete'],
['bundle' => 'CoreBundle', 'entity' => 'MessageTag', 'field' => 'user', 'type' => 'object', 'action' => 'delete'], ['bundle' => 'CoreBundle', 'entity' => 'MessageTag', 'field' => 'user', 'type' => 'object', 'action' => 'delete'],
['bundle' => 'CoreBundle', 'entity' => 'Notification', 'field' => 'destUserId', 'type' => 'int', 'action' => 'delete'], ['bundle' => 'CoreBundle', 'entity' => 'Notification', 'field' => 'destUserId', 'type' => 'int', 'action' => 'delete'],

Loading…
Cancel
Save