Propel API
Class

DefaultPlatform

class DefaultPlatform implements PropelPlatformInterface

Default implementation for the Platform interface.

Methods

__construct(PDO $con = null)

Default constructor.

setConnection(PDO $con = null)

Set the database connection to use for this Platform class.

PDO getConnection()

Returns the database connection to use for this Platform class.

setGeneratorConfig(GeneratorConfig $config)

Sets the GeneratorConfig to use in the parsing.

string getDatabaseType()

Returns the short name of the database type that this platform represents.

int getMaxColumnNameLength()

Returns the max column length supported by the db.

string getNativeIdMethod()

Returns the native IdMethod (sequence|identity)

isNativeIdMethodAutoIncrement()

Domain getDomainForType(string $propelType)

Returns the db specific domain for a propelType.

string getNullString($notNull)

The getAutoIncrement()

string getSequenceName(Table $table)

Gets the name to use for creating a sequence for a table.

string getAddTablesDDL(Database $database)

Builds the DDL SQL to add the tables of a database together with index and foreign keys

string getBeginDDL()

Gets the requests to execute at the beginning of a DDL file

string getEndDDL()

Gets the requests to execute at the end of a DDL file

string getDropTableDDL(Table $table)

Builds the DDL SQL to drop a table

string getAddTableDDL(Table $table)

Builds the DDL SQL to add a table without index and foreign keys

string getColumnDDL(Column $col)

Builds the DDL SQL for a Column object.

string getColumnDefaultValueDDL(Column $col)

Returns the SQL for the default value of a Column object

string getColumnListDDL($columns, $delimiter = ',')

Creates a delimiter-delimited string list of column names, quoted using quoteIdentifier().

string getPrimaryKeyName(Table $table)

Returns the name of a table primary key

string getPrimaryKeyDDL(Table $table)

Returns the SQL for the primary key of a Table object

string getDropPrimaryKeyDDL(Table $table)

Builds the DDL SQL to drop the primary key of a table.

string getAddPrimaryKeyDDL(Table $table)

Builds the DDL SQL to add the primary key of a table.

string getAddIndicesDDL(Table $table)

Builds the DDL SQL to add the indices of a table.

string getAddIndexDDL(Index $index)

Builds the DDL SQL to add an Index.

string getDropIndexDDL(Index $index)

Builds the DDL SQL to drop an Index.

string getIndexDDL(Index $index)

Builds the DDL SQL for an Index object.

string getUniqueDDL(Unique $unique)

Builds the DDL SQL for a Unique constraint object.

string getAddForeignKeysDDL(Table $table)

Builds the DDL SQL to add the foreign keys of a table.

string getAddForeignKeyDDL(ForeignKey $fk)

Builds the DDL SQL to add a foreign key.

string getDropForeignKeyDDL(ForeignKey $fk)

Builds the DDL SQL to drop a foreign key.

string getForeignKeyDDL(ForeignKey $fk)

Builds the DDL SQL for a ForeignKey object.

getCommentLineDDL($comment)

getCommentBlockDDL($comment)

string getModifyDatabaseDDL(PropelDatabaseDiff $databaseDiff)

Builds the DDL SQL to modify a database based on a PropelDatabaseDiff instance

string getRenameTableDDL($fromTableName, $toTableName)

Builds the DDL SQL to rename a table

string getModifyTableDDL(PropelTableDiff $tableDiff)

Builds the DDL SQL to alter a table based on a PropelTableDiff instance

string getModifyTableColumnsDDL(PropelTableDiff $tableDiff)

Builds the DDL SQL to alter a table based on a PropelTableDiff instance

string getModifyTablePrimaryKeyDDL(PropelTableDiff $tableDiff)

Builds the DDL SQL to alter a table's primary key based on a PropelTableDiff instance

string getModifyTableIndicesDDL(PropelTableDiff $tableDiff)

Builds the DDL SQL to alter a table's indices based on a PropelTableDiff instance

string getModifyTableForeignKeysDDL(PropelTableDiff $tableDiff)

Builds the DDL SQL to alter a table's foreign keys based on a PropelTableDiff instance

string getRemoveColumnDDL(Column $column)

Builds the DDL SQL to remove a column

string getRenameColumnDDL($fromColumn, $toColumn)

Builds the DDL SQL to rename a column

string getModifyColumnDDL(PropelColumnDiff $columnDiff)

Builds the DDL SQL to modify a column

string getModifyColumnsDDL($columnDiffs)

Builds the DDL SQL to modify a list of columns

string getAddColumnDDL(Column $column)

Builds the DDL SQL to remove a column

string getAddColumnsDDL($columns)

Builds the DDL SQL to remove a list of columns

boolean hasSize(string $sqlType)

Returns if the RDBMS-specific SQL type has a size attribute.

boolean hasScale(string $sqlType)

Returns if the RDBMS-specific SQL type has a scale attribute.

string quote(string $text)

Quote and escape needed characters in the string for unerlying RDBMS.

string quoteIdentifier(string $text)

Quotes identifiers used in database SQL.

setIdentifierQuoting($enabled = true)

getIdentifierQuoting()

boolean supportsNativeDeleteTrigger()

Whether RDBMS supports native ON DELETE triggers (e.g.

boolean supportsInsertNullPk()

Whether RDBMS supports INSERT null values in autoincremented primary keys

boolean hasStreamBlobImpl()

Whether the underlying PDO driver for this platform returns BLOB columns as streams (instead of strings).

supportsSchemas()

supportsMigrations()

supportsVarcharWithoutSize()

mixed getBooleanString($b)

Returns the boolean value for the RDBMS.

string getTimestampFormatter()

Gets the preferred timestamp formatter for setting date/time values.

string getTimeFormatter()

Gets the preferred time formatter for setting date/time values.

string getDateFormatter()

Gets the preferred date formatter for setting date/time values.

getColumnBindingPHP($column, $identifier, $columnValueAccessor, $tab = ' ')

Get the PHP snippet for binding a value to a column.

getIdentifierPhp($columnValueMutator, $connectionVariableName = '$con', $sequenceName = '', $tab = ' ')

Get the PHP snippet for getting a Pk from the database.

Details

at line 48
public __construct(PDO $con = null)

Default constructor.

Parameters

PDO $con Optional database connection to use in this platform.

at line 58
public setConnection(PDO $con = null)

Set the database connection to use for this Platform class.

Parameters

PDO $con Database connection to use in this platform.

at line 67
public PDO getConnection()

Returns the database connection to use for this Platform class.

Return Value

PDO The database connection or NULL if none has been set.

at line 77
public setGeneratorConfig(GeneratorConfig $config)

Sets the GeneratorConfig to use in the parsing.

Parameters

GeneratorConfig $config

at line 127
public string getDatabaseType()

Returns the short name of the database type that this platform represents.

For example MysqlPlatform->getDatabaseType() returns 'mysql'.

Return Value

string

at line 139
public int getMaxColumnNameLength()

Returns the max column length supported by the db.

Return Value

int The max column length

at line 149
public string getNativeIdMethod()

Returns the native IdMethod (sequence|identity)

Return Value

string The native IdMethod (PropelPlatformInterface:IDENTITY, PropelPlatformInterface::SEQUENCE).

at line 154
public isNativeIdMethodAutoIncrement()

at line 165
public Domain getDomainForType(string $propelType)

Returns the db specific domain for a propelType.

Parameters

string $propelType the Propel type name.

Return Value

Domain The db specific domain.

at line 177
public string getNullString($notNull)

Parameters

$notNull

Return Value

string The RDBMS-specific SQL fragment for <code>NULL</code> or <code>NOT NULL</code>.

at line 185
public The getAutoIncrement()

Return Value

The RDBMS-specific SQL fragment for autoincrement.

at line 200
public string getSequenceName(Table $table)

Gets the name to use for creating a sequence for a table.

This will create a new name or use one specified in an id-method-parameter
tag, if specified.

Parameters

Table $table

Return Value

string Sequence name for this table.

at line 230
public string getAddTablesDDL(Database $database)

Builds the DDL SQL to add the tables of a database together with index and foreign keys

Parameters

Database $database

Return Value

string

at line 249
public string getBeginDDL()

Gets the requests to execute at the beginning of a DDL file

Return Value

string

at line 258
public string getEndDDL()

Gets the requests to execute at the end of a DDL file

Return Value

string

at line 266
public string getDropTableDDL(Table $table)

Builds the DDL SQL to drop a table

Parameters

Table $table

Return Value

string

at line 279
public string getAddTableDDL(Table $table)

Builds the DDL SQL to add a table without index and foreign keys

Parameters

Table $table

Return Value

string

at line 317
public string getColumnDDL(Column $col)

Builds the DDL SQL for a Column object.

Parameters

Column $col

Return Value

string

at line 345
public string getColumnDefaultValueDDL(Column $col)

Returns the SQL for the default value of a Column object

Parameters

Column $col

Return Value

string

at line 381
public string getColumnListDDL($columns, $delimiter = ',')

Creates a delimiter-delimited string list of column names, quoted using quoteIdentifier().

Parameters

$columns
$delimiter

Return Value

string

at line 397
public string getPrimaryKeyName(Table $table)

Returns the name of a table primary key

Parameters

Table $table

Return Value

string

at line 407
public string getPrimaryKeyDDL(Table $table)

Returns the SQL for the primary key of a Table object

Parameters

Table $table

Return Value

string

at line 420
public string getDropPrimaryKeyDDL(Table $table)

Builds the DDL SQL to drop the primary key of a table.

Parameters

Table $table

Return Value

string

at line 437
public string getAddPrimaryKeyDDL(Table $table)

Builds the DDL SQL to add the primary key of a table.

Parameters

Table $table

Return Value

string

at line 454
public string getAddIndicesDDL(Table $table)

Builds the DDL SQL to add the indices of a table.

Parameters

Table $table

Return Value

string

at line 469
public string getAddIndexDDL(Index $index)

Builds the DDL SQL to add an Index.

Parameters

Index $index

Return Value

string

at line 488
public string getDropIndexDDL(Index $index)

Builds the DDL SQL to drop an Index.

Parameters

Index $index

Return Value

string

at line 504
public string getIndexDDL(Index $index)

Builds the DDL SQL for an Index object.

Parameters

Index $index

Return Value

string

at line 519
public string getUniqueDDL(Unique $unique)

Builds the DDL SQL for a Unique constraint object.

Parameters

Unique $unique

Return Value

string

at line 530
public string getAddForeignKeysDDL(Table $table)

Builds the DDL SQL to add the foreign keys of a table.

Parameters

Table $table

Return Value

string

at line 545
public string getAddForeignKeyDDL(ForeignKey $fk)

Builds the DDL SQL to add a foreign key.

Parameters

ForeignKey $fk

Return Value

string

at line 565
public string getDropForeignKeyDDL(ForeignKey $fk)

Builds the DDL SQL to drop a foreign key.

Parameters

ForeignKey $fk

Return Value

string

at line 583
public string getForeignKeyDDL(ForeignKey $fk)

Builds the DDL SQL for a ForeignKey object.

Parameters

ForeignKey $fk

Return Value

string

at line 609
public getCommentLineDDL($comment)

Parameters

$comment

at line 616
public getCommentBlockDDL($comment)

Parameters

$comment

at line 632
public string getModifyDatabaseDDL(PropelDatabaseDiff $databaseDiff)

Builds the DDL SQL to modify a database based on a PropelDatabaseDiff instance

Parameters

PropelDatabaseDiff $databaseDiff

Return Value

string

at line 666
public string getRenameTableDDL($fromTableName, $toTableName)

Builds the DDL SQL to rename a table

Parameters

$fromTableName
$toTableName

Return Value

string

at line 683
public string getModifyTableDDL(PropelTableDiff $tableDiff)

Builds the DDL SQL to alter a table based on a PropelTableDiff instance

Parameters

PropelTableDiff $tableDiff

Return Value

string

at line 748
public string getModifyTableColumnsDDL(PropelTableDiff $tableDiff)

Builds the DDL SQL to alter a table based on a PropelTableDiff instance

Parameters

PropelTableDiff $tableDiff

Return Value

string

at line 777
public string getModifyTablePrimaryKeyDDL(PropelTableDiff $tableDiff)

Builds the DDL SQL to alter a table's primary key based on a PropelTableDiff instance

Parameters

PropelTableDiff $tableDiff

Return Value

string

at line 795
public string getModifyTableIndicesDDL(PropelTableDiff $tableDiff)

Builds the DDL SQL to alter a table's indices based on a PropelTableDiff instance

Parameters

PropelTableDiff $tableDiff

Return Value

string

at line 822
public string getModifyTableForeignKeysDDL(PropelTableDiff $tableDiff)

Builds the DDL SQL to alter a table's foreign keys based on a PropelTableDiff instance

Parameters

PropelTableDiff $tableDiff

Return Value

string

at line 848
public string getRemoveColumnDDL(Column $column)

Builds the DDL SQL to remove a column

Parameters

Column $column

Return Value

string

at line 863
public string getRenameColumnDDL($fromColumn, $toColumn)

Builds the DDL SQL to rename a column

Parameters

$fromColumn
$toColumn

Return Value

string

at line 880
public string getModifyColumnDDL(PropelColumnDiff $columnDiff)

Builds the DDL SQL to modify a column

Parameters

PropelColumnDiff $columnDiff

Return Value

string

at line 897
public string getModifyColumnsDDL($columnDiffs)

Builds the DDL SQL to modify a list of columns

Parameters

$columnDiffs

Return Value

string

at line 929
public string getAddColumnDDL(Column $column)

Builds the DDL SQL to remove a column

Parameters

Column $column

Return Value

string

at line 945
public string getAddColumnsDDL($columns)

Builds the DDL SQL to remove a list of columns

Parameters

$columns

Return Value

string

at line 977
public boolean hasSize(string $sqlType)

Returns if the RDBMS-specific SQL type has a size attribute.

Parameters

string $sqlType the SQL type

Return Value

boolean True if the type has a size attribute

at line 988
public boolean hasScale(string $sqlType)

Returns if the RDBMS-specific SQL type has a scale attribute.

Parameters

string $sqlType the SQL type

Return Value

boolean True if the type has a scale attribute

at line 998
public string quote(string $text)

Quote and escape needed characters in the string for unerlying RDBMS.

Parameters

string $text

Return Value

string

at line 1026
public string quoteIdentifier(string $text)

Quotes identifiers used in database SQL.

Parameters

string $text

Return Value

string Quoted identifier.

at line 1031
public setIdentifierQuoting($enabled = true)

Parameters

$enabled

at line 1036
public getIdentifierQuoting()

at line 1045
public boolean supportsNativeDeleteTrigger()

Whether RDBMS supports native ON DELETE triggers (e.g.

ON DELETE CASCADE).

Return Value

boolean

at line 1054
public boolean supportsInsertNullPk()

Whether RDBMS supports INSERT null values in autoincremented primary keys

Return Value

boolean

at line 1063
public boolean hasStreamBlobImpl()

Whether the underlying PDO driver for this platform returns BLOB columns as streams (instead of strings).

Return Value

boolean

at line 1071
public supportsSchemas()

See also

Platform::supportsSchemas()

at line 1079
public supportsMigrations()

See also

Platform::supportsMigrations()

at line 1085
public supportsVarcharWithoutSize()

at line 1101
public mixed getBooleanString($b)

Returns the boolean value for the RDBMS.

This value should match the boolean value that is set
when using Propel's PreparedStatement::setBoolean().

This function is used to set default column values when building
SQL.

Parameters

$b

Return Value

mixed

at line 1111
public string getTimestampFormatter()

Gets the preferred timestamp formatter for setting date/time values.

Return Value

string

at line 1120
public string getTimeFormatter()

Gets the preferred time formatter for setting date/time values.

Return Value

string

at line 1129
public string getDateFormatter()

Gets the preferred date formatter for setting date/time values.

Return Value

string

at line 1139
public getColumnBindingPHP($column, $identifier, $columnValueAccessor, $tab = ' ')

Get the PHP snippet for binding a value to a column.

Warning: duplicates logic from DBAdapter::bindValue().
Any code modification here must be ported there.

Parameters

$column
$identifier
$columnValueAccessor
$tab

at line 1175
public getIdentifierPhp($columnValueMutator, $connectionVariableName = '$con', $sequenceName = '', $tab = ' ')

Get the PHP snippet for getting a Pk from the database.

Warning: duplicates logic from DBAdapter::getId().
Any code modification here must be ported there.

Typical output:
<code>
$this->id = $con->lastInsertId();
</code>

Parameters

$columnValueMutator
$connectionVariableName
$sequenceName
$tab