Pop\Db\Record\Prepared::getCount PHP Метод

getCount() публичный Метод

Get total count of records
public getCount ( array $columns = null ) : integer
$columns array
Результат integer
    public function getCount(array $columns = null)
    {
        // Build the SQL.
        $this->sql->select(array('total_count' => 'COUNT(*)'));
        if (null !== $columns) {
            $i = 1;
            $params = array();
            foreach ($columns as $key => $value) {
                $this->sql->select()->where()->equalTo($this->sql->adapter()->escape($key), $this->getPlaceholder($key, $i));
                $params[$this->sql->adapter()->escape($key)] = $this->sql->adapter()->escape($value);
                $i++;
            }
            $this->sql->adapter()->prepare($this->sql->render(true));
            $this->sql->adapter()->bindParams($params);
        } else {
            $this->sql->adapter()->prepare($this->sql->render(true));
        }
        $this->sql->adapter()->execute();
        $this->setResults();
        return isset($this->columns['total_count']) ? $this->columns['total_count'] : null;
    }