Commit 8dfd406b authored by Benjamin Eberlei's avatar Benjamin Eberlei

Add identifier quoting section into Schema API chapter

parent 4af2a2a9
......@@ -14,14 +14,16 @@ Now with the `SchemaManager` instance in `$em` you can use the available methods
> You have to manually quote the identifiers when you accept data from user- or other sources not under
> your control.
++ listDatabases()
++ Schema Description API
+++ listDatabases()
Retrieve an array of databases on the configured connection:
[php]
$databases = $sm->listDatabases();
++ listSequences($database = null)
+++ listSequences($database = null)
Retrieve an array of `Doctrine\DBAL\Schema\Sequence` instances that exist for a database:
......@@ -40,7 +42,7 @@ Now you can loop over the array inspecting each sequence object:
echo $sequence->getName() . "\n";
}
++ listTableColumns($tableName)
+++ listTableColumns($tableName)
Retrieve an array of `Doctrine\DBAL\Schema\Column` instances that exist for the given table:
......@@ -54,7 +56,7 @@ Now you can loop over the array inspecting each column object:
echo $column->getName() . ': ' . $column->getType() . "\n";
}
++ listTableDetails($tableName)
+++ listTableDetails($tableName)
Retrieve a single `Doctrine\DBAL\Schema\Table` instance that encapsulates all the details of the given table:
......@@ -66,7 +68,7 @@ Now you can call methods on the table to manipulate the in memory schema for tha
[php]
$table->addColumn('email_address', 'string');
++ listTableForeignKeys($tableName)
+++ listTableForeignKeys($tableName)
Retrieve an array of `Doctrine\DBAL\Schema\ForeignKeyConstraint` instances that exist for the given table:
......@@ -80,7 +82,7 @@ Now you can loop over the array inspecting each foreign key object:
echo $foreignKey->getName() . ': ' . $foreignKey->getLocalTableName() ."\n";
}
++ listTableIndexes($tableName)
+++ listTableIndexes($tableName)
Retrieve an array of `Doctrine\DBAL\Schema\Index` instances that exist for the given table:
......@@ -94,7 +96,7 @@ Now you can loop over the array inspecting each index object:
echo $index->getName() . ': ' . ($index->isUnique() ? 'unique' : 'not unique') . "\n";
}
++ listTables()
+++ listTables()
Retrieve an array of `Doctrine\DBAL\Schema\Table` instances that exist in the connections database:
......@@ -112,7 +114,7 @@ Each `Doctrine\DBAl\Schema\Table` instance is populated with information provide
}
++ listViews()
+++ listViews()
Retrieve an array of `Doctrine\DBAL\Schema\View` instances that exist in the connections database:
......@@ -126,7 +128,7 @@ Now you can loop over the array inspecting each view object:
echo $view->getName() . ': ' . $view->getSql() . "\n";
}
++ createSchema()
+++ createSchema()
For a complete representation of the current database you can use the `createSchema()` method which returns an instance of `Doctrine\DBAL\Schema\Schema`, which you can use in conjunction with the SchemaTool or Schema Comparator.
......@@ -153,4 +155,13 @@ The `$sql` array should give you a sql query to drop the user table:
array(
0 => 'DROP TABLE user'
)
*/
\ No newline at end of file
*/
++ Quoting Identifiers
It is important to note that Doctrine DBAL does not automatically quote identifiers for you. You have to explicitly
quote your identifiers using the ``` character. This character is detected and translated into the appropriate
vendor specific identifier quotes by the Schema API of Doctrine 2. This explicit mechanism for quoting allows
much more flexibility in the internals of the Schema API. This is necessary because automatic identifier quoting
is not feasible across all the different vendors.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment