Internal: Identified and handled obsolete tables, added LTI and blog entities, created necessary migrations - refs BT#20968

pull/5720/head
christianbeeznst 1 year ago
parent 1e7fc158bf
commit a404f43443
  1. 118
      src/CoreBundle/Entity/Block.php
  2. 55
      src/CoreBundle/Migrations/Schema/V200/Version20240811221500.php
  3. 79
      src/CoreBundle/Migrations/Schema/V200/Version20240811221600.php
  4. 186
      src/CoreBundle/Migrations/Schema/V200/Version20240811221700.php
  5. 193
      src/CoreBundle/Migrations/Schema/V200/Version20240811221800.php
  6. 150
      src/CoreBundle/Migrations/Schema/V200/Version20240811221900.php
  7. 130
      src/CourseBundle/Entity/CBlog.php
  8. 100
      src/CourseBundle/Entity/CBlogAttachment.php
  9. 117
      src/CourseBundle/Entity/CBlogComment.php
  10. 102
      src/CourseBundle/Entity/CBlogPost.php
  11. 78
      src/CourseBundle/Entity/CBlogRating.php
  12. 48
      src/CourseBundle/Entity/CBlogRelUser.php
  13. 115
      src/CourseBundle/Entity/CBlogTask.php
  14. 79
      src/CourseBundle/Entity/CBlogTaskRelUser.php

@ -0,0 +1,118 @@
<?php
declare(strict_types=1);
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Entity;
use Chamilo\CoreBundle\Traits\UserTrait;
use Doctrine\ORM\Mapping as ORM;
/**
* Block entity.
*/
#[ORM\Table(name: 'block')]
#[ORM\Entity]
class Block
{
use UserTrait;
#[ORM\Column(name: 'id', type: 'integer')]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
protected ?int $id = null;
#[ORM\Column(name: 'title', type: 'string', length: 255, nullable: true)]
protected ?string $title = null;
#[ORM\Column(name: 'description', type: 'text', nullable: true)]
protected ?string $description = null;
#[ORM\Column(name: 'path', type: 'string', length: 190, nullable: false)]
protected string $path;
#[ORM\Column(name: 'controller', type: 'string', length: 100, nullable: false)]
protected string $controller;
#[ORM\Column(name: 'active', type: 'boolean', nullable: false)]
protected bool $active;
#[ORM\OneToOne(inversedBy: 'block', targetEntity: User::class)]
#[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', onDelete: 'CASCADE')]
protected User $user;
/**
* Get id.
*/
public function getId(): ?int
{
return $this->id;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(?string $title): self
{
$this->title = $title;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getPath(): string
{
return $this->path;
}
public function setPath(string $path): self
{
$this->path = $path;
return $this;
}
public function getController(): string
{
return $this->controller;
}
public function setController(string $controller): self
{
$this->controller = $controller;
return $this;
}
public function isActive(): bool
{
return $this->active;
}
public function setActive(bool $active): self
{
$this->active = $active;
return $this;
}
public function getUser(): User
{
return $this->user;
}
public function setUser(User $user): self
{
$this->user = $user;
return $this;
}
}

@ -0,0 +1,55 @@
<?php
declare(strict_types=1);
namespace Chamilo\CoreBundle\Migrations\Schema\V200;
use Doctrine\DBAL\Schema\Schema;
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
final class Version20240811221500 extends AbstractMigrationChamilo
{
public function getDescription(): string
{
return 'Migration to drop unnecessary foreign keys and adjust table structure for data consistency.';
}
public function up(Schema $schema): void
{
// Disable foreign key checks to prevent issues during migration
$this->addSql('SET FOREIGN_KEY_CHECKS = 0;');
// Drop foreign keys from the specified tables
$this->addSql('ALTER TABLE page__snapshot DROP FOREIGN KEY IF EXISTS FK_3963EF9AC4663E4;');
$this->addSql('ALTER TABLE page__snapshot DROP FOREIGN KEY IF EXISTS FK_3963EF9AF6BD1646;');
$this->addSql('ALTER TABLE classification__collection DROP FOREIGN KEY IF EXISTS FK_A406B56AE25D857E;');
$this->addSql('ALTER TABLE classification__collection DROP FOREIGN KEY IF EXISTS FK_A406B56AEA9FDD75;');
$this->addSql('ALTER TABLE faq_question DROP FOREIGN KEY IF EXISTS FK_4A55B05912469DE2;');
$this->addSql('ALTER TABLE page__page DROP FOREIGN KEY IF EXISTS FK_2FAE39ED727ACA70;');
$this->addSql('ALTER TABLE page__page DROP FOREIGN KEY IF EXISTS FK_2FAE39EDF6BD1646;');
$this->addSql('ALTER TABLE page__page DROP FOREIGN KEY IF EXISTS FK_2FAE39ED158E0B66;');
$this->addSql('ALTER TABLE page__bloc DROP FOREIGN KEY IF EXISTS FK_FCDC1A97727ACA70;');
$this->addSql('ALTER TABLE page__bloc DROP FOREIGN KEY IF EXISTS FK_FCDC1A97C4663E4;');
$this->addSql('ALTER TABLE timeline__timeline DROP FOREIGN KEY IF EXISTS FK_FFBC6AD523EDC87;');
$this->addSql('ALTER TABLE timeline__timeline DROP FOREIGN KEY IF EXISTS FK_FFBC6AD59D32F035;');
$this->addSql('ALTER TABLE plugin_bbb_room DROP FOREIGN KEY IF EXISTS plugin_bbb_room_ibfk_2;');
$this->addSql('ALTER TABLE plugin_bbb_room DROP FOREIGN KEY IF EXISTS plugin_bbb_room_ibfk_1;');
$this->addSql('ALTER TABLE classification__category DROP FOREIGN KEY IF EXISTS FK_43629B36727ACA70;');
$this->addSql('ALTER TABLE classification__category DROP FOREIGN KEY IF EXISTS FK_43629B36E25D857E;');
$this->addSql('ALTER TABLE classification__category DROP FOREIGN KEY IF EXISTS FK_43629B36EA9FDD75;');
$this->addSql('ALTER TABLE faq_question_translation DROP FOREIGN KEY IF EXISTS FK_C2D1A2C2AC5D3;');
$this->addSql('ALTER TABLE classification__tag DROP FOREIGN KEY IF EXISTS FK_CA57A1C7E25D857E;');
$this->addSql('ALTER TABLE faq_category_translation DROP FOREIGN KEY IF EXISTS FK_5493B0FC2C2AC5D3;');
$this->addSql('ALTER TABLE timeline__action_component DROP FOREIGN KEY IF EXISTS FK_6ACD1B16E2ABAFFF;');
$this->addSql('ALTER TABLE timeline__action_component DROP FOREIGN KEY IF EXISTS FK_6ACD1B169D32F035;');
$this->addSql('ALTER TABLE media__media DROP FOREIGN KEY IF EXISTS FK_5C6DD74E12469DE2;');
$this->addSql('ALTER TABLE contact_category_translation DROP FOREIGN KEY IF EXISTS FK_3E770F302C2AC5D3;');
$this->addSql('ALTER TABLE media__gallery_media DROP FOREIGN KEY IF EXISTS FK_80D4C541EA9FDD75;');
$this->addSql('ALTER TABLE media__gallery_media DROP FOREIGN KEY IF EXISTS FK_80D4C5414E7AF8F;');
$this->addSql('ALTER TABLE c_blog DROP FOREIGN KEY IF EXISTS FK_64B00A121BAD783F;');
// Re-enable foreign key checks
$this->addSql('SET FOREIGN_KEY_CHECKS = 1;');
}
public function down(Schema $schema): void {}
}

@ -0,0 +1,79 @@
<?php
declare(strict_types=1);
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Migrations\Schema\V200;
use Doctrine\DBAL\Schema\Schema;
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
final class Version20240811221600 extends AbstractMigrationChamilo
{
public function getDescription(): string
{
return 'Migration to drop unused tables and ensure schema consistency.';
}
public function up(Schema $schema): void
{
// Disable foreign key checks to prevent issues during migration
$this->addSql('SET FOREIGN_KEY_CHECKS = 0;');
// Drop tables if they exist
$tablesToDrop = [
'page__snapshot',
'class_item',
'classification__collection',
'c_userinfo_def',
'class_user',
'faq_question',
'timeline__component',
'page__page',
'c_online_connected',
'c_permission_task',
'page__bloc',
'c_online_link',
'c_permission_user',
'c_role_user',
'c_role',
'page__site',
'shared_survey',
'media__gallery',
'faq_category',
'classification__context',
'timeline__timeline',
'classification__category',
'faq_question_translation',
'c_userinfo_content',
'contact_category',
'classification__tag',
'faq_category_translation',
'timeline__action_component',
'media__media',
'c_role_permissions',
'shared_survey_question_option',
'shared_survey_question',
'timeline__action',
'contact_category_translation',
'media__gallery_media',
'c_item_property',
'c_survey_group',
'c_permission_group',
'c_role_group',
'track_e_open'
];
foreach ($tablesToDrop as $table) {
// Check if the table exists before attempting to drop it
if ($schema->hasTable($table)) {
$this->addSql("DROP TABLE $table;");
}
}
// Re-enable foreign key checks
$this->addSql('SET FOREIGN_KEY_CHECKS = 1;');
}
public function down(Schema $schema): void {}
}

@ -0,0 +1,186 @@
<?php
declare(strict_types=1);
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Migrations\Schema\V200;
use Doctrine\DBAL\Schema\Schema;
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
final class Version20240811221700 extends AbstractMigrationChamilo
{
public function getDescription(): string
{
return 'Migration to create LTI-related tables and establish foreign key relationships, including lti_token, lti_lineitem, lti_platform, and their relations.';
}
public function up(Schema $schema): void
{
if (!$schema->hasTable('lti_external_tool')) {
$this->addSql('
CREATE TABLE lti_external_tool (
id INT AUTO_INCREMENT NOT NULL,
resource_node_id INT DEFAULT NULL,
c_id INT DEFAULT NULL,
gradebook_eval_id INT DEFAULT NULL,
parent_id INT DEFAULT NULL,
title VARCHAR(255) NOT NULL,
description LONGTEXT DEFAULT NULL,
launch_url VARCHAR(255) NOT NULL,
consumer_key VARCHAR(255) DEFAULT NULL,
shared_secret VARCHAR(255) DEFAULT NULL,
custom_params LONGTEXT DEFAULT NULL,
active_deep_linking TINYINT(1) DEFAULT 0 NOT NULL,
privacy LONGTEXT DEFAULT NULL,
client_id VARCHAR(255) DEFAULT NULL,
login_url VARCHAR(255) DEFAULT NULL,
redirect_url VARCHAR(255) DEFAULT NULL,
advantage_services LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:json)\',
version VARCHAR(255) DEFAULT \'lti1p1\' NOT NULL,
launch_presentation LONGTEXT NOT NULL COMMENT \'(DC2Type:json)\',
replacement_params LONGTEXT NOT NULL COMMENT \'(DC2Type:json)\',
UNIQUE INDEX UNIQ_DB0E04E41BAD783F (resource_node_id),
INDEX IDX_DB0E04E491D79BD3 (c_id),
INDEX IDX_DB0E04E482F80D8B (gradebook_eval_id),
INDEX IDX_DB0E04E4727ACA70 (parent_id),
PRIMARY KEY(id)
) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC;
');
}
$this->addSql('
CREATE TABLE IF NOT EXISTS lti_token (
id INT AUTO_INCREMENT NOT NULL,
tool_id INT DEFAULT NULL,
scope LONGTEXT NOT NULL COMMENT \'(DC2Type:json)\',
hash VARCHAR(255) NOT NULL,
created_at INT NOT NULL,
expires_at INT NOT NULL,
INDEX IDX_EA71C468F7B22CC (tool_id),
PRIMARY KEY(id)
) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC;
');
$this->addSql('
CREATE TABLE IF NOT EXISTS lti_lineitem (
id INT AUTO_INCREMENT NOT NULL,
tool_id INT NOT NULL,
evaluation INT NOT NULL,
resource_id VARCHAR(255) DEFAULT NULL,
tag VARCHAR(255) DEFAULT NULL,
start_date DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime)\',
end_date DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime)\',
INDEX IDX_5C76B75D8F7B22CC (tool_id),
UNIQUE INDEX UNIQ_5C76B75D1323A575 (evaluation),
PRIMARY KEY(id)
) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC;
');
$this->addSql('
CREATE TABLE IF NOT EXISTS lti_platform (
id INT AUTO_INCREMENT NOT NULL,
public_key LONGTEXT NOT NULL,
kid VARCHAR(255) NOT NULL,
private_key LONGTEXT NOT NULL,
PRIMARY KEY(id)
) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC;
');
if ($schema->hasTable('lti_external_tool')) {
if (!$schema->getTable('lti_external_tool')->hasForeignKey('FK_DB0E04E41BAD783F')) {
$this->addSql('
ALTER TABLE lti_external_tool
ADD CONSTRAINT FK_DB0E04E41BAD783F FOREIGN KEY (resource_node_id)
REFERENCES resource_node (id) ON DELETE CASCADE;
');
$this->addSql('
CREATE UNIQUE INDEX UNIQ_DB0E04E41BAD783F ON lti_external_tool (resource_node_id);
');
}
if (!$schema->getTable('lti_external_tool')->hasForeignKey('FK_DB0E04E491D79BD3')) {
$this->addSql('
ALTER TABLE lti_external_tool
ADD CONSTRAINT FK_DB0E04E491D79BD3 FOREIGN KEY (c_id)
REFERENCES course (id);
');
}
if (!$schema->getTable('lti_external_tool')->hasForeignKey('FK_DB0E04E482F80D8B')) {
$this->addSql('
ALTER TABLE lti_external_tool
ADD CONSTRAINT FK_DB0E04E482F80D8B FOREIGN KEY (gradebook_eval_id)
REFERENCES gradebook_evaluation (id) ON DELETE SET NULL;
');
}
if (!$schema->getTable('lti_external_tool')->hasForeignKey('FK_DB0E04E4727ACA70')) {
$this->addSql('
ALTER TABLE lti_external_tool
ADD CONSTRAINT FK_DB0E04E4727ACA70 FOREIGN KEY (parent_id)
REFERENCES lti_external_tool (id);
');
}
}
if ($schema->hasTable('lti_token') && !$schema->getTable('lti_token')->hasForeignKey('FK_EA71C468F7B22CC')) {
$this->addSql('
ALTER TABLE lti_token
ADD CONSTRAINT FK_EA71C468F7B22CC FOREIGN KEY (tool_id)
REFERENCES lti_external_tool (id) ON DELETE CASCADE;
');
}
if ($schema->hasTable('lti_lineitem') && !$schema->getTable('lti_lineitem')->hasForeignKey('FK_5C76B75D8F7B22CC')) {
$this->addSql('
ALTER TABLE lti_lineitem
ADD CONSTRAINT FK_5C76B75D8F7B22CC FOREIGN KEY (tool_id)
REFERENCES lti_external_tool (id) ON DELETE CASCADE;
');
}
if ($schema->hasTable('lti_lineitem') && !$schema->getTable('lti_lineitem')->hasForeignKey('FK_5C76B75D1323A575')) {
$this->addSql('
ALTER TABLE lti_lineitem
ADD CONSTRAINT FK_5C76B75D1323A575 FOREIGN KEY (evaluation)
REFERENCES gradebook_evaluation (id) ON DELETE CASCADE;
');
}
$this->addSql('SET FOREIGN_KEY_CHECKS = 1;');
}
public function down(Schema $schema): void
{
$columnsToAdd = [
'resource_node_id' => 'INT DEFAULT NULL',
'c_id' => 'INT DEFAULT NULL',
'gradebook_eval_id' => 'INT DEFAULT NULL',
'parent_id' => 'INT DEFAULT NULL',
'client_id' => 'VARCHAR(255) DEFAULT NULL',
'login_url' => 'VARCHAR(255) DEFAULT NULL',
'redirect_url' => 'VARCHAR(255) DEFAULT NULL',
'advantage_services' => 'LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:json)\'',
'version' => 'VARCHAR(255) DEFAULT \'lti1p1\' NOT NULL',
'launch_presentation' => 'LONGTEXT NOT NULL COMMENT \'(DC2Type:json)\'',
'replacement_params' => 'LONGTEXT NOT NULL COMMENT \'(DC2Type:json)\'',
];
$this->addSql('ALTER TABLE lti_token DROP FOREIGN KEY IF EXISTS FK_EA71C468F7B22CC;');
$this->addSql('ALTER TABLE lti_lineitem DROP FOREIGN KEY IF EXISTS FK_5C76B75D8F7B22CC;');
$this->addSql('ALTER TABLE lti_lineitem DROP FOREIGN KEY IF EXISTS FK_5C76B75D1323A575;');
$this->addSql('ALTER TABLE lti_external_tool DROP FOREIGN KEY IF EXISTS FK_DB0E04E41BAD783F;');
$this->addSql('ALTER TABLE lti_external_tool DROP FOREIGN KEY IF EXISTS FK_DB0E04E491D79BD3;');
$this->addSql('ALTER TABLE lti_external_tool DROP FOREIGN KEY IF EXISTS FK_DB0E04E482F80D8B;');
$this->addSql('ALTER TABLE lti_external_tool DROP FOREIGN KEY IF EXISTS FK_DB0E04E4727ACA70;');
foreach (array_keys($columnsToAdd) as $column) {
$this->addSql(sprintf('ALTER TABLE lti_external_tool DROP COLUMN IF EXISTS %s;', $column));
}
}
}

@ -0,0 +1,193 @@
<?php
declare(strict_types=1);
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Migrations\Schema\V200;
use Doctrine\DBAL\Schema\Schema;
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
final class Version20240811221800 extends AbstractMigrationChamilo
{
public function getDescription(): string
{
return 'Migration for creating new tables corresponding to the entities c_blog, c_blog_attachment, c_blog_comment, c_blog_post, c_blog_rating, c_blog_rel_user, c_blog_task, c_blog_task_rel_user, and block.';
}
public function up(Schema $schema): void
{
// Create block table
if (!$schema->hasTable('block')) {
$this->addSql('
CREATE TABLE block (
id INT AUTO_INCREMENT NOT NULL,
title VARCHAR(255) DEFAULT NULL,
description LONGTEXT DEFAULT NULL,
path VARCHAR(190) NOT NULL,
controller VARCHAR(100) NOT NULL,
active TINYINT(1) NOT NULL,
user_id INT DEFAULT NULL,
PRIMARY KEY(id),
UNIQUE KEY path (path),
CONSTRAINT FK_831B9722A76ED395 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE
) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC;
');
}
// Create c_blog table
if (!$schema->hasTable('c_blog')) {
$this->addSql('
CREATE TABLE c_blog (
iid INT AUTO_INCREMENT NOT NULL,
resource_node_id INT DEFAULT NULL,
title LONGTEXT NOT NULL,
blog_subtitle VARCHAR(250) DEFAULT NULL,
date_creation DATETIME NOT NULL,
PRIMARY KEY(iid),
UNIQUE INDEX UNIQ_64B00A121BAD783F (resource_node_id),
CONSTRAINT FK_64B00A121BAD783F FOREIGN KEY (resource_node_id) REFERENCES resource_node (id) ON DELETE CASCADE
) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC;
');
}
// Create c_blog_attachment table
if (!$schema->hasTable('c_blog_attachment')) {
$this->addSql('
CREATE TABLE c_blog_attachment (
iid INT AUTO_INCREMENT NOT NULL,
path VARCHAR(255) NOT NULL,
comment LONGTEXT DEFAULT NULL,
size INT NOT NULL,
blog_id INT DEFAULT NULL,
filename VARCHAR(255) NOT NULL,
PRIMARY KEY(iid),
INDEX IDX_E769AADCDAE07E97 (blog_id),
CONSTRAINT FK_E769AADCDAE07E97 FOREIGN KEY (blog_id) REFERENCES c_blog (iid) ON DELETE CASCADE
) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC;
');
}
// Create c_blog_comment table
if (!$schema->hasTable('c_blog_comment')) {
$this->addSql('
CREATE TABLE c_blog_comment (
iid INT AUTO_INCREMENT NOT NULL,
title VARCHAR(250) NOT NULL,
comment LONGTEXT NOT NULL,
author_id INT DEFAULT NULL,
date_creation DATETIME NOT NULL,
blog_id INT DEFAULT NULL,
PRIMARY KEY(iid),
INDEX IDX_CAA18F1F675F31B (author_id),
INDEX IDX_CAA18F1DAE07E97 (blog_id),
CONSTRAINT FK_CAA18F1F675F31B FOREIGN KEY (author_id) REFERENCES user (id) ON DELETE CASCADE,
CONSTRAINT FK_CAA18F1DAE07E97 FOREIGN KEY (blog_id) REFERENCES c_blog (iid) ON DELETE CASCADE
) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC;
');
}
// Create c_blog_post table
if (!$schema->hasTable('c_blog_post')) {
$this->addSql('
CREATE TABLE c_blog_post (
iid INT AUTO_INCREMENT NOT NULL,
title VARCHAR(250) NOT NULL,
full_text LONGTEXT NOT NULL,
date_creation DATETIME NOT NULL,
author_id INT DEFAULT NULL,
blog_id INT DEFAULT NULL,
PRIMARY KEY(iid),
INDEX IDX_B6FD68A3F675F31B (author_id),
INDEX IDX_B6FD68A3DAE07E97 (blog_id),
CONSTRAINT FK_B6FD68A3F675F31B FOREIGN KEY (author_id) REFERENCES user (id) ON DELETE CASCADE,
CONSTRAINT FK_B6FD68A3DAE07E97 FOREIGN KEY (blog_id) REFERENCES c_blog (iid) ON DELETE CASCADE
) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC;
');
}
// Create c_blog_rating table
if (!$schema->hasTable('c_blog_rating')) {
$this->addSql('
CREATE TABLE c_blog_rating (
iid INT AUTO_INCREMENT NOT NULL,
rating_type VARCHAR(40) NOT NULL,
user_id INT DEFAULT NULL,
blog_id INT DEFAULT NULL,
rating INT NOT NULL,
PRIMARY KEY(iid),
INDEX IDX_D4E30760DAE07E97 (blog_id),
INDEX IDX_D4E30760A76ED395 (user_id),
CONSTRAINT FK_D4E30760DAE07E97 FOREIGN KEY (blog_id) REFERENCES c_blog (iid) ON DELETE CASCADE,
CONSTRAINT FK_D4E30760A76ED395 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE
) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC;
');
}
// Create c_blog_rel_user table
if (!$schema->hasTable('c_blog_rel_user')) {
$this->addSql('
CREATE TABLE c_blog_rel_user (
iid INT AUTO_INCREMENT NOT NULL,
user_id INT DEFAULT NULL,
blog_id INT DEFAULT NULL,
PRIMARY KEY(iid),
INDEX IDX_B55D851BDAE07E97 (blog_id),
INDEX IDX_B55D851BA76ED395 (user_id),
CONSTRAINT FK_B55D851BDAE07E97 FOREIGN KEY (blog_id) REFERENCES c_blog (iid) ON DELETE CASCADE,
CONSTRAINT FK_B55D851BA76ED395 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE
) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC;
');
}
// Create c_blog_task table
if (!$schema->hasTable('c_blog_task')) {
$this->addSql('
CREATE TABLE c_blog_task (
iid INT AUTO_INCREMENT NOT NULL,
title VARCHAR(250) NOT NULL,
description LONGTEXT NOT NULL,
color VARCHAR(10) NOT NULL,
blog_id INT DEFAULT NULL,
PRIMARY KEY(iid),
INDEX IDX_BE09DF0BDAE07E97 (blog_id),
CONSTRAINT FK_BE09DF0BDAE07E97 FOREIGN KEY (blog_id) REFERENCES c_blog (iid) ON DELETE CASCADE
) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC;
');
}
// Create c_blog_task_rel_user table
if (!$schema->hasTable('c_blog_task_rel_user')) {
$this->addSql('
CREATE TABLE c_blog_task_rel_user (
iid INT AUTO_INCREMENT NOT NULL,
user_id INT DEFAULT NULL,
blog_id INT DEFAULT NULL,
task_id INT DEFAULT NULL,
target_date DATE NOT NULL,
PRIMARY KEY(iid),
INDEX IDX_FD8B3C73DAE07E97 (blog_id),
INDEX IDX_FD8B3C738DB60186 (task_id),
INDEX IDX_FD8B3C73A76ED395 (user_id),
CONSTRAINT FK_FD8B3C73DAE07E97 FOREIGN KEY (blog_id) REFERENCES c_blog (iid) ON DELETE CASCADE,
CONSTRAINT FK_FD8B3C738DB60186 FOREIGN KEY (task_id) REFERENCES c_blog_task (iid) ON DELETE CASCADE,
CONSTRAINT FK_FD8B3C73A76ED395 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE
) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC;
');
}
}
public function down(Schema $schema): void
{
$this->addSql('DROP TABLE IF EXISTS block;');
$this->addSql('DROP TABLE IF EXISTS c_blog_attachment;');
$this->addSql('DROP TABLE IF EXISTS c_blog_comment;');
$this->addSql('DROP TABLE IF EXISTS c_blog_post;');
$this->addSql('DROP TABLE IF EXISTS c_blog_rating;');
$this->addSql('DROP TABLE IF EXISTS c_blog_rel_user;');
$this->addSql('DROP TABLE IF EXISTS c_blog_task_rel_user;');
$this->addSql('DROP TABLE IF EXISTS c_blog_task;');
$this->addSql('DROP TABLE IF EXISTS c_blog;');
}
}

@ -0,0 +1,150 @@
<?php
declare(strict_types=1);
/* For licensing terms, see /license.txt */
namespace Chamilo\CoreBundle\Migrations\Schema\V200;
use Doctrine\DBAL\Schema\Schema;
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
final class Version20240811221900 extends AbstractMigrationChamilo
{
public function getDescription(): string
{
return 'Migration for modifying existing tables: block, c_blog, c_blog_attachment, c_blog_comment, c_blog_post, c_blog_rating, c_blog_rel_user, c_blog_task, and c_blog_task_rel_user.';
}
public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE block ADD user_id INT DEFAULT NULL;');
$this->addSql('ALTER TABLE block ADD CONSTRAINT FK_831B9722A76ED395 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE;');
$this->addSql('CREATE UNIQUE INDEX UNIQ_831B9722A76ED395 ON block (user_id);');
$this->addSql('DROP INDEX course ON c_blog_attachment;');
$this->addSql('ALTER TABLE c_blog_attachment DROP id, DROP c_id, DROP post_id, DROP comment_id, CHANGE blog_id blog_id INT DEFAULT NULL;');
$this->addSql('ALTER TABLE c_blog_attachment ADD CONSTRAINT FK_E769AADCDAE07E97 FOREIGN KEY (blog_id) REFERENCES c_blog (iid) ON DELETE CASCADE;');
$this->addSql('CREATE INDEX IDX_E769AADCDAE07E97 ON c_blog_attachment (blog_id);');
$this->addSql('DROP INDEX course ON c_blog_rating;');
$this->addSql('ALTER TABLE c_blog_rating DROP rating_id, DROP c_id, DROP item_id, CHANGE blog_id blog_id INT DEFAULT NULL, CHANGE user_id user_id INT DEFAULT NULL;');
$this->addSql('ALTER TABLE c_blog_rating ADD CONSTRAINT FK_D4E30760DAE07E97 FOREIGN KEY (blog_id) REFERENCES c_blog (iid) ON DELETE CASCADE;');
$this->addSql('ALTER TABLE c_blog_rating ADD CONSTRAINT FK_D4E30760A76ED395 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE;');
$this->addSql('CREATE INDEX IDX_D4E30760DAE07E97 ON c_blog_rating (blog_id);');
$this->addSql('CREATE INDEX IDX_D4E30760A76ED395 ON c_blog_rating (user_id);');
$this->addSql('DROP INDEX course ON c_blog_post;');
$this->addSql('ALTER TABLE c_blog_post DROP c_id, DROP post_id, CHANGE blog_id blog_id INT DEFAULT NULL, CHANGE author_id author_id INT DEFAULT NULL;');
$this->addSql('ALTER TABLE c_blog_post ADD CONSTRAINT FK_B6FD68A3F675F31B FOREIGN KEY (author_id) REFERENCES user (id) ON DELETE CASCADE;');
$this->addSql('ALTER TABLE c_blog_post ADD CONSTRAINT FK_B6FD68A3DAE07E97 FOREIGN KEY (blog_id) REFERENCES c_blog (iid) ON DELETE CASCADE;');
$this->addSql('CREATE INDEX IDX_B6FD68A3F675F31B ON c_blog_post (author_id);');
$this->addSql('CREATE INDEX IDX_B6FD68A3DAE07E97 ON c_blog_post (blog_id);');
$this->addSql('DROP INDEX course ON c_blog_rel_user;');
$this->addSql('ALTER TABLE c_blog_rel_user DROP c_id, CHANGE blog_id blog_id INT DEFAULT NULL, CHANGE user_id user_id INT DEFAULT NULL;');
$this->addSql('ALTER TABLE c_blog_rel_user ADD CONSTRAINT FK_B55D851BDAE07E97 FOREIGN KEY (blog_id) REFERENCES c_blog (iid) ON DELETE CASCADE;');
$this->addSql('ALTER TABLE c_blog_rel_user ADD CONSTRAINT FK_B55D851BA76ED395 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE;');
$this->addSql('CREATE INDEX IDX_B55D851BDAE07E97 ON c_blog_rel_user (blog_id);');
$this->addSql('CREATE INDEX IDX_B55D851BA76ED395 ON c_blog_rel_user (user_id);');
$this->addSql('DROP INDEX course ON c_blog_task_rel_user;');
$this->addSql('DROP INDEX user ON c_blog_task_rel_user;');
$this->addSql('DROP INDEX task ON c_blog_task_rel_user;');
$this->addSql('ALTER TABLE c_blog_task_rel_user DROP c_id, CHANGE blog_id blog_id INT DEFAULT NULL, CHANGE user_id user_id INT DEFAULT NULL, CHANGE task_id task_id INT DEFAULT NULL;');
$this->addSql('ALTER TABLE c_blog_task_rel_user ADD CONSTRAINT FK_FD8B3C738DB60186 FOREIGN KEY (task_id) REFERENCES c_blog_task (iid) ON DELETE CASCADE;');
$this->addSql('ALTER TABLE c_blog_task_rel_user ADD CONSTRAINT FK_FD8B3C73DAE07E97 FOREIGN KEY (blog_id) REFERENCES c_blog (iid) ON DELETE CASCADE;');
$this->addSql('ALTER TABLE c_blog_task_rel_user ADD CONSTRAINT FK_FD8B3C73A76ED395 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE;');
$this->addSql('CREATE INDEX IDX_FD8B3C73DAE07E97 ON c_blog_task_rel_user (blog_id);');
$this->addSql('CREATE INDEX IDX_FD8B3C738DB60186 ON c_blog_task_rel_user (task_id);');
$this->addSql('CREATE INDEX IDX_FD8B3C73A76ED395 ON c_blog_task_rel_user (user_id);');
$this->addSql('DROP INDEX course ON c_blog;');
$this->addSql('DROP INDEX session_id ON c_blog;');
$this->addSql('ALTER TABLE c_blog DROP c_id, DROP blog_id, DROP visibility, DROP session_id;');
$this->addSql('ALTER TABLE c_blog ADD CONSTRAINT FK_64B00A121BAD783F FOREIGN KEY (resource_node_id) REFERENCES resource_node (id) ON DELETE CASCADE;');
$this->addSql('ALTER TABLE c_lp_category_rel_user DROP FOREIGN KEY FK_61F0427A76ED395;');
$this->addSql('DROP INDEX course ON c_blog_task;');
$this->addSql('ALTER TABLE c_blog_task DROP c_id, CHANGE blog_id blog_id INT DEFAULT NULL;');
$this->addSql('ALTER TABLE c_blog_task ADD CONSTRAINT FK_BE09DF0BDAE07E97 FOREIGN KEY (blog_id) REFERENCES c_blog (iid) ON DELETE CASCADE;');
$this->addSql('CREATE INDEX IDX_BE09DF0BDAE07E97 ON c_blog_task (blog_id);');
$this->addSql('DROP INDEX course ON c_blog_comment;');
$this->addSql('ALTER TABLE c_blog_comment DROP c_id, DROP post_id, DROP task_id, DROP parent_comment_id, CHANGE author_id author_id INT DEFAULT NULL, CHANGE blog_id blog_id INT DEFAULT NULL;');
$this->addSql('ALTER TABLE c_blog_comment ADD CONSTRAINT FK_CAA18F1F675F31B FOREIGN KEY (author_id) REFERENCES user (id) ON DELETE CASCADE;');
$this->addSql('ALTER TABLE c_blog_comment ADD CONSTRAINT FK_CAA18F1DAE07E97 FOREIGN KEY (blog_id) REFERENCES c_blog (iid) ON DELETE CASCADE;');
$this->addSql('CREATE INDEX IDX_CAA18F1F675F31B ON c_blog_comment (author_id);');
$this->addSql('CREATE INDEX IDX_CAA18F1DAE07E97 ON c_blog_comment (blog_id);');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE block DROP FOREIGN KEY FK_831B9722A76ED395;');
$this->addSql('ALTER TABLE block DROP COLUMN user_id;');
$this->addSql('DROP INDEX UNIQ_831B9722A76ED395 ON block;');
$this->addSql('ALTER TABLE c_blog_attachment DROP FOREIGN KEY FK_E769AADCDAE07E97;');
$this->addSql('ALTER TABLE c_blog_attachment ADD c_id INT NOT NULL, ADD post_id INT NOT NULL, ADD comment_id INT NOT NULL;');
$this->addSql('ALTER TABLE c_blog_attachment ADD id INT NOT NULL;');
$this->addSql('DROP INDEX IDX_E769AADCDAE07E97 ON c_blog_attachment;');
$this->addSql('CREATE INDEX course ON c_blog_attachment (c_id);');
$this->addSql('ALTER TABLE c_blog_rating DROP FOREIGN KEY FK_D4E30760DAE07E97;');
$this->addSql('ALTER TABLE c_blog_rating DROP FOREIGN KEY FK_D4E30760A76ED395;');
$this->addSql('ALTER TABLE c_blog_rating ADD c_id INT NOT NULL, ADD rating_id INT NOT NULL, ADD item_id INT NOT NULL;');
$this->addSql('DROP INDEX IDX_D4E30760DAE07E97 ON c_blog_rating;');
$this->addSql('DROP INDEX IDX_D4E30760A76ED395 ON c_blog_rating;');
$this->addSql('CREATE INDEX course ON c_blog_rating (c_id);');
$this->addSql('ALTER TABLE c_survey_question_option DROP FOREIGN KEY FK_C4B6F5F1E27F6BF;');
$this->addSql('ALTER TABLE c_survey_question_option ADD CONSTRAINT FK_C4B6F5F1E27F6BF FOREIGN KEY (question_id) REFERENCES c_survey_question (iid);');
$this->addSql('ALTER TABLE c_blog_post DROP FOREIGN KEY FK_B6FD68A3F675F31B;');
$this->addSql('ALTER TABLE c_blog_post DROP FOREIGN KEY FK_B6FD68A3DAE07E97;');
$this->addSql('ALTER TABLE c_blog_post ADD c_id INT NOT NULL, ADD post_id INT NOT NULL;');
$this->addSql('DROP INDEX IDX_B6FD68A3F675F31B ON c_blog_post;');
$this->addSql('DROP INDEX IDX_B6FD68A3DAE07E97 ON c_blog_post;');
$this->addSql('CREATE INDEX course ON c_blog_post (c_id);');
$this->addSql('ALTER TABLE c_blog_rel_user DROP FOREIGN KEY FK_B55D851BDAE07E97;');
$this->addSql('ALTER TABLE c_blog_rel_user DROP FOREIGN KEY FK_B55D851BA76ED395;');
$this->addSql('ALTER TABLE c_blog_rel_user ADD c_id INT NOT NULL;');
$this->addSql('DROP INDEX IDX_B55D851BDAE07E97 ON c_blog_rel_user;');
$this->addSql('DROP INDEX IDX_B55D851BA76ED395 ON c_blog_rel_user;');
$this->addSql('CREATE INDEX course ON c_blog_rel_user (c_id);');
$this->addSql('ALTER TABLE c_blog_task_rel_user DROP FOREIGN KEY FK_FD8B3C738DB60186;');
$this->addSql('ALTER TABLE c_blog_task_rel_user DROP FOREIGN KEY FK_FD8B3C73DAE07E97;');
$this->addSql('ALTER TABLE c_blog_task_rel_user DROP FOREIGN KEY FK_FD8B3C73A76ED395;');
$this->addSql('ALTER TABLE c_blog_task_rel_user ADD c_id INT NOT NULL;');
$this->addSql('ALTER TABLE c_blog_task_rel_user ADD task_id INT NOT NULL, ADD user_id INT NOT NULL;');
$this->addSql('DROP INDEX IDX_FD8B3C73DAE07E97 ON c_blog_task_rel_user;');
$this->addSql('DROP INDEX IDX_FD8B3C738DB60186 ON c_blog_task_rel_user;');
$this->addSql('DROP INDEX IDX_FD8B3C73A76ED395 ON c_blog_task_rel_user;');
$this->addSql('CREATE INDEX course ON c_blog_task_rel_user (c_id);');
$this->addSql('CREATE INDEX task ON c_blog_task_rel_user (task_id);');
$this->addSql('CREATE INDEX user ON c_blog_task_rel_user (user_id);');
$this->addSql('ALTER TABLE c_blog DROP FOREIGN KEY FK_64B00A121BAD783F;');
$this->addSql('ALTER TABLE c_blog ADD c_id INT NOT NULL, ADD blog_id INT NOT NULL, ADD visibility TINYINT(1) NOT NULL, ADD session_id INT DEFAULT NULL;');
$this->addSql('DROP INDEX UNIQ_64B00A121BAD783F ON c_blog;');
$this->addSql('CREATE INDEX course ON c_blog (c_id);');
$this->addSql('CREATE INDEX session_id ON c_blog (session_id);');
$this->addSql('ALTER TABLE c_lp_category_rel_user ADD CONSTRAINT FK_61F0427A76ED395 FOREIGN KEY (c_id) REFERENCES course (id);');
$this->addSql('ALTER TABLE c_blog_task DROP FOREIGN KEY FK_BE09DF0BDAE07E97;');
$this->addSql('ALTER TABLE c_blog_task ADD c_id INT NOT NULL;');
$this->addSql('DROP INDEX IDX_BE09DF0BDAE07E97 ON c_blog_task;');
$this->addSql('CREATE INDEX course ON c_blog_task (c_id);');
$this->addSql('ALTER TABLE c_blog_comment DROP FOREIGN KEY FK_CAA18F1F675F31B;');
$this->addSql('ALTER TABLE c_blog_comment DROP FOREIGN KEY FK_CAA18F1DAE07E97;');
$this->addSql('ALTER TABLE c_blog_comment ADD c_id INT NOT NULL, ADD post_id INT NOT NULL, ADD task_id INT NOT NULL, ADD parent_comment_id INT NOT NULL;');
$this->addSql('DROP INDEX IDX_CAA18F1F675F31B ON c_blog_comment;');
$this->addSql('DROP INDEX IDX_CAA18F1DAE07E97 ON c_blog_comment;');
$this->addSql('CREATE INDEX course ON c_blog_comment (c_id);');
}
}

@ -0,0 +1,130 @@
<?php
declare(strict_types=1);
/* For licensing terms, see /license.txt */
namespace Chamilo\CourseBundle\Entity;
use Chamilo\CoreBundle\Entity\AbstractResource;
use Chamilo\CoreBundle\Entity\ResourceInterface;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Stringable;
use Symfony\Component\Validator\Constraints as Assert;
#[ORM\Table(name: 'c_blog')]
#[ORM\Entity]
class CBlog extends AbstractResource implements ResourceInterface, Stringable
{
#[ORM\Column(name: 'iid', type: 'integer')]
#[ORM\Id]
#[ORM\GeneratedValue]
protected ?int $iid = null;
#[Assert\NotBlank]
#[ORM\Column(name: 'title', type: 'text', nullable: false)]
protected string $title;
#[ORM\Column(name: 'blog_subtitle', type: 'string', length: 250, nullable: true)]
protected ?string $blogSubtitle = null;
#[ORM\Column(name: 'date_creation', type: 'datetime', nullable: false)]
protected \DateTime $dateCreation;
#[ORM\OneToMany(mappedBy: 'blog', targetEntity: CBlogAttachment::class, cascade: ['persist', 'remove'])]
private Collection $attachments;
public function __construct()
{
$this->attachments = new ArrayCollection();
}
public function getIid(): ?int
{
return $this->iid;
}
public function getTitle(): string
{
return $this->title;
}
public function setTitle(string $title): self
{
$this->title = $title;
return $this;
}
public function getBlogSubtitle(): ?string
{
return $this->blogSubtitle;
}
public function setBlogSubtitle(?string $blogSubtitle): self
{
$this->blogSubtitle = $blogSubtitle;
return $this;
}
public function getDateCreation(): \DateTime
{
return $this->dateCreation;
}
public function setDateCreation(\DateTime $dateCreation): self
{
$this->dateCreation = $dateCreation;
return $this;
}
/**
* @return Collection<int, CBlogAttachment>
*/
public function getAttachments(): Collection
{
return $this->attachments;
}
public function addAttachment(CBlogAttachment $attachment): self
{
if (!$this->attachments->contains($attachment)) {
$this->attachments->add($attachment);
$attachment->setBlog($this);
}
return $this;
}
public function removeAttachment(CBlogAttachment $attachment): self
{
if ($this->attachments->removeElement($attachment)) {
if ($attachment->getBlog() === $this) {
$attachment->setBlog(null);
}
}
return $this;
}
public function getResourceIdentifier(): int
{
return $this->getIid();
}
public function getResourceName(): string
{
return $this->getTitle();
}
public function setResourceName(string $name): self
{
return $this->setTitle($name);
}
public function __toString(): string
{
return $this->getTitle();
}
}

@ -0,0 +1,100 @@
<?php
declare(strict_types=1);
/* For licensing terms, see /license.txt */
namespace Chamilo\CourseBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Table(name: 'c_blog_attachment')]
#[ORM\Entity]
class CBlogAttachment
{
#[ORM\Column(name: 'iid', type: 'integer')]
#[ORM\Id]
#[ORM\GeneratedValue]
protected ?int $iid = null;
#[ORM\Column(name: 'path', type: 'string', length: 255, nullable: false)]
protected string $path;
#[ORM\Column(name: 'comment', type: 'text', nullable: true)]
protected ?string $comment = null;
#[ORM\Column(name: 'size', type: 'integer', nullable: false)]
protected int $size;
#[ORM\Column(name: 'filename', type: 'string', length: 255, nullable: false)]
protected string $filename;
#[ORM\ManyToOne(targetEntity: CBlog::class, inversedBy: 'attachments')]
#[ORM\JoinColumn(name: 'blog_id', referencedColumnName: 'iid', onDelete: 'CASCADE')]
protected ?CBlog $blog = null;
public function getIid(): ?int
{
return $this->iid;
}
public function getPath(): string
{
return $this->path;
}
public function setPath(string $path): self
{
$this->path = $path;
return $this;
}
public function getComment(): ?string
{
return $this->comment;
}
public function setComment(?string $comment): self
{
$this->comment = $comment;
return $this;
}
public function getSize(): int
{
return $this->size;
}
public function setSize(int $size): self
{
$this->size = $size;
return $this;
}
public function getFilename(): string
{
return $this->filename;
}
public function setFilename(string $filename): self
{
$this->filename = $filename;
return $this;
}
public function getBlog(): ?CBlog
{
return $this->blog;
}
public function setBlog(?CBlog $blog): self
{
$this->blog = $blog;
return $this;
}
}

@ -0,0 +1,117 @@
<?php
declare(strict_types=1);
/* For licensing terms, see /license.txt */
namespace Chamilo\CourseBundle\Entity;
use Chamilo\CoreBundle\Entity\User;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Table(name: 'c_blog_comment')]
#[ORM\Entity]
class CBlogComment
{
#[ORM\Column(name: 'iid', type: 'integer')]
#[ORM\Id]
#[ORM\GeneratedValue]
protected ?int $iid = null;
#[ORM\Column(name: 'comment_id', type: 'integer', nullable: false)]
protected int $commentId;
#[ORM\Column(name: 'title', type: 'string', length: 250, nullable: false)]
protected string $title;
#[ORM\Column(name: 'comment', type: 'text', nullable: false)]
protected string $comment;
#[ORM\ManyToOne(targetEntity: User::class)]
#[ORM\JoinColumn(name: 'author_id', referencedColumnName: 'id', onDelete: 'CASCADE')]
protected User $author;
#[ORM\Column(name: 'date_creation', type: 'datetime', nullable: false)]
protected \DateTime $dateCreation;
#[ORM\ManyToOne(targetEntity: CBlog::class)]
#[ORM\JoinColumn(name: 'blog_id', referencedColumnName: 'iid', onDelete: 'CASCADE')]
protected ?CBlog $blog = null;
public function getIid(): ?int
{
return $this->iid;
}
public function getCommentId(): int
{
return $this->commentId;
}
public function setCommentId(int $commentId): self
{
$this->commentId = $commentId;
return $this;
}
public function getTitle(): string
{
return $this->title;
}
public function setTitle(string $title): self
{
$this->title = $title;
return $this;
}
public function getComment(): string
{
return $this->comment;
}
public function setComment(string $comment): self
{
$this->comment = $comment;
return $this;
}
public function getAuthor(): User
{
return $this->author;
}
public function setAuthor(User $author): self
{
$this->author = $author;
return $this;
}
public function getDateCreation(): \DateTime
{
return $this->dateCreation;
}
public function setDateCreation(\DateTime $dateCreation): self
{
$this->dateCreation = $dateCreation;
return $this;
}
public function getBlog(): ?CBlog
{
return $this->blog;
}
public function setBlog(?CBlog $blog): self
{
$this->blog = $blog;
return $this;
}
}

@ -0,0 +1,102 @@
<?php
declare(strict_types=1);
/* For licensing terms, see /license.txt */
namespace Chamilo\CourseBundle\Entity;
use Chamilo\CoreBundle\Entity\User;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Table(name: 'c_blog_post')]
#[ORM\Entity]
class CBlogPost
{
#[ORM\Column(name: 'iid', type: 'integer')]
#[ORM\Id]
#[ORM\GeneratedValue]
protected ?int $iid = null;
#[ORM\Column(name: 'title', type: 'string', length: 250, nullable: false)]
protected string $title;
#[ORM\Column(name: 'full_text', type: 'text', nullable: false)]
protected string $fullText;
#[ORM\Column(name: 'date_creation', type: 'datetime', nullable: false)]
protected \DateTime $dateCreation;
#[ORM\ManyToOne(targetEntity: User::class)]
#[ORM\JoinColumn(name: 'author_id', referencedColumnName: 'id', onDelete: 'CASCADE')]
protected User $author;
#[ORM\ManyToOne(targetEntity: CBlog::class)]
#[ORM\JoinColumn(name: 'blog_id', referencedColumnName: 'iid', onDelete: 'CASCADE')]
protected ?CBlog $blog = null;
public function getIid(): ?int
{
return $this->iid;
}
public function getTitle(): string
{
return $this->title;
}
public function setTitle(string $title): self
{
$this->title = $title;
return $this;
}
public function getFullText(): string
{
return $this->fullText;
}
public function setFullText(string $fullText): self
{
$this->fullText = $fullText;
return $this;
}
public function getDateCreation(): \DateTime
{
return $this->dateCreation;
}
public function setDateCreation(\DateTime $dateCreation): self
{
$this->dateCreation = $dateCreation;
return $this;
}
public function getAuthor(): User
{
return $this->author;
}
public function setAuthor(User $author): self
{
$this->author = $author;
return $this;
}
public function getBlog(): ?CBlog
{
return $this->blog;
}
public function setBlog(?CBlog $blog): self
{
$this->blog = $blog;
return $this;
}
}

@ -0,0 +1,78 @@
<?php
declare(strict_types=1);
namespace Chamilo\CourseBundle\Entity;
/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Entity\User;
use Chamilo\CoreBundle\Traits\UserTrait;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Table(name: 'c_blog_rating')]
#[ORM\Entity]
class CBlogRating
{
use UserTrait;
#[ORM\Column(name: 'iid', type: 'integer')]
#[ORM\Id]
#[ORM\GeneratedValue]
protected ?int $iid = null;
#[ORM\Column(name: 'rating_type', type: 'string', length: 40, nullable: false)]
protected string $ratingType;
#[ORM\Column(name: 'rating', type: 'integer', nullable: false)]
protected int $rating;
#[ORM\ManyToOne(targetEntity: CBlog::class)]
#[ORM\JoinColumn(name: 'blog_id', referencedColumnName: 'iid', onDelete: 'CASCADE')]
protected ?CBlog $blog = null;
#[ORM\ManyToOne(targetEntity: User::class)]
#[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', onDelete: 'CASCADE')]
protected User $user;
public function getIid(): ?int
{
return $this->iid;
}
public function getRatingType(): string
{
return $this->ratingType;
}
public function setRatingType(string $ratingType): self
{
$this->ratingType = $ratingType;
return $this;
}
public function getRating(): int
{
return $this->rating;
}
public function setRating(int $rating): self
{
$this->rating = $rating;
return $this;
}
public function getBlog(): ?CBlog
{
return $this->blog;
}
public function setBlog(?CBlog $blog): self
{
$this->blog = $blog;
return $this;
}
}

@ -0,0 +1,48 @@
<?php
declare(strict_types=1);
/* For licensing terms, see /license.txt */
namespace Chamilo\CourseBundle\Entity;
use Chamilo\CoreBundle\Entity\User;
use Chamilo\CoreBundle\Traits\UserTrait;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Table(name: 'c_blog_rel_user')]
#[ORM\Entity]
class CBlogRelUser
{
use UserTrait;
#[ORM\Column(name: 'iid', type: 'integer')]
#[ORM\Id]
#[ORM\GeneratedValue]
protected ?int $iid = null;
#[ORM\ManyToOne(targetEntity: CBlog::class)]
#[ORM\JoinColumn(name: 'blog_id', referencedColumnName: 'iid', onDelete: 'CASCADE')]
protected ?CBlog $blog = null;
#[ORM\ManyToOne(targetEntity: User::class)]
#[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', onDelete: 'CASCADE')]
protected User $user;
public function getIid(): ?int
{
return $this->iid;
}
public function getBlog(): ?CBlog
{
return $this->blog;
}
public function setBlog(?CBlog $blog): self
{
$this->blog = $blog;
return $this;
}
}

@ -0,0 +1,115 @@
<?php
declare(strict_types=1);
/* For licensing terms, see /license.txt */
namespace Chamilo\CourseBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Table(name: 'c_blog_task')]
#[ORM\Entity]
class CBlogTask
{
#[ORM\Column(name: 'iid', type: 'integer')]
#[ORM\Id]
#[ORM\GeneratedValue]
protected ?int $iid = null;
#[ORM\Column(name: 'task_id', type: 'integer', nullable: false)]
protected int $taskId;
#[ORM\Column(name: 'title', type: 'string', length: 250, nullable: false)]
protected string $title;
#[ORM\Column(name: 'description', type: 'text', nullable: false)]
protected string $description;
#[ORM\Column(name: 'color', type: 'string', length: 10, nullable: false)]
protected string $color;
#[ORM\Column(name: 'system_task', type: 'boolean', nullable: false)]
protected bool $systemTask;
#[ORM\ManyToOne(targetEntity: CBlog::class)]
#[ORM\JoinColumn(name: 'blog_id', referencedColumnName: 'iid', onDelete: 'CASCADE')]
protected ?CBlog $blog = null;
public function getIid(): ?int
{
return $this->iid;
}
public function getTaskId(): int
{
return $this->taskId;
}
public function setTaskId(int $taskId): self
{
$this->taskId = $taskId;
return $this;
}
public function getTitle(): string
{
return $this->title;
}
public function setTitle(string $title): self
{
$this->title = $title;
return $this;
}
public function getDescription(): string
{
return $this->description;
}
public function setDescription(string $description): self
{
$this->description = $description;
return $this;
}
public function getColor(): string
{
return $this->color;
}
public function setColor(string $color): self
{
$this->color = $color;
return $this;
}
public function isSystemTask(): bool
{
return $this->systemTask;
}
public function setSystemTask(bool $systemTask): self
{
$this->systemTask = $systemTask;
return $this;
}
public function getBlog(): ?CBlog
{
return $this->blog;
}
public function setBlog(?CBlog $blog): self
{
$this->blog = $blog;
return $this;
}
}

@ -0,0 +1,79 @@
<?php
declare(strict_types=1);
/* For licensing terms, see /license.txt */
namespace Chamilo\CourseBundle\Entity;
use Chamilo\CoreBundle\Entity\User;
use Chamilo\CoreBundle\Traits\UserTrait;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Table(name: 'c_blog_task_rel_user')]
#[ORM\Entity]
class CBlogTaskRelUser
{
use UserTrait;
#[ORM\Column(name: 'iid', type: 'integer')]
#[ORM\Id]
#[ORM\GeneratedValue]
protected ?int $iid = null;
#[ORM\Column(name: 'target_date', type: 'date', nullable: false)]
protected \DateTime $targetDate;
#[ORM\ManyToOne(targetEntity: CBlogTask::class)]
#[ORM\JoinColumn(name: 'task_id', referencedColumnName: 'iid', onDelete: 'CASCADE')]
protected ?CBlogTask $task = null;
#[ORM\ManyToOne(targetEntity: CBlog::class)]
#[ORM\JoinColumn(name: 'blog_id', referencedColumnName: 'iid', onDelete: 'CASCADE')]
protected ?CBlog $blog = null;
#[ORM\ManyToOne(targetEntity: User::class)]
#[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', onDelete: 'CASCADE')]
protected User $user;
public function getIid(): ?int
{
return $this->iid;
}
public function getTargetDate(): \DateTime
{
return $this->targetDate;
}
public function setTargetDate(\DateTime $targetDate): self
{
$this->targetDate = $targetDate;
return $this;
}
public function getTask(): ?CBlogTask
{
return $this->task;
}
public function setTask(?CBlogTask $task): self
{
$this->task = $task;
return $this;
}
public function getBlog(): ?CBlog
{
return $this->blog;
}
public function setBlog(?CBlog $blog): self
{
$this->blog = $blog;
return $this;
}
}
Loading…
Cancel
Save