PHP 클래스 Neos\Flow\Persistence\Doctrine\Service

파일 보기 프로젝트 열기: neos/flow-development-collection 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$output array

보호된 프로퍼티들

프로퍼티 타입 설명
$entityManager Doctrine\Common\Persistence\ObjectManager
$environment Neos\Flow\Utility\Environment
$packageManager Neos\Flow\Package\PackageManagerInterface
$settings array

공개 메소드들

메소드 설명
compileProxies ( ) : void Compiles the Doctrine proxy class code using the Doctrine ProxyFactory.
createSchema ( string $outputPathAndFilename = null ) : string Creates the needed DB schema using Doctrine's SchemaTool. If tables already exist, this will throw an exception.
executeMigration ( string $version, string $direction = 'up', string $outputPathAndFilename = null, boolean $dryRun = false ) : string Execute a single migration in up or down direction. If $path is given, the SQL statements will be written to the file in $path instead of executed.
executeMigrations ( string $version = null, string $outputPathAndFilename = null, boolean $dryRun = false, boolean $quiet = false ) : string Execute all new migrations, up to $version if given.
generateMigration ( boolean $diffAgainstCurrent = true, string $filterExpression = null ) : string Generates a new migration file and returns the path to it.
getDatabasePlatformName ( ) : string Get name of current database platform
getEntityStatus ( ) : array Returns information about which entities exist and possibly if their mapping information contains errors or not.
getForeignKeyHandlingSql ( Doctrine\DBAL\Schema\Schema $schema, Doctrine\DBAL\Platforms\AbstractPlatform $platform, array $tableNames, string $search, string $replace ) : array This serves a rather strange use case: renaming columns used in FK constraints.
getMigrationStatus ( boolean $showMigrations = false, boolean $showDescriptions = false ) : string Returns the current migration status formatted as plain text.
markAsMigrated ( string $version, boolean $markAsMigrated ) : void Add a migration version to the migrations table or remove it.
runDql ( string $dql, integer $hydrationMode = Doctrine\ORM\Query::HYDRATE_OBJECT, integer $firstResult = null, integer $maxResult = null ) : mixed Run DQL and return the result as-is.
updateSchema ( boolean $safeMode = true, string $outputPathAndFilename = null ) : string Updates the DB schema using Doctrine's SchemaTool. The $safeMode flag is passed to SchemaTool unchanged.
validateMapping ( ) : array Validates the metadata mapping for Doctrine, using the SchemaValidator of Doctrine.

보호된 메소드들

메소드 설명
buildCodeFromSql ( Configuration $configuration, array $sql ) : string Returns PHP code for a migration file that "executes" the given array of SQL statements.
getFormattedVersionAlias ( string $alias, Configuration $configuration ) : string Returns a formatted version string for the alias.
getMigrationConfiguration ( ) : Configuration Return the configuration needed for Migrations.
getMigrationDescription ( Version $version, DocCommentParser $parser ) : string Returns the description of a migration.
getPackageKeyFromMigrationVersion ( Version $version ) : string Tries to find out a package key which the Version belongs to. If no package could be found, an empty string is returned.
writeMigrationClassToFile ( Configuration $configuration, string $up, string $down ) : string

비공개 메소드들

메소드 설명
resolveTableName ( string $name ) : string Resolve a table name from its fully qualified name. The $name argument comes from Doctrine\DBAL\Schema\Table#getName which can sometimes return a namespaced name with the form {namespace}.{tableName}. This extracts the table name from that.

메소드 상세

buildCodeFromSql() 보호된 메소드

Returns PHP code for a migration file that "executes" the given array of SQL statements.
protected buildCodeFromSql ( Configuration $configuration, array $sql ) : string
$configuration Doctrine\DBAL\Migrations\Configuration\Configuration
$sql array
리턴 string

compileProxies() 공개 메소드

Compiles the Doctrine proxy class code using the Doctrine ProxyFactory.
public compileProxies ( ) : void
리턴 void

createSchema() 공개 메소드

Creates the needed DB schema using Doctrine's SchemaTool. If tables already exist, this will throw an exception.
public createSchema ( string $outputPathAndFilename = null ) : string
$outputPathAndFilename string A file to write SQL to, instead of executing it
리턴 string

executeMigration() 공개 메소드

Execute a single migration in up or down direction. If $path is given, the SQL statements will be written to the file in $path instead of executed.
public executeMigration ( string $version, string $direction = 'up', string $outputPathAndFilename = null, boolean $dryRun = false ) : string
$version string The version to migrate to
$direction string
$outputPathAndFilename string A file to write SQL to, instead of executing it
$dryRun boolean Whether to do a dry run or not
리턴 string

executeMigrations() 공개 메소드

If $outputPathAndFilename is given, the SQL statements will be written to the given file instead of executed.
public executeMigrations ( string $version = null, string $outputPathAndFilename = null, boolean $dryRun = false, boolean $quiet = false ) : string
$version string The version to migrate to
$outputPathAndFilename string A file to write SQL to, instead of executing it
$dryRun boolean Whether to do a dry run or not
$quiet boolean Whether to do a quiet run or not
리턴 string

generateMigration() 공개 메소드

If $diffAgainstCurrent is TRUE, it generates a migration file with the diff between current DB structure and the found mapping metadata. Only include tables/sequences matching the $filterExpression regexp when diffing models and existing schema. Otherwise an empty migration skeleton is generated.
public generateMigration ( boolean $diffAgainstCurrent = true, string $filterExpression = null ) : string
$diffAgainstCurrent boolean
$filterExpression string
리턴 string Path to the new file

getDatabasePlatformName() 공개 메소드

Get name of current database platform
public getDatabasePlatformName ( ) : string
리턴 string

getEntityStatus() 공개 메소드

Returns information about which entities exist and possibly if their mapping information contains errors or not.
public getEntityStatus ( ) : array
리턴 array

getForeignKeyHandlingSql() 공개 정적인 메소드

For a column that is used in a FK constraint to be renamed, the FK constraint has to be dropped first, then the column can be renamed and last the FK constraint needs to be added back (using the new name, of course). This method helps with the task of handling the FK constraints during this. Given a list of tables that contain columns to be renamed and a search/replace pair for the column name, it will return an array with arrays with drop and add SQL statements. Use them like this before and after renaming the affected fields: collect foreign keys pointing to "our" tables $tableNames = array(...); $foreignKeyHandlingSql = $this->getForeignKeyHandlingSql($schema, $tableNames, 'old_name', 'new_name'); drop FK constraints foreach ($foreignKeyHandlingSql['drop'] as $sql) { $this->addSql($sql); } rename columns now add back FK constraints foreach ($foreignKeyHandlingSql['add'] as $sql) { $this->addSql($sql); }
public static getForeignKeyHandlingSql ( Doctrine\DBAL\Schema\Schema $schema, Doctrine\DBAL\Platforms\AbstractPlatform $platform, array $tableNames, string $search, string $replace ) : array
$schema Doctrine\DBAL\Schema\Schema
$platform Doctrine\DBAL\Platforms\AbstractPlatform
$tableNames array
$search string
$replace string
리턴 array

getFormattedVersionAlias() 보호된 메소드

Returns a formatted version string for the alias.
protected getFormattedVersionAlias ( string $alias, Configuration $configuration ) : string
$alias string
$configuration Doctrine\DBAL\Migrations\Configuration\Configuration
리턴 string

getMigrationConfiguration() 보호된 메소드

Return the configuration needed for Migrations.
protected getMigrationConfiguration ( ) : Configuration
리턴 Doctrine\DBAL\Migrations\Configuration\Configuration

getMigrationDescription() 보호된 메소드

If available it is fetched from the getDescription() method, if that returns an empty value the class docblock is used instead.
protected getMigrationDescription ( Version $version, DocCommentParser $parser ) : string
$version Doctrine\DBAL\Migrations\Version
$parser Neos\Flow\Reflection\DocCommentParser
리턴 string

getMigrationStatus() 공개 메소드

Returns the current migration status formatted as plain text.
public getMigrationStatus ( boolean $showMigrations = false, boolean $showDescriptions = false ) : string
$showMigrations boolean
$showDescriptions boolean
리턴 string

getPackageKeyFromMigrationVersion() 보호된 메소드

Tries to find out a package key which the Version belongs to. If no package could be found, an empty string is returned.
protected getPackageKeyFromMigrationVersion ( Version $version ) : string
$version Doctrine\DBAL\Migrations\Version
리턴 string

markAsMigrated() 공개 메소드

This does not execute any migration code but simply records a version as migrated or not.
public markAsMigrated ( string $version, boolean $markAsMigrated ) : void
$version string The version to add or remove
$markAsMigrated boolean
리턴 void

runDql() 공개 메소드

Run DQL and return the result as-is.
public runDql ( string $dql, integer $hydrationMode = Doctrine\ORM\Query::HYDRATE_OBJECT, integer $firstResult = null, integer $maxResult = null ) : mixed
$dql string
$hydrationMode integer
$firstResult integer
$maxResult integer
리턴 mixed

updateSchema() 공개 메소드

Updates the DB schema using Doctrine's SchemaTool. The $safeMode flag is passed to SchemaTool unchanged.
public updateSchema ( boolean $safeMode = true, string $outputPathAndFilename = null ) : string
$safeMode boolean
$outputPathAndFilename string A file to write SQL to, instead of executing it
리턴 string

validateMapping() 공개 메소드

Validates the metadata mapping for Doctrine, using the SchemaValidator of Doctrine.
public validateMapping ( ) : array
리턴 array

writeMigrationClassToFile() 보호된 메소드

protected writeMigrationClassToFile ( Configuration $configuration, string $up, string $down ) : string
$configuration Doctrine\DBAL\Migrations\Configuration\Configuration
$up string
$down string
리턴 string

프로퍼티 상세

$entityManager 보호되어 있는 프로퍼티

protected ObjectManager,Doctrine\Common\Persistence $entityManager
리턴 Doctrine\Common\Persistence\ObjectManager

$environment 보호되어 있는 프로퍼티

protected Environment,Neos\Flow\Utility $environment
리턴 Neos\Flow\Utility\Environment

$output 공개적으로 프로퍼티

public array $output
리턴 array

$packageManager 보호되어 있는 프로퍼티

protected PackageManagerInterface,Neos\Flow\Package $packageManager
리턴 Neos\Flow\Package\PackageManagerInterface

$settings 보호되어 있는 프로퍼티

protected array $settings
리턴 array