Skip to content

Internal: Add group_category_work_id to c_student_publication table #5897

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/CoreBundle/Migrations/Schema/V200/Version20241001155300.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ final class Version20241001155300 extends AbstractMigrationChamilo
{
public function getDescription(): string
{
return 'Create and modify tables for peer assessment, autogroups, learning paths, group relations, and student publications.';
return 'Modify tables c_lp_rel_user and c_student_publication, adding new fields for group handling and publication categorization.';
}

public function up(Schema $schema): void
Expand Down Expand Up @@ -46,6 +46,11 @@ public function up(Schema $schema): void
ALTER TABLE c_lp_rel_user
ADD CONSTRAINT FK_AD97516EFE54D947 FOREIGN KEY (group_id) REFERENCES c_group_info (iid) ON DELETE CASCADE
");

$this->addSql("
ALTER TABLE c_student_publication
ADD IF NOT EXISTS group_category_work_id INT DEFAULT 0
");
}

public function down(Schema $schema): void
Expand All @@ -57,5 +62,10 @@ public function down(Schema $schema): void
DROP IF EXISTS end_date,
DROP IF EXISTS is_open_without_date
");

$this->addSql("
ALTER TABLE c_student_publication
DROP IF EXISTS group_category_work_id
");
}
}
16 changes: 16 additions & 0 deletions src/CourseBundle/Entity/CStudentPublication.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,10 @@ class CStudentPublication extends AbstractResource implements ResourceInterface,
#[ORM\Column(name: 'extensions', type: 'text', nullable: true)]
protected ?string $extensions = null;

#[ORM\Column(name: 'group_category_work_id', type: 'integer', nullable: false, options: ['default' => 0])]
#[Groups(['c_student_publication:write', 'student_publication:read'])]
protected int $groupCategoryWorkId = 0;

public function __construct()
{
$this->description = '';
Expand Down Expand Up @@ -647,4 +651,16 @@ public function getStudentSubscribedToWork(): int

return 0;
}

public function getGroupCategoryWorkId(): int
{
return $this->groupCategoryWorkId;
}

public function setGroupCategoryWorkId(int $groupCategoryWorkId): self
{
$this->groupCategoryWorkId = $groupCategoryWorkId;

return $this;
}
}
Loading