Courses: Add course.introduction field

pull/3924/head
Julio Montoya 4 years ago
parent cb90945d58
commit f13f29604c
  1. 19
      src/CoreBundle/Entity/Course.php
  2. 6
      src/CoreBundle/Migrations/Schema/V200/Version20191101132000.php

@ -247,6 +247,13 @@ class Course extends AbstractResource implements ResourceInterface, ResourceWith
*/
protected ?string $description;
/**
* @Groups({"course:read", "course_rel_user:read"})
*
* @ORM\Column(name="introduction", type="text", nullable=true)
*/
protected ?string $introduction;
/**
* @ApiSubresource()
* @Groups({"course:read", "course:write", "course_rel_user:read"})
@ -1269,6 +1276,18 @@ class Course extends AbstractResource implements ResourceInterface, ResourceWith
return $this;
}
public function getIntroduction(): ?string
{
return $this->introduction;
}
public function setIntroduction(?string $introduction): self
{
$this->introduction = $introduction;
return $this;
}
/**
* @return Templates[]|Collection
*/

@ -19,7 +19,11 @@ class Version20191101132000 extends AbstractMigrationChamilo
public function up(Schema $schema): void
{
$table = $schema->getTable('course');
if (false === $table->hasColumn('resource_node_id')) {
if (!$table->hasColumn('introduction')) {
$this->addSql('ALTER TABLE course ADD introduction LONGTEXT DEFAULT NULL');
}
if (!$table->hasColumn('resource_node_id')) {
$this->addSql('ALTER TABLE course ADD COLUMN resource_node_id BIGINT DEFAULT NULL;');
$this->addSql(
'ALTER TABLE course ADD CONSTRAINT FK_169E6FB91BAD783F FOREIGN KEY (resource_node_id) REFERENCES resource_node (id) ON DELETE CASCADE;'

Loading…
Cancel
Save