Bridge/Doctrine/ORM/Repository/SupplierProductRepository.php
protected function getGetAvailableSumBySubjectQuery()
    {
        if (null !== $this->getAvailableSumBySubjectQuery) {
            return $this->getAvailableSumBySubjectQuery;
        }

        $as = $this->getAlias();
        $qb = $this->createFindBySubjectQueryBuilder();

        $qb
            ->andWhere($qb->expr()->gte($as . '.availableStock', 0))
            ->select('SUM(' . $as . '.availableStock) as available');

        return $this->getAvailableSumBySubjectQuery = $qb->getQuery();
    }
protected function getGetAvailableSumBySubjectQuery()
    {
        if (null !== $this->getAvailableSumBySubjectQuery) {
            return $this->getAvailableSumBySubjectQuery;
        }

        $as = $this->getAlias();
        $qb = $this->createFindBySubjectQueryBuilder();

        $qb
            ->andWhere($qb->expr()->gte($as . '.availableStock', 0))
            ->select('SUM(' . $as . '.availableStock) as available');

        return $this->getAvailableSumBySubjectQuery = $qb->getQuery();
    }
Returns the "get available quantity sum by subject" query.

@return \Doctrine\ORM\Query