Created
December 18, 2013 11:48
-
-
Save esampaio/8021066 to your computer and use it in GitHub Desktop.
Doctrine issues
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
<?php | |
$queryBuilder = $repository->createQueryBuilder('r') | |
->addSelect('eb.name AS brandName') | |
->addSelect('ea.name AS attributeSetName') | |
->addSelect('et.name AS entityTypeName') | |
->leftJoin('r.entityBrand', 'eb') | |
->leftJoin('r.eavAttributeSet', 'ea') | |
->leftJoin('r.entityType', 'et') | |
->addGroupBy('r.id') | |
->addOrderBy('r.id', 'DESC'); | |
$data = $this->getQueryBuilder()->getQuery(); | |
$data = $data->iterate(); | |
foreach ($data as $row) { | |
# do stuff with row | |
# but only the firt $row will have data | |
# on the brandName, attributeSetName and | |
# entityTypeName | |
} |
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
{"createdAt":"13\\/12\\/13","sku":"foo","name":"test 3","attributeSetName":"Box","entityTypeName":"Kit","brandName": "Fubar"} | |
{"createdAt":"13\\/12\\/13","sku":"bar","name":"test 2","attributeSetName":" ","entityTypeName":" ","brandName":" "} | |
{"createdAt":"13\\/12\\/13","sku":"baz","name":"test 1","attributeSetName":" ","entityTypeName":" ","brandName":" "} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment