class Doctrine_Formatter extends Doctrine_Connection_Module (View source)

Doctrine_Formatter

Properties

protected Doctrine_Connection $conn from Doctrine_Connection_Module
protected string $moduleName from Doctrine_Connection_Module

Methods

__construct(Doctrine_Connection $conn = null)

No description

getConnection()

getConnection returns the connection object this module uses

string
getModuleName()

getModuleName returns the name of this module

string
escapePattern(string $text)

Quotes pattern (% and _) characters in a string)

void
convertBooleans(array $item)

convertBooleans some drivers need the boolean values to be converted into integers when using DQL API

string
quoteIdentifier(string $str, bool $checkOption = true)

Quote a string so it can be safely used as a table or column name

string
quoteMultipleIdentifier(array $arr, bool $checkOption = true)

quoteMultipleIdentifier Quotes multiple identifier strings

string
quote(mixed $input, string $type = null)

quote quotes given input parameter

string
fixSequenceName(string $sqn)

Removes any formatting in an sequence name using the 'seqname_format' option

string
fixIndexName(string $idx)

Removes any formatting in an index name using the 'idxname_format' option

string
getSequenceName(string $sqn)

adds sequence name formatting to a sequence name

string
getIndexName(string $idx)

adds index name formatting to a index name

string
getForeignKeyName(string $fkey)

Formatting a foreign Key name

string
getTableName(string $table)

adds table name formatting to a table name

Details

__construct(Doctrine_Connection $conn = null)

Parameters

Doctrine_Connection $conn Doctrine_Connection object, every connection module holds an instance of Doctrine_Connection

Doctrine_Connection getConnection()

getConnection returns the connection object this module uses

Return Value

Doctrine_Connection

string getModuleName()

getModuleName returns the name of this module

Return Value

string the name of this module

string escapePattern(string $text)

Quotes pattern (% and _) characters in a string)

EXPERIMENTAL

WARNING: this function is experimental and may change signature at any time until labelled as non-experimental

Parameters

string $text the input string to quote

Return Value

string quoted string

void convertBooleans(array $item)

convertBooleans some drivers need the boolean values to be converted into integers when using DQL API

This method takes care of that conversion

Parameters

array $item

Return Value

void

string quoteIdentifier(string $str, bool $checkOption = true)

Quote a string so it can be safely used as a table or column name

Delimiting style depends on which database driver is being used.

NOTE: just because you CAN use delimited identifiers doesn't mean you SHOULD use them. In general, they end up causing way more problems than they solve.

Portability is broken by using the following characters inside delimited identifiers: + backtick (`) -- due to MySQL + double quote (") -- due to Oracle + brackets ([ or ]) -- due to Access

Delimited identifiers are known to generally work correctly under the following drivers: + mssql + mysql + mysqli + oci8 + pgsql + sqlite

InterBase doesn't seem to be able to use delimited identifiers via PHP 4. They work fine under PHP 5.

Parameters

string $str identifier name to be quoted
bool $checkOption check the 'quote_identifier' option

Return Value

string quoted identifier string

string quoteMultipleIdentifier(array $arr, bool $checkOption = true)

quoteMultipleIdentifier Quotes multiple identifier strings

Parameters

array $arr identifiers array to be quoted
bool $checkOption check the 'quote_identifier' option

Return Value

string quoted identifier string

string quote(mixed $input, string $type = null)

quote quotes given input parameter

Parameters

mixed $input parameter to be quoted
string $type

Return Value

string

string fixSequenceName(string $sqn)

Removes any formatting in an sequence name using the 'seqname_format' option

Parameters

string $sqn string that containts name of a potential sequence

Return Value

string name of the sequence with possible formatting removed

string fixIndexName(string $idx)

Removes any formatting in an index name using the 'idxname_format' option

Parameters

string $idx string that containts name of anl index

Return Value

string name of the index with possible formatting removed

string getSequenceName(string $sqn)

adds sequence name formatting to a sequence name

Parameters

string $sqn name of the sequence

Return Value

string formatted sequence name

string getIndexName(string $idx)

adds index name formatting to a index name

Parameters

string $idx name of the index

Return Value

string formatted index name

string getForeignKeyName(string $fkey)

Formatting a foreign Key name

Parameters

string $fkey name of the foreign key

Return Value

string formatted foreign key name

string getTableName(string $table)

adds table name formatting to a table name

Parameters

string $table name of the table

Return Value

string formatted table name