PHP Класс Doctrine\ORM\Tools\SchemaTool

С версии: 2.0
Автор: Guilherme Blanco ([email protected])
Автор: Jonathan Wage ([email protected])
Автор: Roman Borschel ([email protected])
Автор: Benjamin Eberlei ([email protected])
Автор: Stefano Rodriguez ([email protected])
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__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.

Приватные методы

Метод Описание
_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.

Описание методов

__construct() публичный Метод

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

createSchema() публичный Метод

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

dropDatabase() публичный Метод

Drops all elements in the database of the current connection.
public dropDatabase ( ) : void
Результат void

dropSchema() публичный Метод

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
Результат void

getCreateSchemaSql() публичный Метод

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
Результат array $sql The SQL statements needed to create the schema for the classes.

getDropDatabaseSQL() публичный Метод

Gets the SQL needed to drop the database schema for the connections database.
public getDropDatabaseSQL ( ) : array
Результат array

getDropSchemaSQL() публичный Метод

public getDropSchemaSQL ( array $classes ) : array
$classes array
Результат array

getSchemaFromMetadata() публичный Метод

From a given set of metadata classes this method creates a Schema instance.
public getSchemaFromMetadata ( array $classes ) : Schema
$classes array
Результат Schema

getUpdateSchemaSql() публичный Метод

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.
Результат array The sequence of SQL statements.

updateSchema() публичный Метод

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
Результат void