core/xpdo/om/mysql/xpdomanager.class.php
The MySQL implementation of the xPDOManager class.
- Package
- xpdo
- Subpackage
- om.mysql
\xPDOManager_mysql
Provides MySQL data source management for an xPDO instance.
These are utility functions that only need to be loaded under special circumstances, such as creating tables, adding indexes, altering table structures, etc. xPDOManager class implementations are specific to a database driver and this instance is implemented for MySQL.
- Parent(s)
- \xPDOManager
Properties
\xPDOGenerator
$generator= 'null'
null
Details- Type
- \xPDOGenerator
- Inherited_from
- \xPDOManager::$$generator
\xPDOTransport
$transport= 'null'
null
Details- Type
- \xPDOTransport
- Inherited_from
- \xPDOManager::$$transport
\xPDO
$xpdo= 'null'
null
Details- Type
- \xPDO
- Access
- public
- Inherited_from
- \xPDOManager::$$xpdo
Methods
__construct(
object $xpdo
)
:
void
Name | Type | Description |
---|---|---|
$xpdo | object | A reference to a specific modDataSource instance. |
addConstraint(
string $class, string $name, array $options
=
array()
)
:
boolean
Add a constraint to an object container, e.g. ADD CONSTRAINT.
Name | Type | Description |
---|---|---|
$class | string | The object class to add the constraint to. |
$name | string | The name of the constraint to add. |
$options | array | An array of options for the process. |
Type | Description |
---|---|
boolean | True if the constraint is added successfully, otherwise false. |
addField(
string $class, string $name, array $options
=
array()
)
:
boolean
Add a field to an object container, e.g. ADD COLUMN.
Name | Type | Description |
---|---|---|
$class | string | The object class to add the field to. |
$name | string | The name of the field to add. |
$options | array | An array of options for the process. |
Type | Description |
---|---|
boolean | True if the column is added successfully, otherwise false. |
addIndex(
string $class, string $name, array $options
=
array()
)
:
boolean
Add an index to an object container, e.g. ADD INDEX.
Name | Type | Description |
---|---|---|
$class | string | The object class to add the index to. |
$name | string | The name of the index to add. |
$options | array | An array of options for the process. |
Type | Description |
---|---|
boolean | True if the index is added successfully, otherwise false. |
alterField(
string $class, string $name, array $options
=
array()
)
:
boolean
Alter an existing field of an object container, e.g. ALTER COLUMN.
Name | Type | Description |
---|---|---|
$class | string | The object class to alter the field of. |
$name | string | The name of the field to alter. |
$options | array | An array of options for the process. |
Type | Description |
---|---|
boolean | True if the column is altered successfully, otherwise false. |
alterObjectContainer(
string $className, array $options
=
array()
)
:
boolean
Alter the structure of an existing persistent data object container.
Name | Type | Description |
---|---|---|
$className | string | The class of object to alter the container of. |
$options | array | An array of options describing the alterations to be made. |
Type | Description |
---|---|
boolean | Returns true on successful alteration, false on failure. |
createObjectContainer(
string $className
)
:
boolean
Creates the container for a persistent data object.
An object container is a synonym for a database table.
Name | Type | Description |
---|---|---|
$className | string | The class of object to create a source container for. |
Type | Description |
---|---|
boolean | Returns true on successful creation, false on failure. |
createSourceContainer(
array $dsnArray
=
null, string $username
=
null, string $password
=
null, array $containerOptions
=
array ()
)
:
boolean
Creates the physical container representing a data source.
Name | Type | Description |
---|---|---|
$dsnArray | array | An array of xPDO configuration properties. |
$username | string | Database username with privileges to create tables. |
$password | string | Database user password. |
$containerOptions | array | An array of options for controlling the creation of the container. |
Type | Description |
---|---|
boolean | True if the database is created successfully or already exists. |
getColumnDef(
string $class, string $name, string $meta, array $options
=
array()
)
:
string
Get the SQL necessary to define a column for a specific database engine.
Name | Type | Description |
---|---|---|
$class | string | The name of the class the column represents a field of. |
$name | string | The name of the field and physical database column. |
$meta | string | The metadata defining the field. |
$options | array | An array of options for the process. |
Type | Description |
---|---|
string | A string of SQL representing the column definition. |
getGenerator(
)
:
\xPDOGenerator
Gets an XML schema parser / generator for this manager instance.
Inherited from: \xPDOManager::getGenerator()Type | Description |
---|---|
\xPDOGenerator | A generator class for this manager. |
getIndexDef(
string $class, string $name, string $meta, array $options
=
array()
)
:
string
Get the SQL necessary to define an index for a specific database engine.
Name | Type | Description |
---|---|---|
$class | string | The name of the class the index is defined for. |
$name | string | The name of the index. |
$meta | string | The metadata defining the index. |
$options | array | An array of options for the process. |
Type | Description |
---|---|
string | A string of SQL representing the index definition. |
getTransport(
)
:
void
Gets a data transport mechanism for this xPDOManager instance.
Inherited from: \xPDOManager::getTransport()removeConstraint(
string $class, string $name, array $options
=
array()
)
:
boolean
Remove a constraint from an object container, e.g. DROP CONSTRAINT.
Name | Type | Description |
---|---|---|
$class | string | The object class to drop the constraint from. |
$name | string | The name of the constraint to drop. |
$options | array | An array of options for the process. |
Type | Description |
---|---|
boolean | True if the constraint is dropped successfully, otherwise false. |
removeField(
string $class, string $name, array $options
=
array()
)
:
boolean
Remove a field from an object container, e.g. DROP COLUMN.
Name | Type | Description |
---|---|---|
$class | string | The object class to drop the field from. |
$name | string | The name of the field to drop. |
$options | array | An array of options for the process. |
Type | Description |
---|---|
boolean | True if the column is dropped successfully, otherwise false. |
removeIndex(
string $class, string $name, array $options
=
array()
)
:
boolean
Remove an index from an object container, e.g. DROP INDEX.
Name | Type | Description |
---|---|---|
$class | string | The object class to drop the index from. |
$name | string | The name of the index to drop. |
$options | array | An array of options for the process. |
Type | Description |
---|---|
boolean | True if the index is dropped successfully, otherwise false. |
removeObjectContainer(
string $className
)
:
boolean
Drop an object container (i.e. database table), if it exists.
Name | Type | Description |
---|---|---|
$className | string | The object container to drop. |
Type | Description |
---|---|
boolean | Returns true on successful drop, false on failure. |
removeSourceContainer(
$dsnArray
=
null, string $username
=
null, string $password
=
null
)
:
boolean
Drops a physical data source container, if it exists.
Name | Type | Description |
---|---|---|
$dsnArray | ||
$username | string | Database username with privileges to drop tables. |
$password | string | Database user password. |
Type | Description |
---|---|
boolean | Returns true on successful drop, false on failure. |