From 59f60516232a606bea592cec84ed3d88b8b07c5d Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Tue, 5 Oct 2021 22:25:47 +0200 Subject: [PATCH] Branch: use new ts_merge_request column --- library/Director/Db/Branch/Branch.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/library/Director/Db/Branch/Branch.php b/library/Director/Db/Branch/Branch.php index 76c6bc2e..0c3cefbb 100644 --- a/library/Director/Db/Branch/Branch.php +++ b/library/Director/Db/Branch/Branch.php @@ -30,8 +30,8 @@ class Branch /** @var @var string */ protected $description; - /** @var bool */ - protected $shouldBeMerged; + /** @var ?int */ + protected $tsMergeRequest; /** @var int */ protected $cntActivities; @@ -39,10 +39,16 @@ class Branch public static function fromDbRow(stdClass $row) { $self = new static; + if (is_resource($row->uuid)) { + $row->uuid = stream_get_contents($row->uuid); + } + if (strlen($row->uuid) !== 16) { + throw new RuntimeException('Valid UUID expected, got ' . var_export($row->uuid, 1)); + } $self->branchUuid = Uuid::fromBytes($row->uuid); $self->name = $row->branch_name; $self->owner = $row->owner; - $self->shouldBeMerged = $row->should_be_merged === 'y'; + $self->tsMergeRequest = $row->ts_merge_request; if (isset($row->cnt_activities)) { $self->cntActivities = $row->cnt_activities; } else { @@ -131,7 +137,7 @@ class Branch */ public function shouldBeMerged() { - return $this->shouldBeMerged; + return $this->tsMergeRequest !== null; } /**