Example #1
0
<?php

include '../utils/autoload.php';
// ================================= Row itemsInput =================================
$parser = new DB_Type_Pgsql_Row(array('row_field' => new DB_Type_Pgsql_Row(array('row_item1' => new DB_Type_Int(), 'row_item2' => new DB_Type_String())), 'simple_field' => new DB_Type_String()));
// Sql query result input
$sql_result = array('row_field' => '("5","text")', 'simple_field' => 'simple');
echo "\n\n";
$result = $parser->input($sql_result);
var_dump($result);
/*
array(2) {
	["row_field"]=>
  array(2) {
		["row_item1"]=>
    string(1) "5"
    ["row_item2"]=>
    string(4) "text"
  }
  ["simple_field"]=>
  string(6) "simple"
}
*/
// Sql query result input with additionally fields
$sql_result = array('row_field' => '("5","text")', 'simple_field' => 'simple', 'some_other_field' => 'other');
echo "\n\n";
$result = $parser->input($sql_result);
var_dump($result);
/*
array(3) {
  ["row_field"]=>
Example #2
0
 protected function input_view($native)
 {
     $value = parent::input($native);
     return $this->make_view($value);
 }