setTable() public method

Set the table name
public setTable ( string $table ) : Data
$table string
return Data
Ejemplo n.º 1
0
 public function testParseData()
 {
     $ary = array(array('name' => 'Test1', 'email' => '*****@*****.**'), array('name' => 'Test2', 'email' => '*****@*****.**'));
     $d = new Data($ary);
     $d->setTable('users')->setIdQuote('`');
     $this->assertContains('INSERT INTO `users` (`name`, `email`) VALUES', $d->parseData('sql'));
     $this->assertContains('<name>Test1</name>', $d->parseData('xml'));
     $this->assertContains('Test1,test1@test.com', $d->parseData('csv'));
 }
Ejemplo n.º 2
0
    $xml = $data->parseFile();
    $data = new Data('../assets/files/test.yml');
    $yml = $data->parseFile();
    echo 'CSV data to XML file<br />-------------------<br />' . PHP_EOL;
    $data = new Data($csv);
    $obj = $data->parseData('xml');
    echo $obj;
    echo PHP_EOL . '<br /><br />' . PHP_EOL;
    echo 'SQL data to CSV file<br />-------------------<br />' . PHP_EOL;
    $data = new Data($sql);
    $obj = $data->parseData('csv');
    echo $obj;
    echo PHP_EOL . '<br /><br />' . PHP_EOL;
    echo 'SQL data to YAML file<br />-------------------<br />' . PHP_EOL;
    $data = new Data($sql);
    $obj = $data->parseData('yaml');
    echo $obj;
    echo PHP_EOL . '<br /><br />' . PHP_EOL;
    echo 'XML data to SQL file<br />-------------------<br />' . PHP_EOL;
    $data = new Data($xml);
    $data->setTable('users')->setIdQuote('`');
    $obj = $data->parseData('sql');
    echo $obj;
    echo PHP_EOL . '<br /><br />' . PHP_EOL;
    echo 'YAML data to JSON file<br />-------------------<br />' . PHP_EOL;
    $data = new Data($yml);
    $obj = $data->parseData('json');
    echo $obj;
} catch (\Exception $e) {
    echo $e->getMessage();
}