Horde_Rdo_Mapper::count PHP Method

count() public method

Count objects that match $query.
public count ( mixed $query = null ) : integer
$query mixed The query to count matches of.
return integer All objects matching $query.
    public function count($query = null)
    {
        $query = Horde_Rdo_Query::create($query, $this);
        $query->setFields('COUNT(*)')->clearSort();
        list($sql, $bindParams) = $query->getQuery();
        return $this->adapter->selectValue($sql, $bindParams);
    }

Usage Example

Example #1
0
 /**
  * Implementation of count() for Countable
  *
  * @return integer Number of elements in the list
  */
 public function count()
 {
     if (is_null($this->_count)) {
         $this->_count = $this->_mapper->count($this->_query);
     }
     return $this->_count;
 }