-
-
Save rufinus/4353021 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$publications = $user->getUserPublicationsAsArray(); | |
$week = $this->getCurrentWeek(); | |
$qb = $this->getEntityManager()->createQueryBuilder(); | |
$qb->select(array('a', 'count(a) as amount')) | |
->from('Admin\Entity\Advert', 'a') | |
->where('a.fordate >= '.date('Y-m-d', $week['to'])) | |
->andWhere($qb->expr()->in('a.publication', $publications)) | |
->groupBy('a.advertType, a.publication, a.fordate, a.created'); | |
$this->getLogger()->info($qb->getQuery()->getSQL()); | |
return $qb->getQuery()->getResult(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
array | |
0 => | |
object(Admin\Entity\Advert)[676] | |
private 'advertId' => int 14 | |
private 'fordate' => | |
object(DateTime)[644] | |
public 'date' => string '2012-12-03 00:00:00' (length=19) | |
public 'timezone_type' => int 3 | |
public 'timezone' => string 'Europe/Berlin' (length=13) | |
private 'created' => | |
object(DateTime)[678] | |
public 'date' => string '2012-11-30 14:54:28' (length=19) | |
public 'timezone_type' => int 3 | |
public 'timezone' => string 'Europe/Berlin' (length=13) | |
private 'package' => | |
object(Doctrine\ORM\PersistentCollection)[667] | |
private 'snapshot' => | |
array | |
... | |
private 'owner' => | |
&object(Admin\Entity\Advert)[676] | |
private 'association' => | |
array | |
... | |
private 'em' => | |
object(Doctrine\ORM\EntityManager)[308] | |
... | |
private 'backRefFieldName' => string 'advert' (length=6) | |
private 'typeClass' => | |
object(Doctrine\ORM\Mapping\ClassMetadata)[675] | |
... | |
private 'isDirty' => boolean false | |
private 'initialized' => boolean false | |
private 'coll' => | |
object(Doctrine\Common\Collections\ArrayCollection)[662] | |
... | |
private 'publication' => | |
object(DoctrineORMModule\Proxy\__CG__\Admin\Entity\Publication)[657] | |
private '_entityPersister' => | |
object(Doctrine\ORM\Persisters\BasicEntityPersister)[658] | |
... | |
private '_identifier' => | |
array | |
... | |
public '__isInitialized__' => boolean false | |
private 'publicationId' (Admin\Entity\Publication) => null | |
private 'name' (Admin\Entity\Publication) => null | |
private 'coverage' (Admin\Entity\Publication) => null | |
private 'provision' (Admin\Entity\Publication) => null | |
private 'contactName' (Admin\Entity\Publication) => null | |
private 'contactPhone' (Admin\Entity\Publication) => null | |
private 'contactEmail' (Admin\Entity\Publication) => null | |
private 'publisher' (Admin\Entity\Publication) => null | |
private 'publicationType' (Admin\Entity\Publication) => null | |
private 'mandator' (Admin\Entity\Publication) => null | |
private 'userPublications' (Admin\Entity\Publication) => null | |
private 'discountCategories' (Admin\Entity\Publication) => null | |
private 'weightingCategories' (Admin\Entity\Publication) => null | |
private 'discountSeason' (Admin\Entity\Publication) => null | |
private 'blacklist' (Admin\Entity\Publication) => null | |
private 'cover' (Admin\Entity\Publication) => null | |
private 'advertType' => | |
object(Admin\Entity\AdvertType)[578] | |
private 'advertTypeId' => int 1 | |
private 'name' => string '1/1 Ganze Seite' (length=15) | |
private 'mandator' => | |
object(DoctrineORMModule\Proxy\__CG__\Admin\Entity\Mandator)[367] | |
... | |
private 'mandator' => | |
object(DoctrineORMModule\Proxy\__CG__\Admin\Entity\Mandator)[367] | |
private '_entityPersister' => | |
object(Doctrine\ORM\Persisters\BasicEntityPersister)[365] | |
... | |
private '_identifier' => | |
array | |
... | |
public '__isInitialized__' => boolean false | |
private 'mandatorId' (Admin\Entity\Mandator) => null | |
private 'name' (Admin\Entity\Mandator) => null | |
private 'locale' (Admin\Entity\Mandator) => null | |
'amount' => string '3' (length=1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 >= 2013 - 01 - 14 AND a0_.publication_id IN (6, 7) GROUP BY a0_.advert_type_id, a0_.publication_id, a0_.fordate, a0_.created |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment