Settings: Move complex settings from configuration.php to .env or to the Database - refs #2682
parent
93bad6fbc6
commit
052e0b54f4
@ -0,0 +1,203 @@ |
||||
<?php |
||||
declare(strict_types=1); |
||||
|
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
namespace Chamilo\CoreBundle\Entity; |
||||
|
||||
use Doctrine\ORM\Mapping as ORM; |
||||
use Gedmo\Mapping\Annotation as Gedmo; |
||||
|
||||
/** |
||||
* @ORM\Table(name="notification_event") |
||||
* @ORM\Entity |
||||
*/ |
||||
class NotificationEvent |
||||
{ |
||||
|
||||
/** |
||||
* @ORM\Column(name="id", type="integer") |
||||
* @ORM\Id |
||||
* @ORM\GeneratedValue |
||||
*/ |
||||
protected int $id; |
||||
|
||||
/** |
||||
* @ORM\Column(name="title", type="string", length=255, nullable=false) |
||||
*/ |
||||
protected string $title; |
||||
|
||||
/** |
||||
* @ORM\Column(name="content", type="text", nullable=true) |
||||
*/ |
||||
protected string $content; |
||||
|
||||
/** |
||||
* @ORM\Column(name="link", type="text", nullable=true) |
||||
*/ |
||||
protected string $link; |
||||
|
||||
/** |
||||
* @ORM\Column(name="persistent", type="integer", nullable=true) |
||||
*/ |
||||
protected int $persistent; |
||||
|
||||
/** |
||||
* @ORM\Column(name="day_diff", type="integer", nullable=true) |
||||
*/ |
||||
protected int $dayDiff; |
||||
|
||||
/** |
||||
* @ORM\Column(name="event_type", type="string", length=255, nullable=false) |
||||
*/ |
||||
protected string $eventType; |
||||
|
||||
/** |
||||
* @ORM\Column(name="event_id", type="integer", nullable=true) |
||||
*/ |
||||
protected int $eventId; |
||||
|
||||
/** |
||||
* @return int |
||||
*/ |
||||
public function getId(): int |
||||
{ |
||||
return $this->id; |
||||
} |
||||
|
||||
/** |
||||
* @param int $id |
||||
*/ |
||||
public function setId(int $id): self |
||||
{ |
||||
$this->id = $id; |
||||
|
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* @return string |
||||
*/ |
||||
public function getTitle(): string |
||||
{ |
||||
return $this->title; |
||||
} |
||||
|
||||
/** |
||||
* @param string $title |
||||
*/ |
||||
public function setTitle(string $title): self |
||||
{ |
||||
$this->title = $title; |
||||
|
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* @return string |
||||
*/ |
||||
public function getContent(): string |
||||
{ |
||||
return $this->content; |
||||
} |
||||
|
||||
/** |
||||
* @param string $content |
||||
*/ |
||||
public function setContent(string $content): self |
||||
{ |
||||
$this->content = $content; |
||||
|
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* @return string |
||||
*/ |
||||
public function getLink(): string |
||||
{ |
||||
return $this->link; |
||||
} |
||||
|
||||
/** |
||||
* @param string $link |
||||
*/ |
||||
public function setLink(string $link): self |
||||
{ |
||||
$this->link = $link; |
||||
|
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* @return int |
||||
*/ |
||||
public function getPersistent(): int |
||||
{ |
||||
return $this->persistent; |
||||
} |
||||
|
||||
/** |
||||
* @param int $persistent |
||||
*/ |
||||
public function setPersistent(int $persistent): self |
||||
{ |
||||
$this->persistent = $persistent; |
||||
|
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* @return int |
||||
*/ |
||||
public function getDayDiff(): int |
||||
{ |
||||
return $this->dayDiff; |
||||
} |
||||
|
||||
/** |
||||
* @param int $dayDiff |
||||
*/ |
||||
public function setDayDiff(int $dayDiff): self |
||||
{ |
||||
$this->dayDiff = $dayDiff; |
||||
|
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* @return string |
||||
*/ |
||||
public function getEventType(): string |
||||
{ |
||||
return $this->eventType; |
||||
} |
||||
|
||||
/** |
||||
* @param string $eventType |
||||
*/ |
||||
public function setEventType(string $eventType): self |
||||
{ |
||||
$this->eventType = $eventType; |
||||
|
||||
return $this; |
||||
} |
||||
|
||||
/** |
||||
* @return int |
||||
*/ |
||||
public function getEventId(): int |
||||
{ |
||||
return $this->eventId; |
||||
} |
||||
|
||||
/** |
||||
* @param int $eventId |
||||
*/ |
||||
public function setEventId(int $eventId): self |
||||
{ |
||||
$this->eventId = $eventId; |
||||
|
||||
return $this; |
||||
} |
||||
} |
@ -0,0 +1,72 @@ |
||||
<?php |
||||
declare(strict_types=1); |
||||
|
||||
namespace Chamilo\CoreBundle\Migrations\Schema\V200; |
||||
|
||||
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo; |
||||
use Doctrine\DBAL\Schema\Schema; |
||||
|
||||
final class Version20230216122950 extends AbstractMigrationChamilo |
||||
{ |
||||
public function getDescription(): string |
||||
{ |
||||
return 'Alter tables required in configuration'; |
||||
} |
||||
|
||||
public function up(Schema $schema): void |
||||
{ |
||||
if ($schema->hasTable('ticket_ticket')) { |
||||
$this->addSql( |
||||
'ALTER TABLE ticket_ticket ADD exercise_id INT DEFAULT NULL, ADD lp_id INT DEFAULT NULL' |
||||
); |
||||
} |
||||
|
||||
if ($schema->hasTable('c_quiz_question_rel_category')) { |
||||
$this->addSql( |
||||
'ALTER TABLE c_quiz_question_rel_category ADD COLUMN mandatory INT DEFAULT 0' |
||||
); |
||||
} |
||||
|
||||
if (!$schema->hasTable('c_plagiarism_compilatio_docs')) { |
||||
$this->addSql( |
||||
'CREATE TABLE c_plagiarism_compilatio_docs (id INT AUTO_INCREMENT NOT NULL, c_id INT NOT NULL, document_id INT NOT NULL, compilatio_id VARCHAR(32) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC' |
||||
); |
||||
} |
||||
|
||||
if (!$schema->hasTable('notification_event')) { |
||||
$this->addSql( |
||||
'CREATE TABLE notification_event (id INT AUTO_INCREMENT NOT NULL, title VARCHAR(255) NOT NULL, content LONGTEXT DEFAULT NULL, link LONGTEXT DEFAULT NULL, persistent INT DEFAULT NULL, day_diff INT DEFAULT NULL, event_type VARCHAR(255) NOT NULL, event_id INT DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC' |
||||
); |
||||
} |
||||
} |
||||
|
||||
public function down(Schema $schema): void |
||||
{ |
||||
|
||||
if ($schema->hasTable('notification_event')) { |
||||
$this->addSql( |
||||
'DROP TABLE notification_event' |
||||
); |
||||
} |
||||
|
||||
if ($schema->hasTable('c_plagiarism_compilatio_docs')) { |
||||
$this->addSql( |
||||
'DROP TABLE c_plagiarism_compilatio_docs' |
||||
); |
||||
} |
||||
|
||||
$table = $schema->getTable('ticket_ticket'); |
||||
if ($table->hasColumn('exercise_id')) { |
||||
$this->addSql('ALTER TABLE ticket_ticket DROP exercise_id'); |
||||
} |
||||
if ($table->hasColumn('lp_id')) { |
||||
$this->addSql('ALTER TABLE ticket_ticket DROP lp_id'); |
||||
} |
||||
|
||||
$table = $schema->getTable('c_quiz_question_rel_category'); |
||||
if ($table->hasColumn('mandatory')) { |
||||
$this->addSql('ALTER TABLE c_quiz_question_rel_category DROP mandatory'); |
||||
} |
||||
|
||||
} |
||||
} |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue