Back to Versioning class

Method delete

public static bool
delete
(mixed $typeAlias, mixed $id)
Method to delete the history for an item.
Parameters
  • string $typeAlias Typealias of the component
  • int $id ID of the content item to delete
Returns
  • bool true on success, otherwise false.
Since
  • 4.0.0
Class: Versioning
Project: Joomla

Method delete - Source code

/**
 * Method to delete the history for an item.
 *
 * @param   string   $typeAlias  Typealias of the component
 * @param   integer  $id         ID of the content item to delete
 *
 * @return  boolean  true on success, otherwise false.
 *
 * @since   4.0.0
 */
public static function delete($typeAlias, $id)
{
    $db = Factory::getDbo();
    $itemid = $typeAlias . '.' . $id;
    $query = $db->getQuery(true);
    $query->delete($db->quoteName('#__history'))->where($db->quoteName('item_id') . ' = :item_id')->bind(':item_id', $itemid, ParameterType::STRING);
    $db->setQuery($query);
    return $db->execute();
}