Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix: removed unused variable and check if tag ids are empty before st…
…arting the inserts

Signed-off-by: yemkareems <[email protected]>
  • Loading branch information
yemkareems authored and marcelklehr committed Jun 19, 2024
commit 87cd78413c89550af3d2e9cd8b2aeca5bc92a9d4
7 changes: 6 additions & 1 deletion lib/private/SystemTag/SystemTagObjectMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,16 @@ public function assignTags(string $objId, string $objectType, $tagIds): void {
$result = $query->executeQuery();
$rows = $result->fetchAll();
$existingTags = [];
foreach ($rows as $k => $row) {
foreach ($rows as $row) {
$existingTags[] = $row['systemtagid'];
}
//filter only tags that do not exist in db
$tagIds = array_diff($tagIds, $existingTags);
if (empty($tagIds)) {
// no tags to insert so return here
$this->connection->commit();
return;
}

$query = $this->connection->getQueryBuilder();
$query->insert(self::RELATION_TABLE)
Expand Down