Advertisement
Guest User

Untitled

a guest
Jul 29th, 2015
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. $queryBuilder = $this->em->createQueryBuilder();
  2. $queryBuilder->select("e, 99 as number");
  3.  
  4. array(4) {
  5. [0]=>
  6. array(2) {
  7. [0]=> string(30) "Profile_Entity" //notice this is a string but it should be an object instance
  8. ["number"]=> string(2) "99"
  9. }
  10. ...
  11. ...
  12.  
  13. $queryBuilder = $this->em->createQueryBuilder();
  14. $queryBuilder->select("e");
  15. $queryBuilder->select("99 as number");
  16.  
  17. array(4) {
  18. [0]=> object(stdClass)#935 (39) {
  19. ["__CLASS__"]=> string(30) "Profile_Entity"
  20. ["id"]=> int(46)
  21. ["headline"]=> string(7) "asdasd
  22. ...
  23. ...
  24. ...
  25.  
  26. $queryBuilder -> select('table.column1 alias1, table.column2 alias2');
  27.  
  28. $qb -> select('tableAlias1', 'tableAlias2')
  29. $qb -> from('table1','tableAlias1')
  30. $qb -> leftJoin('table2','tableAlias2');
  31.  
  32. $qb -> select('tableAlias1.column1', 'tableAlias2.column1')
  33. $qb -> from('table1','tableAlias1')
  34. $qb -> leftJoin('table2','tableAlias2');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement