Newscoop\Entity\Repository\ArticleDatetimeRepository::getFindDatesSQL PHP Метод

getFindDatesSQL() публичный Метод

Get the sql used for find method
public getFindDatesSQL ( array | string $cols = null )
$cols array | string columns to select
    public function getFindDatesSQL($cols = null)
    {
        $conn = $this->getEntityManager()->getConnection();
        if (!is_null($cols)) {
            $this->lastQb->add('select', implode(",", (array) $cols));
        }
        $lastDQL = $this->lastQb->getDQL();
        foreach ($this->lastQParams as $paramName => $paramValue) {
            if (in_array($paramName, array('startTime', 'endTime'))) {
                $paramValue = $conn->convertToDatabaseValue($paramValue, 'time');
            }
            if (in_array($paramName, array('startDate', 'endDate'))) {
                $paramValue = $conn->convertToDatabaseValue($paramValue, 'date');
            }
            $lastDQL = preg_replace("/:{$paramName}/", "'" . addslashes($paramValue) . "'", $lastDQL);
        }
        $qb = $this->getEntityManager()->createQuery($lastDQL);
        return $qb->getSQL();
    }