public function count($class, DataRequest $dataRequest)
    {
        try {
            $request = clone $dataRequest;
            
            $request->setPage(0);
            $request->setNumberOfEntries(0);
            
            $queryBuilder = $this->entityManager->getQueryBuilder();
            $this->entityManager->buildDataRequestQuery($request, $queryBuilder, $class, 'a');
            
            // Count
            $queryBuilder->select($queryBuilder->expr()->count('a.id'));

            $data = $queryBuilder->getQuery();
            if ($data === false) {
                return 0;
            }

            return $data->getSingleScalarResult();
        } catch (\Exception $e) {
            throw new Exception('Cannot count the access entities for the given data request.', 0, $e);
        }
    }
public function count($class, DataRequest $dataRequest)
    {
        try {
            $request = clone $dataRequest;
            
            $request->setPage(0);
            $request->setNumberOfEntries(0);
            
            $queryBuilder = $this->entityManager->getQueryBuilder();
            $this->entityManager->buildDataRequestQuery($request, $queryBuilder, $class, 'a');
            
            // Count
            $queryBuilder->select($queryBuilder->expr()->count('a.id'));

            $data = $queryBuilder->getQuery();
            if ($data === false) {
                return 0;
            }

            return $data->getSingleScalarResult();
        } catch (\Exception $e) {
            throw new Exception('Cannot count the access entities for the given data request.', 0, $e);
        }
    }
public function count ( $ class , DataRequest $ dataRequest ) { try { $ request = clone $ dataRequest ; $ request -> setPage ( 0 ) ; $ request -> setNumberOfEntries ( 0 ) ; $ queryBuilder = $ this -> entityManager -> getQueryBuilder ( ) ; $ this -> entityManager -> buildDataRequestQuery ( $ request , $ queryBuilder , $ class , 'a' ) ; // Count $ queryBuilder -> select ( $ queryBuilder -> expr ( ) -> count ( 'a.id' ) ) ; $ data = $ queryBuilder -> getQuery ( ) ; if ( $ data === false ) { return 0 ; } return $ data -> getSingleScalarResult ( ) ; } catch ( \ Exception $ e ) { throw new Exception ( 'Cannot count the access entities for the given data request.' , 0 , $ e ) ; } }
Returns the number of all found access entities for the given DataRequest
object.

@param string $class
@param \Zepi\Core\Utils\DataRequest $dataRequest
@return integer

@throws \Zepi\Core\AccessControl\Exception Cannot count the access entities for the given data request.
Returns the number of all found access entities for the given DataRequest object .