src/Soluble/Normalist/Synthetic/Table.php
public function countBy($predicate, $combination = Predicate\PredicateSet::OP_AND)
    {
        $select = $this->select()
                        ->columns(['count' => new Expression('count(*)')]);

        try {
            $select->where($predicate, $combination);
        } catch (\Zend\Db\Sql\Exception\InvalidArgumentException $e) {
            $message = "Invalid predicates or combination detected (" . $e->getMessage() . ")";
            throw new Exception\InvalidArgumentException(__METHOD__ . ": $message");
        }

        $result = $select->execute()->toArray();

        return (int) $result[0]['count'];
    }
public function countBy($predicate, $combination = Predicate\PredicateSet::OP_AND)
    {
        $select = $this->select()
                        ->columns(['count' => new Expression('count(*)')]);

        try {
            $select->where($predicate, $combination);
        } catch (\Zend\Db\Sql\Exception\InvalidArgumentException $e) {
            $message = "Invalid predicates or combination detected (" . $e->getMessage() . ")";
            throw new Exception\InvalidArgumentException(__METHOD__ . ": $message");
        }

        $result = $select->execute()->toArray();

        return (int) $result[0]['count'];
    }
Find a record by unique key

@param  Where|\Closure|string|array|Predicate\PredicateInterface $predicate
@param  string $combination One of the OP_* constants from Predicate\PredicateSet
@throws Exception\InvalidArgumentException

@return int number of record matching predicates