Skip to content

Instantly share code, notes, and snippets.

@rufinus
Created December 21, 2012 15:22
Show Gist options
  • Select an option

  • Save rufinus/4353430 to your computer and use it in GitHub Desktop.

Select an option

Save rufinus/4353430 to your computer and use it in GitHub Desktop.
$query = $this->getEntityManager()->createQuery('SELECT a, count(a.advertId) as amount
FROM Admin\Entity\Advert a
WHERE a.fordate >= :date
AND a.publication IN (:publications)
GROUP By a.advertType, a.publication, a.fordate, a.created
ORDER By a.fordate');
$query->setParameters(array(
'date' => date('Y-m-d', $week['to']),
'publications' => implode(',', $publications)
));
$this->getLogger()->info($query->getSQL());
return $query->setHint(Query::HINT_INCLUDE_META_COLUMNS, true)->getArrayResult();
//return $query->getResult();
SELECT a0_.advert_id AS advert_id0, a0_.fordate AS fordate1, a0_.created AS created2, count(a0_.advert_id) AS sclr3, a0_.publication_id AS publication_id4, a0_.advert_type_id AS advert_type_id5, a0_.mandator_id AS mandator_id6 FROM advert a0_ WHERE a0_.fordate >= ? AND a0_.publication_id IN (?) GROUP BY a0_.advert_type_id, a0_.publication_id, a0_.fordate, a0_.created ORDER BY a0_.fordate ASC
array
'advertId' => int 94
'fordate' =>
object(DateTime)[667]
public 'date' => string '2013-01-14 00:00:00' (length=19)
public 'timezone_type' => int 3
public 'timezone' => string 'Europe/Berlin' (length=13)
'created' =>
object(DateTime)[644]
public 'date' => string '2012-12-12 12:25:12' (length=19)
public 'timezone_type' => int 3
public 'timezone' => string 'Europe/Berlin' (length=13)
'publication_id' => string '6' (length=1)
'advert_type_id' => string '1' (length=1)
'mandator_id' => string '1' (length=1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment