Get the query builder for a delete operation on the pivot.

@return \Nova\Database\ORM\Builder
179170
protected function getDeleteQuery()
    {
        $foreign = $this->getAttribute($this->foreignKey);

        $query = $this->newQuery()->where($this->foreignKey, $foreign);

        return $query->where($this->otherKey, $this->getAttribute($this->otherKey));
    }
641334
public function queryBuilder()
    {
        if (!$this->queryBuilder) {
            $this->queryBuilder = $this->grid->model()->getQueryBuilder();
        }

        return $this->queryBuilder;
    }
494879
public function getQuery()
	{
		if (!$this->query) {
			$this->query = new Query($this->driver, $this->preprocessor);
		}

		return $this->query;
	}
566543
private function getQuerySelectQuery(): QueryBuilder
    {
        $query = $this->connection->createQueryBuilder();
        $query->select('DISTINCT q.*, qt.*')
            ->from('ngbm_collection_query', 'q')
            ->innerJoin(
                'q',
                'ngbm_collection_query_translation',
                'qt',
                $query->expr()->andX(
                    $query->expr()->eq('qt.query_id', 'q.id'),
                    $query->expr()->eq('qt.status', 'q.status')
                )
            );

        return $query;
    }
1146840
public function newEloquentBuilder($query)
    {
        return \tap(new Builder($query), function ($builder) {
            $builder->setTenantor($this->tenantor ?? null);
        });
    }
950190
public function SqlBuilder()
    {
        if (!$this->builder)
            $this->builder = new Sql\Builder($this->Connection());
        
        return $this->builder;
    }
815713
protected function newPivotQuery()
	{
		$query = $this->newPivotStatement();

		return $query->where($this->foreignKey, $this->parent->getKey());
	}
1224044
private function slaveQueryBuilder()
    {
        /** @var Connection $connection */
        $connection = $this->getEntityManager()->getConnection();
        if ($connection instanceof MasterSlaveConnection) {
            // Prefer a slave connection if available.
            $connection->connect('slave');
        }

        return new QueryBuilder($connection);
    }
6386
public function getQueryHelper()
    {
        if (!$this->queryHelper) {
            $this->queryHelper = new QueryHelper($this->db);

            if ($this->table) {
                $this->queryHelper->addTable($this->alias ?: $this->table, $this->table);
            }
        }

        return $this->queryHelper;
    }
998729
public function createQueryBuilder()
	{
		$q = $this->flupdo->select();
		$this->queryAddFrom($q);
		$this->queryAddAccessPolicyCondition($this->read_access_policy, $q);
		return $q;
	}
1313132
public function generateDeleteSQL()
        {
            if ($this->sql === null) {
                $this->detectDistinct();
                $this->action = QueryInterface::ACTION_DELETE;
                $sql_generator = new SqlGenerator($this);

                $this->sql = $sql_generator->getDeleteSQL();
            }

            return $this->sql;
        }
361025
protected function newBaseQueryBuilder()
    {
        $conn = $this->getConnection();

        $grammar = $conn->getQueryGrammar();

        return new QueryCacheBuilder($this->queryCache(), $conn, $grammar, $conn->getPostProcessor());
    }
718143
protected function performDeleteOnModel()
    {
        if (! $this->getResource()->isRestorable()) {
            return parent::performDeleteOnModel();
        }
        if ($this->forceDeleting) {
            $this->exists = false;

            return $this->newModelQuery()->where($this->getKeyName(), $this->getKey())->forceDelete();
        }

        return $this->runSoftDelete();
    }
225467
private function slaveQueryBuilder()
    {
        /** @var Connection $connection */
        $connection = $this->em->getConnection();
        if ($connection instanceof MasterSlaveConnection) {
            // Prefer a slave connection if available.
            $connection->connect('slave');
        }

        return new QueryBuilder($connection);
    }
819265
protected function newBaseQueryBuilder()
    {
        $conn = $this->getConnection();

        $grammar = $conn->getQueryGrammar();

        return new MbDatabaseQueryBuilder($conn, $grammar, $conn->getPostProcessor());
    }
173571
public function deleteAll()
    {
        $this->query->type = QueryType::$DELETE;
        return QueryExecutor::prepare($this->db, $this->query)->execute();
    }
565442
public function getQueryBuilder() 
    {
        $qb = $this->getEntityManager()->createQueryBuilder();
        $qb->select(array('a'));
        $qb->from('Neobazaar\Entity\Document', 'a');
        $qb->andWhere($qb->expr()->eq('a.documentType', ':paramDocumentType'));
        $qb->setParameter('paramDocumentType', Document::DOCUMENT_TYPE_CLASSIFIED);
        $qb->addOrderBy('a.dateEdit', 'DESC');
        	
        $userId = $this->getParam('user');
        if($userId) {
            $hashids = $this->getServiceLocator()->get('neobazaar.service.hashid');
            $userId = $hashids->decrypt($userId);
            $userId = is_array($userId) ? reset($userId) : $userId;
            $qb->andWhere($qb->expr()->eq('a.user', ':paramUserId'));
            $qb->setParameter('paramUserId', $userId);
        }
        
        
        return $qb;
    }