protected function getGetMinEdaBySubjectQuery()
    {
        if (null !== $this->getMinEdaBySubjectQuery) {
            return $this->getMinEdaBySubjectQuery;
        }

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

        $qb
            ->andWhere($qb->expr()->isNotNull($as . '.estimatedDateOfArrival'))
            ->andWhere($qb->expr()->orX(
                $qb->expr()->gte($as . '.orderedStock', 0),
                $qb->expr()->gte($as . '.availableStock', 0)
            ))
            ->select('MIN(' . $as . '.estimatedDateOfArrival) as eda');

        return $this->getMinEdaBySubjectQuery = $qb->getQuery();
    }