Back to TagsHelper class

Method tagDeleteInstances

public void
tagDeleteInstances
(mixed $tagId)
Method to delete all instances of a tag from the mapping table. Generally used when a tag is deleted.
Parameters
  • int $tagId The tag_id (primary key) for the deleted tag.
Returns
  • void
Since
  • 3.1
Class: TagsHelper
Project: Joomla

Method tagDeleteInstances - Source code

/**
 * Method to delete all instances of a tag from the mapping table. Generally used when a tag is deleted.
 *
 * @param   integer  $tagId  The tag_id (primary key) for the deleted tag.
 *
 * @return  void
 *
 * @since   3.1
 */
public function tagDeleteInstances($tagId)
{
    // Cast as integer until method is typehinted.
    $tag_id = (int) $tagId;
    // Delete the old tag maps.
    $db = Factory::getDbo();
    $query = $db->getQuery(true)->delete($db->quoteName('#__contentitem_tag_map'))->where($db->quoteName('tag_id') . ' = :id')->bind(':id', $tagId, ParameterType::INTEGER);
    $db->setQuery($query);
    $db->execute();
}