$targetNamespace .= "\\";
}
$targetDirectory = $_SERVER['argv'][2];
$tablesDirectory = $targetDirectory . DIRECTORY_SEPARATOR . 'table';
if (file_exists($tablesDirectory) == false) {
    mkdir($tablesDirectory);
}
$config = new \Doctrine\DBAL\Configuration();
//..
$connectionParams = array('url' => 'mysql://*****:*****@localhost/teach');
$conn = \Doctrine\DBAL\DriverManager::getConnection($connectionParams, $config);
$schemaManager = $conn->getSchemaManager();
foreach ($schemaManager->listTables() as $table) {
    $tableName = $table->getName();
    $tableDescriptor = new Table($table);
    $classDescription = $tableDescriptor->describe($targetNamespace . "Table");
    $class = new gossi\codegen\model\PhpClass($classDescription['identifier']);
    $class->setFinal(true);
    $escapedClassName = str_replace("\\", "\\\\", $class->getQualifiedName());
    $class->setProperty(PhpProperty::create("connection")->setType('\\PDO'));
    $constructor = PhpMethod::create("__construct");
    $constructor->addSimpleParameter("connection", '\\PDO');
    $constructor->setBody('$this->connection = $connection;');
    $class->setMethod($constructor);
    foreach ($classDescription['properties'] as $propertyIdentifier => $value) {
        $class->setProperty(PhpProperty::create($propertyIdentifier));
    }
    $querybuilder = $conn->createQueryBuilder();
    $foreignKeys = $table->getForeignKeys();
    foreach ($classDescription['methods'] as $methodIdentifier => $method) {
        $foreignKeyMethod = PhpMethod::create($methodIdentifier);