eZ\Publish\Core\Persistence\Legacy\Content\Type\Gateway\DoctrineDatabase::countInstancesOfType PHP Method

countInstancesOfType() public method

Counts the number of instances that exists of the identified type.
public countInstancesOfType ( integer $typeId ) : integer
$typeId integer
return integer
    public function countInstancesOfType($typeId)
    {
        $q = $this->dbHandler->createSelectQuery();
        $q->select($q->alias($q->expr->count($this->dbHandler->quoteColumn('id')), 'count'))->from($this->dbHandler->quoteTable('ezcontentobject'))->where($q->expr->eq($this->dbHandler->quoteColumn('contentclass_id'), $q->bindValue($typeId, null, \PDO::PARAM_INT)));
        $stmt = $q->prepare();
        $stmt->execute();
        return (int) $stmt->fetchColumn();
    }