Advertisement
Guest User

Untitled

a guest
Jul 3rd, 2017
515
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. public function ListUsersDataAction() {
  2. $result = $this->getDoctrine()->getManager();
  3. $person_data = $result->createQueryBuilder()
  4. ->select('u.id,u.email, u.phone_number,u.buy_min,u.buy_max,u.sell_min,u.sell_max,u.status,u.start_date,u.end_date')
  5. ->from('AcmeBitcoinBundle:AlertData', 'u')
  6. ->orderBy('u.id', 'asc')
  7. ;
  8. //$sql=$results->getQuery();
  9. //echo $sql->getSql();
  10. $data = $person_data->getQuery()->getResult();
  11. $json = '[';
  12. $first = 0;
  13. foreach ($data as $v) {
  14. if ($first++)
  15. $json .= ',';
  16. $json .= '["' . $v['id'] . '",
  17. "' . $v['email'] . '",
  18.  
  19. "' . $v['phone_number'] . '"]';
  20. }
  21. $json .= ']';
  22.  
  23. return $this->render('AcmeBitcoinBundle:Datatable:list.html.twig', array(
  24. 'json_data' => $json
  25. ));
  26. }
  27.  
  28. [
  29. [ "3","***@gmail.com","***"],
  30. ["4","**@gmail.com","43534654"]
  31. ]
  32.  
  33. var dataSet={{json_data}}
  34. $(document).ready(function() {
  35. $('#example').dataTable( {
  36. "data": dataSet,
  37. "columns": [
  38. { "title": "Engine" },
  39. { "title": "Browser" },
  40. { "title": "Platform" }
  41.  
  42. ]
  43. } );
  44. } );
  45. </script>
  46.  
  47. <script>
  48. var dataSet=[["3",
  49. "hhh@gmail.com",
  50.  
  51. "24354"],["4",
  52. "25435@gmail.com",
  53.  
  54. "43534654"]]
  55. $(document).ready(function() {
  56. $('#example').dataTable( {
  57. "data": dataSet,
  58. "columns": [
  59. { "title": "Engine" },
  60. { "title": "Browser" },
  61. { "title": "Platform" }
  62.  
  63. ]
  64. } );
  65.  
  66. var dataSet= {{ json_data|json_encode() }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement