Last active
October 21, 2016 08:10
-
-
Save simodima/6746c5698e8175a6dc144322afbcf214 to your computer and use it in GitHub Desktop.
This file contains 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 | |
public function getAllIds() | |
{ | |
$expr = $this->_em->getExpressionBuilder(); | |
$rsm = new ResultSetMapping(); | |
$rsm->addScalarResult('id', 'id'); | |
$result = $this->_em->createNativeQuery(' | |
SELECT u.id as id FROM users u | |
UNION | |
SELECT a.id as id FROM social_account a | |
', $rsm)->iterate(); | |
foreach ($result as $item) { | |
$dto = array_shift($item); | |
yield new Id($dto['id']); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment