diff --git a/src/ApiKernel.php b/src/ApiKernel.php index c571435..0af95a2 100644 --- a/src/ApiKernel.php +++ b/src/ApiKernel.php @@ -1113,9 +1113,12 @@ class ApiKernel if (!$stmt->fetch()) $this->fail('Not found', ['id' => $contentId], 404); } + $cols = $this->resolveContentVersionColumns($table); + $select = ['`id`','`content_id`','`section_id`','`version_no`','`editor_type`','`created_at`']; + if (!empty($cols['is_active'])) $select[] = "`{$cols['is_active']}` AS is_active"; + if (!empty($cols['was_active'])) $select[] = "`{$cols['was_active']}` AS was_active"; $stmt = $this->pdo->prepare( - "SELECT `id`,`content_id`,`section_id`,`version_no`,`editor_type`,`created_at` - FROM `$table` WHERE `customer_id` = :cid AND `content_id` = :content + "SELECT " . implode(',', $select) . " FROM `$table` WHERE `customer_id` = :cid AND `content_id` = :content ORDER BY `id` DESC LIMIT 10" ); $stmt->execute([':cid' => $customerId, ':content' => $contentId]);