AbstractQueryBuilder::platformDeleteBatchHandler

@param \O2System\Database\NoSql\DataStructures\QueryBuilderCache $queryBuilderCache

@return bool
771933
protected function platformDeleteBatchHandler(QueryBuilderCache $queryBuilderCache)
    {
        if ($queryBuilderCache->from) {
            return $this->conn->execute($queryBuilderCache, ['method' => 'delete']);
        }

        return false;
    }
950095
public function deletequery($queryId, $optParams = array())
  {
    $params = array('queryId' => $queryId);
    $params = array_merge($params, $optParams);
    return $this->call('deletequery', array($params));
  }
1339769
private function addGroupFilterToQueryBuilder(QueryBuilder $queryBuilder, $groupSearch)
    {
        if (null !== $groupSearch && '' !== $groupSearch) {
            $upperUserSearch = strtoupper($groupSearch);
            $upperUserSearch = trim($groupSearch);
            $upperUserSearch = preg_replace('/\s+/', ' ', $upperUserSearch);

            $queryBuilder->leftJoin('log.doer', 'doer');
            $queryBuilder->leftJoin('doer.groups', 'groupDoer');
            $queryBuilder->andWhere('groupDoer.name LIKE :groupSearch');

            $queryBuilder->setParameter('groupSearch', '%'.$upperUserSearch.'%');
        }

        return $queryBuilder;
    }
1092713
protected function doBatchDelete(ProxyQueryInterface $queryProxy)
    {
        $modelManager = $this->admin->getModelManager();
        $class = $this->admin->getClass();

        $queryProxy->select('DISTINCT '.$queryProxy->getRootAlias());

        try {
            $entityManager = $modelManager->getEntityManager($class);

            $i = 0;
            foreach ($queryProxy->getQuery()->iterate() as $pos => $object) {
                $entityManager->remove($object[0]);

                if ((++$i % 20) == 0) {
                    $entityManager->flush();
                    $entityManager->clear();
                }
            }

            $entityManager->flush();
            $entityManager->clear();
        } catch (\PDOException $e) {
            throw new ModelManagerException('', 0, $e);
        } catch (DBALException $e) {
            throw new ModelManagerException('', 0, $e);
        }
    }
539552
protected function addJoinTablesToQueryBuilder(QueryBuilder $queryBuilder)
    {
        $objectManager = $this->getObjectManager();
        $entityAlias   = $this->getEntityClassAlias();
        $classMetaData = $objectManager->getClassMetadata($this->getEntityClass());

        $assocMappings = $classMetaData->getAssociationMappings();

        foreach ($assocMappings as $fieldName => $assocMapping) {
            $join  = $entityAlias . '.' . $fieldName;
            $alias = self::JOIN_ALIAS_PREFIX . $fieldName;

            $queryBuilder->addSelect($alias);
            $queryBuilder->leftJoin($join, $alias);
        }
    }
560279
public function batchActionDelete(ProxyQueryInterface $query)
    {
        try {
            return parent::batchActionDelete($query);
        } catch (\Exception $e) {
            return $this->batchActionDeleteException($e);
        }
    }
1361676
public function setTotalCountByQueryBuilder(QueryBuilder $queryBuilder)
    {
        $queryBuilder
            ->select(sprintf('COUNT(%s)', $queryBuilder->getRootAliases()[0]))
            ->setMaxResults(1);

        return $this->setTotalCount(intval($queryBuilder->getQuery()->getSingleScalarResult()));
    }
727092
protected function checkForTrashed(Builder $query, Request $request): Builder
    {
        if ($request->filled('trashed') && $request->input('trashed') === '1') {
            $query->onlyTrashed();
        }

        return $query;
    }
972978
protected function checkForDeleted(Builder $query)
    {
        if (request()->has('deleted') && request()->input('deleted') === '1')
            $query = $query->onlyTrashed();

        return $query;
    }
1261734
public function deleteByKey($key, array $queryParams = [])
    {
        $response = $this->api->settings()->deleteByKey($key, $queryParams);

        return new BaseResponse($response);
    }
66708
public function apply(QueryBuilder $builder)
    {
        $builder->where($this->name, $this->operation, $this->value);
    }
117193
public function buildJoin(QueryBuilder $queryBuilder, $lookup)
    {
        if (substr_count($lookup, $this->getSeparator()) > 0) {
            return $this->runJoinCallback($queryBuilder, explode($this->getSeparator(), $lookup));
        }

        return false;
    }
173661
public function compileDelete(Builder $query)
    {
        $table = $this->wrapTable($query->from);

        $where = is_array($query->wheres) ? $this->compileWheres($query) : '';

        return isset($query->joins)
                    ? $this->compileDeleteWithJoins($query, $table, $where)
                    : trim("delete from {$table} {$where}");
    }
932960
protected function getPlatformGroupConcat(QueryBuilder $query)
    {
        $platform = $query->getConnection()->getDatabasePlatform()->getName();

        switch ($platform) {
            case 'mysql':
                return "GROUP_CONCAT(DISTINCT CONCAT_WS('_', f.name, f.grouping, f.id))";
            case 'sqlite':
                return "GROUP_CONCAT(DISTINCT f.name||'_'||f.grouping||'_'||f.id)";
            case 'postgresql':
                return "string_agg(concat_ws('_', f.name,f.grouping,f.id), ',' ORDER BY f.grouping)";
        }

        throw new \RuntimeException(sprintf('Configured database platform "%s" is not supported.', $platform));
    }
718762
protected function removeWhere(BaseBuilder $query, $key)
    {
        unset($query->wheres[ $key ]);

        $query->wheres = array_values( $query->wheres );
    }
129917
private function removeDuplicateJoins(QueryBuilder $queryBuilder)
    {
        if (empty($queryBuilder->getDQLParts()['join'])) {
            return $queryBuilder;
        }
        $joinArray = [];
        $joins = $queryBuilder->getDQLParts()['join']['a'];
        foreach ($joins as $join) {
            $joinArray[] = $join->getAlias();
        }
        $joinArray = array_unique($joinArray);
        foreach ($joins as $key => $join) {
            if (!array_key_exists($key, $joinArray)) {
                unset($joins[$key]);
            }
        }

        $queryBuilder->resetDQLPart('join');
        foreach ($joins as $join) {
            $queryBuilder->join($join->getJoin(), $join->getAlias());
        }

        return $queryBuilder;
    }
649055
public function subquery( QueryBuilder $queryBuilder ) {
		$this->subqueries[] = $queryBuilder->getSPARQL( false );
		$this->usageValidator->trackDefinedVariables( implode( ' ', $queryBuilder->getSelects() ) );

		// @todo temp hack to add AS definitions to defined variables
		$regexHelper = new RegexHelper();
		$matches = $regexHelper->getMatches( 'AS \{variable}', implode( ' ', $queryBuilder->getSelects() ) );
		$this->usageValidator->trackDefinedVariables( $matches );

		return $this;
	}