protected function getIteratorCount() { if ($this->resultCount === NULL) { if ($this->queryBuilder->hasLimitOffsetClause()) { $sql = 'SELECT COUNT(*) FROM (' . $this->queryBuilder->getQuerySql() . ') temp'; $args = $this->queryBuilder->getQueryParameters(); } else { $builder = clone $this->queryBuilder; $builder->select('COUNT(*)'); $sql = $builder->getQuerySql(); $args = $builder->getQueryParameters(); } $this->resultCount = $this->connection->queryArgs($sql, $args)->fetchField(); } return $this->resultCount; }
protected function assertBuilder($expected, QueryBuilder $builder) { $args = $builder->getQueryParameters(); array_unshift($args, $builder->getQuerySql()); Assert::same($expected, $args); }
protected function calculateCacheKey(QueryBuilder $builder, $preloadIterator, $parent) { return md5($builder->getQuerySql() . json_encode($builder->getQueryParameters()) . ($preloadIterator ? spl_object_hash($preloadIterator) : json_encode($parent->id))); }
protected function calculateCacheKey(QueryBuilder $builder, array $values) { return md5($builder->getQuerySql() . json_encode($builder->getQueryParameters()) . json_encode($values)); }
protected function calculateCacheKey(QueryBuilder $builder, IEntityPreloadContainer $preloadIterator = NULL, IEntity $parent) { return md5($builder->getQuerySql() . json_encode($builder->getQueryParameters()) . ($preloadIterator ? $preloadIterator->getIdentification() : json_encode($parent->getValue('id')))); }