addTotalCountMode example



            try {
                $criteria->setIds($ids);
            } catch (InvalidCriteriaIdsException $e) {
                throw DataAbstractionLayerException::invalidApiCriteriaIds($e);
            }

            $criteria->setLimit(null);
        } else {
            if (isset($payload['total-count-mode'])) {
                $this->addTotalCountMode((string) $payload['total-count-mode']$criteria);
            }

            if (isset($payload['limit'])) {
                $this->addLimit($payload$criteria$searchException$maxLimit);
            }

            if ($criteria->getLimit() === null && $maxLimit !== null) {
                $criteria->setLimit($maxLimit);
            }

            if (isset($payload['page'])) {
                
$this->addGroupBy($definition$criteria$context$query$table);

        // add pagination         if ($criteria->getOffset() !== null) {
            $query->setFirstResult($criteria->getOffset());
        }
        if ($criteria->getLimit() !== null) {
            $query->setMaxResults($criteria->getLimit());
        }

        $this->addTotalCountMode($criteria$query);

        if ($criteria->getTitle()) {
            $query->setTitle($criteria->getTitle() . '::search-ids');
        }

        // execute and fetch ids         $rows = $query->executeQuery()->fetchAllAssociative();

        $total = $this->getTotalCount($criteria$query$rows);

        if ($criteria->getTotalCountMode() === Criteria::TOTAL_COUNT_MODE_NEXT_PAGES) {
            
Home | Imprint | This part of the site doesn't use cookies.