Skip to content

Commit af18ab6

Browse files
Merge pull request #6674 from manuelmeister/bugfix/checklist-prototype-id
Add checklistPrototypeId to track prototypes of checklists
2 parents b05afe3 + 0e248fa commit af18ab6

2 files changed

Lines changed: 36 additions & 0 deletions

File tree

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace DoctrineMigrations;
6+
7+
use Doctrine\DBAL\Schema\Schema;
8+
use Doctrine\Migrations\AbstractMigration;
9+
10+
/**
11+
* Auto-generated Migration: Please modify to your needs!
12+
*/
13+
final class Version20250114202150 extends AbstractMigration {
14+
public function getDescription(): string {
15+
return 'Add checklistPrototypeId to checklist';
16+
}
17+
18+
public function up(Schema $schema): void {
19+
// this up() migration is auto-generated, please modify it to your needs
20+
$this->addSql('ALTER TABLE checklist ADD checklistPrototypeId VARCHAR(16) DEFAULT NULL');
21+
}
22+
23+
public function down(Schema $schema): void {
24+
// this down() migration is auto-generated, please modify it to your needs
25+
$this->addSql('ALTER TABLE checklist DROP checklistPrototypeId');
26+
}
27+
}

api/src/Entity/Checklist.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,13 @@ class Checklist extends BaseEntity implements BelongsToCampInterface, CopyFromPr
115115
#[ORM\Column(type: 'text')]
116116
public string $name;
117117

118+
/**
119+
* The id of the checklist that was used as a template for creating this checklist. Internal for now, is
120+
* not published through the API.
121+
*/
122+
#[ORM\Column(type: 'string', length: 16, nullable: true)]
123+
public ?string $checklistPrototypeId = null;
124+
118125
/**
119126
* Whether this checklist is a template.
120127
*/
@@ -168,6 +175,8 @@ public function removeChecklistItem(ChecklistItem $checklistItem): self {
168175
public function copyFromPrototype($prototype, $entityMap): void {
169176
$entityMap->add($prototype, $this);
170177

178+
$this->checklistPrototypeId = $prototype->getId();
179+
171180
// copy Checklist base properties
172181
$this->name ??= $prototype->name;
173182

0 commit comments

Comments
 (0)