/**
* Utility method to get a matching row based on the hash value and id columns.
* This lets us check to make sure we don't save duplicate versions.
*
* @return string SHA1 hash on success. Empty string on failure.
*
* @since 3.2
*/
public function getHashMatch()
{
$db = $this->_db;
$itemId = $this->get('item_id');
$sha1Hash = $this->get('sha1_hash');
$query = $db->getQuery(true);
$query->select('*')->from($db->quoteName('#__history'))->where($db->quoteName('item_id') . ' = :item_id')->where($db->quoteName('sha1_hash') . ' = :sha1_hash')->bind(':item_id', $itemId, ParameterType::STRING)->bind(':sha1_hash', $sha1Hash);
$query->setLimit(1);
$db->setQuery($query);
return $db->loadObject();
}