Documentation

DatabaseDriver
in package
implements MappingDriver

The DatabaseDriver reverse engineers the mapping metadata from a database.

Tags
link
www.doctrine-project.org

Table of Contents

Interfaces

MappingDriver
Contract for metadata drivers.

Constants

ARRAY  = 'array'
Replacement for {@see Types::ARRAY}.
JSON_ARRAY  = 'json_array'
Replacement for {@see Types::JSON_ARRAY}.
OBJECT  = 'object'
Replacement for {@see Types::OBJECT}.

Properties

$classNamesForTables  : array<string|int, mixed>
$classToTableNames  : array<class-string, string>
$fieldNamesForColumns  : array<string|int, mixed>
$inflector  : Inflector
$manyToManyTables  : mixed
$namespace  : string|null
The namespace for the generated entities.
$sm  : AbstractSchemaManager
$tables  : array<string, Table>|null

Methods

__construct()  : mixed
getAllClassNames()  : array<int, string>
Gets the names of all mapped classes known to this driver.
isTransient()  : bool
Returns whether the class with the specified name should have its metadata loaded.
loadMetadataForClass()  : void
Loads the metadata for the specified class into the provided container.
setClassNameForTable()  : void
Sets class name for a table.
setFieldNameForColumn()  : void
Sets field name for a column on a specific table.
setInflector()  : void
setNamespace()  : void
Set the namespace for the generated entities.
setTables()  : void
Sets tables manually instead of relying on the reverse engineering capabilities of SchemaManager.
buildFieldMapping()  : array<string|int, mixed>
Build field mapping from a schema column definition
buildFieldMappings()  : void
Build field mapping from class metadata.
buildIndexes()  : void
Build indexes from a class metadata.
buildToOneAssociationMappings()  : void
Build to one (one to one, many to one) association mapping from class metadata.
getClassNameForTable()  : string
Returns the mapped class name for a table if it exists. Otherwise return "classified" version.
getFieldNameForColumn()  : string
Return the mapped field name for a column, if it exists. Otherwise return camelized version.
getTablePrimaryKeys()  : array<string|int, string>
Retrieve schema table definition primary keys.
reverseEngineerMappingFromDatabase()  : void

Constants

ARRAY

Replacement for {@see Types::ARRAY}.

private mixed ARRAY = 'array'

To be removed as soon as support for DBAL 3 is dropped.

JSON_ARRAY

Replacement for {@see Types::JSON_ARRAY}.

private mixed JSON_ARRAY = 'json_array'

To be removed as soon as support for DBAL 2 is dropped.

OBJECT

Replacement for {@see Types::OBJECT}.

private mixed OBJECT = 'object'

To be removed as soon as support for DBAL 3 is dropped.

Properties

$classNamesForTables

private array<string|int, mixed> $classNamesForTables = []

$classToTableNames

private array<class-string, string> $classToTableNames = []

$fieldNamesForColumns

private array<string|int, mixed> $fieldNamesForColumns = []

$manyToManyTables

private mixed $manyToManyTables = []
Tags
psalm-var

array<string, Table>

$namespace

The namespace for the generated entities.

private string|null $namespace

Methods

getAllClassNames()

Gets the names of all mapped classes known to this driver.

public getAllClassNames() : array<int, string>
Return values
array<int, string>

The names of all mapped classes known to this driver.

isTransient()

Returns whether the class with the specified name should have its metadata loaded.

public isTransient(mixed $className) : bool
Parameters
$className : mixed
Return values
bool

loadMetadataForClass()

Loads the metadata for the specified class into the provided container.

public loadMetadataForClass(mixed $className, ClassMetadata $metadata) : void
Parameters
$className : mixed
$metadata : ClassMetadata
Tags
psalm-param

class-string<T> $className

psalm-param

ClassMetadata<T> $metadata

template

T of object

setClassNameForTable()

Sets class name for a table.

public setClassNameForTable(string $tableName, string $className) : void
Parameters
$tableName : string
$className : string

setFieldNameForColumn()

Sets field name for a column on a specific table.

public setFieldNameForColumn(string $tableName, string $columnName, string $fieldName) : void
Parameters
$tableName : string
$columnName : string
$fieldName : string

setNamespace()

Set the namespace for the generated entities.

public setNamespace(string $namespace) : void
Parameters
$namespace : string

setTables()

Sets tables manually instead of relying on the reverse engineering capabilities of SchemaManager.

public setTables(array<string|int, Table$entityTables, array<string|int, Table$manyToManyTables) : void
Parameters
$entityTables : array<string|int, Table>
$manyToManyTables : array<string|int, Table>
Tags
psalm-param

list<Table> $entityTables

psalm-param

list<Table> $manyToManyTables

buildFieldMapping()

Build field mapping from a schema column definition

private buildFieldMapping(string $tableName, Column $column) : array<string|int, mixed>
Parameters
$tableName : string
$column : Column
Tags
psalm-return

array{ fieldName: string, columnName: string, type: string, nullable: bool, options?: array{ unsigned?: bool, fixed?: bool, comment?: string, default?: string }, precision?: int, scale?: int, length?: int|null }

Return values
array<string|int, mixed>

getClassNameForTable()

Returns the mapped class name for a table if it exists. Otherwise return "classified" version.

private getClassNameForTable(string $tableName) : string
Parameters
$tableName : string
Tags
psalm-return

class-string

Return values
string

getFieldNameForColumn()

Return the mapped field name for a column, if it exists. Otherwise return camelized version.

private getFieldNameForColumn(string $tableName, string $columnName[, bool $fk = false ]) : string
Parameters
$tableName : string
$columnName : string
$fk : bool = false

Whether the column is a foreignkey or not.

Return values
string

getTablePrimaryKeys()

Retrieve schema table definition primary keys.

private getTablePrimaryKeys(Table $table) : array<string|int, string>
Parameters
$table : Table
Return values
array<string|int, string>

        
On this page

Search results