source/Spiral/ORM/Entities/RecordSelector.php
public function count(string $column = null): int
    {
        if (is_null($column)) {
            if (!empty($this->loader->primaryKey())) {
                //@tuneyourserver solves the issue with counting on queries with joins.
                $column = "DISTINCT({$this->loader->primaryKey()})";
            } else {
                $column = '*';
            }
        }

        return $this->compiledQuery()->count($column);
    }
public function count(string $column = null): int
    {
        if (is_null($column)) {
            if (!empty($this->loader->primaryKey())) {
                //@tuneyourserver solves the issue with counting on queries with joins.
                $column = "DISTINCT({$this->loader->primaryKey()})";
            } else {
                $column = '*';
            }
        }

        return $this->compiledQuery()->count($column);
    }
public function count ( string $ column = null ) : int { if ( is_null ( $ column ) ) { if ( ! empty ( $ this -> loader -> primaryKey ( ) ) ) { //@tuneyourserver solves the issue with counting on queries with joins. $ column = "DISTINCT({$this->loader->primaryKey()})" ; } else { $ column = '*' ; } } return $ this -> compiledQuery ( ) -> count ( $ column ) ; }
Attention, column will be quoted by driver!

@param string|null $column When column is null DISTINCT(PK) will be generated.

@return int
Attention column will be quoted by driver!