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();
    }
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();
    }
Returns the "get estimated date of arrival by subject" query.

@return \Doctrine\ORM\Query