/**
* Loop over the Result until the item id is not matching anymore the requested item id.
*
* @param string $itemId The item id for which the ids shall be retrieved.
*
* @param Result $allTags The database result from which the ids shall be extracted.
*
* @return array
*/
protected function getExistingTags($itemId, $allTags)
{
$thisExisting = array();
// Determine existing tags for this item.
/** @noinspection PhpUndefinedFieldInspection */
if ($allTags->item_id == $itemId) {
/** @noinspection PhpUndefinedFieldInspection */
$thisExisting[] = $allTags->value_id;
}
/** @noinspection PhpUndefinedFieldInspection */
while ($allTags->next() && $allTags->item_id == $itemId) {
/** @noinspection PhpUndefinedFieldInspection */
$thisExisting[] = $allTags->value_id;
}
return $thisExisting;
}