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