Xataface  2.0alpha2
Xataface Application Framework
 All Data Structures Namespaces Files Functions Variables Groups Pages
test_DocumentTest.php
Go to the documentation of this file.
1 <?php
3  function handle($params){
5  $query = $app->getQuery();
6 
7  header("Content-type: text/json; charset=".$app->_conf['oe']."");
8  if ( @$query['row_id'] === '1' ){
9  echo json_encode(array(
10  'code' => 200,
11  'data' => array(
12  'row_id' => 1,
13  'firstName' => 'Joe',
14  'lastName' => 'Montana',
15  'age' => 56,
16  // Comments only loaded with detail view
17  'comments' => 'This is a comment'
18  )
19  ));
20  } else if ( @$query['row_id'] === '2'){
21  echo json_encode(array(
22  'code' => 200,
23  'data' => array(
24  'row_id' => 2,
25  'firstName' => 'Steve',
26  'lastName' => 'Hannah',
27  'age' => 34,
28  'comments' => 'Steve Comments'
29  )
30  ));
31  } else if ( @$query['row_id'] === '3' ){
32  echo json_encode(array(
33  'code' => 200,
34  'data' => array(
35  'row_id' => 3,
36  'firstName' => 'Barry',
37  'lastName' => 'White',
38  'age' => 99,
39  'comments' => 'Barry comments'
40  )
41  ));
42  } else if ( @$query['-resultSet'] == '1' and @$query['result_id'] === '2' ){
43  echo json_encode(array(
44  'code' => 200,
45  'rows' => array(
46  array(
47  'row_id' => 1,
48  'firstName' => 'Joe',
49  'lastName' => 'Montana',
50  'age' => 56
51  ),
52  array(
53  'row_id' => 2,
54  'firstName' => 'Steve',
55  'lastName' => 'Hannah',
56  'age' => 34
57  ),
58  array(
59  'row_id' => 3,
60  'firstName' => 'Barry',
61  'lastName' => 'White',
62  'age' => 99
63  )
64  )
65  ));
66  }
67 
68  }
69 }