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();
    }