/**
* Method to delete the tag mappings and #__ucm_content record for for an item
*
* @param TableInterface $table Table object of content table where delete occurred
* @param integer|array $contentItemId ID of the content item. Or an array of key/value pairs with array key
* being a primary key name and value being the content item ID. Note
* multiple primary keys are not supported
*
* @return boolean true on success, false on failure
*
* @since 3.1
* @throws \InvalidArgumentException
*/
public function deleteTagData(TableInterface $table, $contentItemId)
{
$key = $table->getKeyName();
if (!\is_array($contentItemId)) {
$contentItemId = array($key => $contentItemId);
}
// If we have multiple items for the content item primary key we currently don't support this so
// throw an InvalidArgumentException for now
if (\count($contentItemId) != 1) {
throw new \InvalidArgumentException('Multiple primary keys are not supported as a content item id');
}
$result = $this->unTagItem($contentItemId[$key], $table);
/** @var CoreContent $ucmContentTable */
$ucmContentTable = Table::getInstance('Corecontent');
return $result && $ucmContentTable->deleteByContentId($contentItemId[$key], $this->typeAlias);
}