Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. private function getUsers( ){
  2. $users = $this->db->resource(dbMapper::USER);
  3. return $this->usersToArray( $users );}
  4.  
  5. private function usersToArray( $users ){
  6. $result = array( );
  7. foreach ($users as $user){
  8. $result[] = array(
  9. 'id' => intval( $user->get('id') ),
  10. 'name' => $user->get('name')
  11. );
  12. }
  13. return $result;
  14. }
  15.  
  16. public function getAllData( ){
  17. $result = array( );
  18. $result['users'] = $this->getUsers( );
  19. $results = print_r($result['users'], true); echo $results;
  20. return $result;
  21. }
  22.  
  23. $data = $model->getAllData( );
  24. $this->_helper->json( $data );
  25.  
  26. Array
  27. (
  28. [0] => Array
  29. (
  30. )
  31.  
  32. [1] => Array
  33. (
  34. )
  35.  
  36. [2] => Array
  37. (
  38. )
  39.  
  40. [3] => Array
  41. (
  42. )
  43.  
  44. [4] => Array
  45. (
  46. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement