PHP Class Doctrine\ORM\Tools\SchemaTool

Since: 2.0
Author: Guilherme Blanco ([email protected])
Author: Jonathan Wage ([email protected])
Author: Roman Borschel ([email protected])
Author: Benjamin Eberlei ([email protected])
Author: Stefano Rodriguez ([email protected])
Afficher le fichier Open project: pmjones/php-framework-benchmarks Class Usage Examples

Méthodes publiques

Méthode Description
__construct ( EntityManager $em ) Initializes a new SchemaTool instance that uses the connection of the provided EntityManager.
createSchema ( array $classes ) Creates the database schema for the given array of ClassMetadata instances.
dropDatabase ( ) : void Drops all elements in the database of the current connection.
dropSchema ( array $classes ) : void Drops the database schema for the given classes.
getCreateSchemaSql ( array $classes ) : array Gets the list of DDL statements that are required to create the database schema for the given list of ClassMetadata instances.
getDropDatabaseSQL ( ) : array Gets the SQL needed to drop the database schema for the connections database.
getDropSchemaSQL ( array $classes ) : array
getSchemaFromMetadata ( array $classes ) : Schema From a given set of metadata classes this method creates a Schema instance.
getUpdateSchemaSql ( array $classes, $saveMode = false ) : array 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.
updateSchema ( array $classes, $saveMode = false ) : void Updates the database schema of the given classes by comparing the ClassMetadata ins$tableNametances to the current database schema that is inspected.

Private Methods

Méthode Description
_gatherColumn ( Doctrine\ORM\Mapping\ClassMetadata $class, array $mapping, Table $table ) : array Creates a column definition as required by the DBAL from an ORM field mapping definition.
_gatherColumns ( Doctrine\ORM\Mapping\ClassMetadata $class, Table $table ) : array Gathers the column definitions as required by the DBAL of all field mappings found in the given class.
_gatherRelationJoinColumns ( array $joinColumns, Doctrine\DBAL\Schema\Table $theJoinTable, Doctrine\ORM\Mapping\ClassMetadata $class, Doctrine\ORM\Mapping\AssociationMapping $mapping, array &$primaryKeyColumns, array &$uniqueConstraints ) Gather columns and fk constraints that are required for one part of relationship.
_gatherRelationsSql ( Doctrine\ORM\Mapping\ClassMetadata $class, Doctrine\DBAL\Schema\Table $table, Doctrine\DBAL\Schema\Schema $schema ) : void Gathers the SQL for properly setting up the relations of the given class.
_getAssociationTables ( array $classes )
_getCommitOrder ( array $classes )
_getDiscriminatorColumnDefinition ( Doctrine\ORM\Mapping\ClassMetadata $class, $table ) : array Gets a portable column definition as required by the DBAL for the discriminator column of a class.
processingNotRequired ( Doctrine\ORM\Mapping\ClassMetadata $class, array $processedClasses ) : boolean Some instances of ClassMetadata don't need to be processed in the SchemaTool context. This method detects them.

Method Details

__construct() public méthode

Initializes a new SchemaTool instance that uses the connection of the provided EntityManager.
public __construct ( EntityManager $em )
$em Doctrine\ORM\EntityManager

createSchema() public méthode

Creates the database schema for the given array of ClassMetadata instances.
public createSchema ( array $classes )
$classes array

dropDatabase() public méthode

Drops all elements in the database of the current connection.
public dropDatabase ( ) : void
Résultat void

dropSchema() public méthode

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.
public dropSchema ( array $classes ) : void
$classes array
Résultat void

getCreateSchemaSql() public méthode

Gets the list of DDL statements that are required to create the database schema for the given list of ClassMetadata instances.
public getCreateSchemaSql ( array $classes ) : array
$classes array
Résultat array $sql The SQL statements needed to create the schema for the classes.

getDropDatabaseSQL() public méthode

Gets the SQL needed to drop the database schema for the connections database.
public getDropDatabaseSQL ( ) : array
Résultat array

getDropSchemaSQL() public méthode

public getDropSchemaSQL ( array $classes ) : array
$classes array
Résultat array

getSchemaFromMetadata() public méthode

From a given set of metadata classes this method creates a Schema instance.
public getSchemaFromMetadata ( array $classes ) : Schema
$classes array
Résultat Schema

getUpdateSchemaSql() public méthode

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.
public getUpdateSchemaSql ( array $classes, $saveMode = false ) : array
$classes array The classes to consider.
Résultat array The sequence of SQL statements.

updateSchema() public méthode

Updates the database schema of the given classes by comparing the ClassMetadata ins$tableNametances to the current database schema that is inspected.
public updateSchema ( array $classes, $saveMode = false ) : void
$classes array
Résultat void