Propel 2 API
Class

Propel\Generator\Model\Database

class Database extends ScopedMappingModel

A class for holding application data structures.

Constants

DEFAULT_STRING_FORMAT

Methods

__construct(string $name = null)

Constructs a new Database object.

string getNamespace()

Returns the namespace.

from ScopedMappingModel
setNamespace(string $namespace)

Sets the namespace.

from ScopedMappingModel
boolean isAbsoluteNamespace(string $namespace)

Returns whether or not the namespace is absolute.

from ScopedMappingModel
string getPackage()

Returns the package name.

from ScopedMappingModel
setPackage(string $package)

Sets the package name.

from ScopedMappingModel
string getSchema()

Returns the schema name.

from ScopedMappingModel
setSchema(string $schema)

Sets the schema name.

from ScopedMappingModel
PlatformInterface getPlatform()

Returns the PlatformInterface implementation for this database.

setPlatform(PlatformInterface $platform = null)

Sets the PlatformInterface implementation for this database.

string getName()

Returns the database name.

setName(string $name)

Sets the database name.

string getBaseClass()

Returns the name of the base super class inherited by active record objects.

setBaseClass($class)

Sets the name of the base super class inherited by active record objects.

string getDefaultIdMethod()

Returns the name of the default ID method strategy.

setDefaultIdMethod(string $strategy)

Sets the name of the default ID method strategy.

string getDefaultPhpNamingMethod()

Returns the name of the default PHP naming method strategy, which specifies the method for converting schema names for table and column to PHP names.

setDefaultPhpNamingMethod(string $strategy)

Sets name of the default PHP naming method strategy.

static array getSupportedStringFormats()

Returns the list of supported string formats

setDefaultStringFormat(string $format)

Sets the default string format for ActiveRecord objects in this table.

string getDefaultStringFormat()

Returns the default string format for ActiveRecord objects in this table.

boolean isHeavyIndexing()

Returns whether or not heavy indexing is enabled.

boolean getHeavyIndexing()

Returns whether or not heavy indexing is enabled.

setHeavyIndexing(boolean $heavyIndexing)

Sets whether or not heavy indexing is enabled.

array getTables()

Return the list of all tables.

integer countTables()

Return the number of tables in the database.

array getTablesForSql()

Returns the list of all tables that have a SQL representation.

boolean hasTable(string $name, boolean $caseInsensitive = false)

Returns whether or not the database has a table.

Table getTable(string $name, boolean $caseInsensitive = false)

Returns the table with the specified name.

boolean hasTableByPhpName(string $phpName)

Returns whether or not the database has a table identified by its PHP name.

Table getTableByPhpName(string $phpName)

Returns the table object with the specified PHP name.

Table addTable(Table|array $table)

Adds a new table to this database.

setParentSchema(Schema $parent)

Sets the parent schema

Schema getParentSchema()

Returns the parent schema

Domain addDomain(Domain|array $data)

Adds a domain object to this database.

Domain getDomain(string $name)

Returns the already configured domain object by its name.

GeneratorConfigInterface getGeneratorConfig()

Returns the GeneratorConfigInterface object.

string getBuildProperty(string $name)

Returns the build property identified by its name.

Behavior addBehavior(Behavior|array $bdata)

Adds a new behavior to the database*

array getBehaviors()

Returns the list of all database behaviors.

boolean hasBehavior(string $name)

Returns whether or not the database has a specific behavior.

Behavior getBehavior(string $name)

Returns the corresponding behavior identified by its name.

string getTablePrefix()

Returns the table prefix for this database.

Behavior getNextTableBehavior()

Returns the next behavior on all tables, ordered by behavior priority, and skipping the ones that were already executed.

doFinalInitialization()

Finalizes the setup process.

appendXml(DOMNode $node)

Details

at line 55
public __construct(string $name = null)

Constructs a new Database object.

Parameters

string $name

in ScopedMappingModel at line 57
public string getNamespace()

Returns the namespace.

Return Value

string

in ScopedMappingModel at line 67
public setNamespace(string $namespace)

Sets the namespace.

Parameters

string $namespace

in ScopedMappingModel at line 90
public boolean isAbsoluteNamespace(string $namespace)

Returns whether or not the namespace is absolute.

A namespace is absolute if it starts with a "\".

Parameters

string $namespace

Return Value

boolean

in ScopedMappingModel at line 100
public string getPackage()

Returns the package name.

Return Value

string

in ScopedMappingModel at line 110
public setPackage(string $package)

Sets the package name.

Parameters

string $package

in ScopedMappingModel at line 125
public string getSchema()

Returns the schema name.

Return Value

string

in ScopedMappingModel at line 135
public setSchema(string $schema)

Sets the schema name.

Parameters

string $schema

at line 94
public PlatformInterface getPlatform()

Returns the PlatformInterface implementation for this database.

Return Value

PlatformInterface

at line 104
public setPlatform(PlatformInterface $platform = null)

Sets the PlatformInterface implementation for this database.

Parameters

PlatformInterface $platform A Platform implementation

at line 114
public string getName()

Returns the database name.

Return Value

string

at line 124
public setName(string $name)

Sets the database name.

Parameters

string $name

at line 135
public string getBaseClass()

Returns the name of the base super class inherited by active record objects.

This parameter is overridden at the table level.

Return Value

string

at line 146
public setBaseClass($class)

Sets the name of the base super class inherited by active record objects.

This parameter is overridden at the table level.

Parameters

$class

at line 157
public string getDefaultIdMethod()

Returns the name of the default ID method strategy.

This parameter can be overridden at the table level.

Return Value

string

at line 168
public setDefaultIdMethod(string $strategy)

Sets the name of the default ID method strategy.

This parameter can be overridden at the table level.

Parameters

string $strategy

at line 180
public string getDefaultPhpNamingMethod()

Returns the name of the default PHP naming method strategy, which specifies the method for converting schema names for table and column to PHP names.

This parameter can be overridden at the table layer.

Return Value

string

at line 190
public setDefaultPhpNamingMethod(string $strategy)

Sets name of the default PHP naming method strategy.

Parameters

string $strategy

at line 200
static public array getSupportedStringFormats()

Returns the list of supported string formats

Return Value

array

at line 214
public setDefaultStringFormat(string $format)

Sets the default string format for ActiveRecord objects in this table.

This parameter can be overridden at the table level.

Any of 'XML', 'YAML', 'JSON', or 'CSV'.

Parameters

string $format

Exceptions

InvalidArgumentException

at line 232
public string getDefaultStringFormat()

Returns the default string format for ActiveRecord objects in this table.

This parameter can be overridden at the table level.

Return Value

string

at line 244
public boolean isHeavyIndexing()

Returns whether or not heavy indexing is enabled.

This is an alias for getHeavyIndexing().

Return Value

boolean

at line 256
public boolean getHeavyIndexing()

Returns whether or not heavy indexing is enabled.

This is an alias for isHeavyIndexing().

Return Value

boolean

at line 266
public setHeavyIndexing(boolean $heavyIndexing)

Sets whether or not heavy indexing is enabled.

Parameters

boolean $heavyIndexing

at line 276
public array getTables()

Return the list of all tables.

Return Value

array

at line 286
public integer countTables()

Return the number of tables in the database.

Return Value

integer

at line 303
public array getTablesForSql()

Returns the list of all tables that have a SQL representation.

Return Value

array

at line 322
public boolean hasTable(string $name, boolean $caseInsensitive = false)

Returns whether or not the database has a table.

Parameters

string $name
boolean $caseInsensitive

Return Value

boolean

at line 338
public Table getTable(string $name, boolean $caseInsensitive = false)

Returns the table with the specified name.

Parameters

string $name
boolean $caseInsensitive

Return Value

Table

at line 358
public boolean hasTableByPhpName(string $phpName)

Returns whether or not the database has a table identified by its PHP name.

Parameters

string $phpName

Return Value

boolean

at line 369
public Table getTableByPhpName(string $phpName)

Returns the table object with the specified PHP name.

Parameters

string $phpName

Return Value

Table

at line 384
public Table addTable(Table|array $table)

Adds a new table to this database.

Parameters

Table|array $table

Return Value

Table

at line 452
public setParentSchema(Schema $parent)

Sets the parent schema

Parameters

Schema $parent The parent schema

at line 462
public Schema getParentSchema()

Returns the parent schema

Return Value

Schema

at line 473
public Domain addDomain(Domain|array $data)

Adds a domain object to this database.

Parameters

Domain|array $data

Return Value

Domain

at line 496
public Domain getDomain(string $name)

Returns the already configured domain object by its name.

Parameters

string $name

Return Value

Domain

at line 510
public GeneratorConfigInterface getGeneratorConfig()

Returns the GeneratorConfigInterface object.

Return Value

GeneratorConfigInterface

at line 525
public string getBuildProperty(string $name)

Returns the build property identified by its name.

Parameters

string $name

Return Value

string

at line 540
public Behavior addBehavior(Behavior|array $bdata)

Adds a new behavior to the database*

Parameters

Behavior|array $bdata

Return Value

Behavior

at line 562
public array getBehaviors()

Returns the list of all database behaviors.

Return Value

array

at line 573
public boolean hasBehavior(string $name)

Returns whether or not the database has a specific behavior.

Parameters

string $name

Return Value

boolean

at line 584
public Behavior getBehavior(string $name)

Returns the corresponding behavior identified by its name.

Parameters

string $name

Return Value

Behavior

at line 598
public string getTablePrefix()

Returns the table prefix for this database.

Return Value

string

at line 609
public Behavior getNextTableBehavior()

Returns the next behavior on all tables, ordered by behavior priority, and skipping the ones that were already executed.

Return Value

Behavior

at line 633
public doFinalInitialization()

Finalizes the setup process.

at line 678
public appendXml(DOMNode $node)

Parameters

DOMNode $node