data() public method

Set and get method for the query's record's data.
public data ( array $data = [] ) : array
$data array if set, will set given array.
return array Empty array if no data, array of data if the record has it.
Example #1
0
 /**
  * Tests that assigning a whitelist to a query properly restricts the list of data fields that
  * the query exposes.
  *
  * @return void
  */
 public function testWhitelisting()
 {
     $data = array('foo' => 1, 'bar' => 2, 'baz' => 3);
     $query = new Query(compact('data'));
     $this->assertEqual($data, $query->data());
     $query = new Query(compact('data') + array('whitelist' => array('foo', 'bar')));
     $this->assertEqual(array('foo' => 1, 'bar' => 2), $query->data());
 }