Back to ListModel class

Method getTotal

public int
getTotal
()
Method to get the total number of items for the data set.
Returns
  • int The total number of items available in the data set.
Since
  • 1.6
Class: ListModel
Project: Joomla

Method getTotal - Source code

/**
 * Method to get the total number of items for the data set.
 *
 * @return  integer  The total number of items available in the data set.
 *
 * @since   1.6
 */
public function getTotal()
{
    // Get a storage key.
    $store = $this->getStoreId('getTotal');
    // Try to load the data from internal storage.
    if (isset($this->cache[$store])) {
        return $this->cache[$store];
    }
    try {
        // Load the total and add the total to the internal cache.
        $this->cache[$store] = (int) $this->_getListCount($this->_getListQuery());
    } catch (\RuntimeException $e) {
        $this->setError($e->getMessage());
        return false;
    }
    return $this->cache[$store];
}