LazyRecord\TableParser\TableParser::create PHP Method

create() public static method

public static create ( PDO $connection, BaseDriver $driver )
$connection PDO
$driver SQLBuilder\Driver\BaseDriver
    public static function create(PDO $connection, BaseDriver $driver)
    {
        $class = 'LazyRecord\\TableParser\\' . ucfirst($driver->getDriverName()) . 'TableParser';
        if (class_exists($class, true)) {
            return new $class($connection, $driver);
        } else {
            throw new Exception("parser driver does not support {$driver->getDriverName()} currently.");
        }
    }

Usage Example

 /**
  * @dataProvider driverTypeDataProvider
  */
 public function testTableParserFor($driverType)
 {
     $parser = TableParser::create($this->conn, $this->queryDriver);
     $tables = $parser->getTables();
     $this->assertNotNull($tables);
     foreach ($tables as $table) {
         $this->assertNotNull($table);
         $schema = $parser->reverseTableSchema($table);
         $this->assertNotNull($schema);
         $columns = $schema->getColumns();
         $this->assertNotEmpty($columns);
     }
 }
All Usage Examples Of LazyRecord\TableParser\TableParser::create
TableParser