Doctrine


Doctrine\ORM\Tools\SchemaTool
/Doctrine/ORM/Tools/SchemaTool.php at line 44

Class SchemaTool

SchemaTool

public class SchemaTool

The SchemaTool is a tool to create/drop/update database schemas based on ClassMetadata class descriptors.

License:
http://www.opensource.org/licenses/lgpl-license.php LGPL
See Also:
www.doctrine-project.org
Since:
2.0
Version:
$Revision$
Author:
Guilherme Blanco
Jonathan Wage
Roman Borschel
Benjamin Eberlei

Constructor Summary

SchemaTool(Doctrine\ORM\EntityManager em)

Initializes a new SchemaTool instance that uses the connection of the provided EntityManager.

Method Summary
void

createSchema(array classes)

Creates the database schema for the given array of ClassMetadata instances.

void

dropSchema(array classes)

Drops the database schema for the given classes.

array

getCreateSchemaSql(array classes)

Gets the list of DDL statements that are required to create the database schema for the given list of ClassMetadata instances.

array

getDropSchemaSql(array classes)

Gets the SQL needed to drop the database schema for the given classes.

Schema

getSchemaFromMetadata(array classes)

From a given set of metadata classes this method creates a Schema instance.

array

getUpdateSchemaSql(array classes, mixed saveMode)

Gets the sequence of SQL statements that need to be performed in order to bring the given class mappings in-synch with the relational schema.

void

updateSchema(array classes, mixed saveMode)

Updates the database schema of the given classes by comparing the ClassMetadata instances to the current database schema that is inspected.

Constructor Detail

/Doctrine/ORM/Tools/SchemaTool.php at line 62

SchemaTool

public SchemaTool(Doctrine\ORM\EntityManager em)

Initializes a new SchemaTool instance that uses the connection of the provided EntityManager.


Method Detail

/Doctrine/ORM/Tools/SchemaTool.php at line 73

createSchema

public void createSchema(array classes)

Creates the database schema for the given array of ClassMetadata instances.


/Doctrine/ORM/Tools/SchemaTool.php at line 469

dropSchema

public void dropSchema(array classes)

Drops the database schema for the given classes.

In any way when an exception is thrown it is supressed since drop was issued for all classes of the schema and some probably just don't exist.


/Doctrine/ORM/Tools/SchemaTool.php at line 90

getCreateSchemaSql

public array getCreateSchemaSql(array classes)

Gets the list of DDL statements that are required to create the database schema for the given list of ClassMetadata instances.

Returns:
$sql The SQL statements needed to create the schema for the classes.

/Doctrine/ORM/Tools/SchemaTool.php at line 485

getDropSchemaSql

public array getDropSchemaSql(array classes)

Gets the SQL needed to drop the database schema for the given classes.


/Doctrine/ORM/Tools/SchemaTool.php at line 102

getSchemaFromMetadata

public Schema getSchemaFromMetadata(array classes)

From a given set of metadata classes this method creates a Schema instance.


/Doctrine/ORM/Tools/SchemaTool.php at line 573

getUpdateSchemaSql

public array getUpdateSchemaSql(array classes, mixed saveMode)

Gets the sequence of SQL statements that need to be performed in order to bring the given class mappings in-synch with the relational schema.

Parameters:
classes - The classes to consider.
Returns:
The sequence of SQL statements.

/Doctrine/ORM/Tools/SchemaTool.php at line 556

updateSchema

public void updateSchema(array classes, mixed saveMode)

Updates the database schema of the given classes by comparing the ClassMetadata instances to the current database schema that is inspected.


Doctrine