xpdo/om/xpdomanager.class.php
- package
- xpdo
- subpackage
- om
- Classes
- xPDOManager
Description
The xPDOManager class provides data source management.
\xPDOManager
- abstract
- package
- xpdo
- subpackage
- om
- Properties
- $generator
- $transport
- $xpdo
- Methods
- __construct
- addConstraint
- addField
- addIndex
- alterField
- alterObjectContainer
- createObjectContainer
- createSourceContainer
- getColumnDef
- getGenerator
- getIndexDef
- getTransport
- removeConstraint
- removeField
- removeIndex
- removeObjectContainer
- removeSourceContainer
Description
Provides 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 should include this base class in order to extend it.
Properties
$generator
\xPDOGenerator $generator = 'null'
Details
-
\xPDOGenerator
The generator class for forward and reverse engineering tasks (loaded only on demand). - visibility
- public
- default
- null
- final
- false
- static
- false
$transport
\xPDOTransport $transport = 'null'
Details
-
\xPDOTransport
The data transport class for migrating data. - visibility
- public
- default
- null
- final
- false
- static
- false
$xpdo
Methods
__construct
__construct(
object $xpdo
)
:
Get a xPDOManager instance.
Arguments
- $xpdo
- object
A reference to a specific modDataSource instance.
Details
- visibility
- public
- final
- false
- static
- false
addConstraint
addConstraint(
string $class, string $name, array $options
=
array
)
:
boolean
Add a constraint to an object container, e.g. ADD CONSTRAINT.
Arguments
- $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.
Output
- boolean
- True if the constraint is added successfully, otherwise false.
Details
- visibility
- public
- final
- false
- static
- false
addField
addField(
string $class, string $name, array $options
=
array
)
:
boolean
Add a field to an object container, e.g. ADD COLUMN.
Arguments
- $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.
Output
- boolean
- True if the column is added successfully, otherwise false.
Details
- visibility
- public
- final
- false
- static
- false
addIndex
addIndex(
string $class, string $name, array $options
=
array
)
:
boolean
Add an index to an object container, e.g. ADD INDEX.
Arguments
- $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.
Output
- boolean
- True if the index is added successfully, otherwise false.
Details
- visibility
- public
- final
- false
- static
- false
alterField
alterField(
string $class, string $name, array $options
=
array
)
:
boolean
Alter an existing field of an object container, e.g. ALTER COLUMN.
Arguments
- $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.
Output
- boolean
- True if the column is altered successfully, otherwise false.
Details
- visibility
- public
- final
- false
- static
- false
alterObjectContainer
alterObjectContainer(
string $className, array $options
=
array
)
:
boolean
Alter the structure of an existing persistent data object container.
Arguments
- $className
- string
The class of object to alter the container of. - $options
- array
An array of options describing the alterations to be made.
Output
- boolean
- Returns true on successful alteration, false on failure.
Details
- visibility
- public
- final
- false
- static
- false
createObjectContainer
createObjectContainer(
string $className
)
:
boolean
Creates the container for a persistent data object.
An object container is a synonym for a database table.
Arguments
- $className
- string
The class of object to create a source container for.
Output
- boolean
- Returns true on successful creation, false on failure.
Details
- visibility
- public
- final
- false
- static
- false
createSourceContainer
createSourceContainer(
array $dsnArray
=
null, string $username
=
null, string $password
=
null, array $containerOptions
=
array
)
:
boolean
Creates the physical container representing a data source.
Arguments
- $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.
Output
- boolean
- True if the database is created successfully or already exists.
Details
- visibility
- public
- final
- false
- static
- false
getColumnDef
getColumnDef(
string $class, string $name, string $meta, array $options
=
array
)
:
string
Get the SQL necessary to define a column for a specific database engine.
Arguments
- $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.
Output
- string
- A string of SQL representing the column definition.
Details
- visibility
- protected
- final
- false
- static
- false
getGenerator
getGenerator(
)
:
\xPDOGenerator
Gets an XML schema parser / generator for this manager instance.
Output
- \xPDOGenerator
- A generator class for this manager.
Details
- visibility
- public
- final
- false
- static
- false
getIndexDef
getIndexDef(
string $class, string $name, string $meta, array $options
=
array
)
:
string
Get the SQL necessary to define an index for a specific database engine.
Arguments
- $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.
Output
- string
- A string of SQL representing the index definition.
Details
- visibility
- protected
- final
- false
- static
- false
getTransport
getTransport(
)
:
Gets a data transport mechanism for this xPDOManager instance.
Details
- visibility
- public
- final
- false
- static
- false
removeConstraint
removeConstraint(
string $class, string $name, array $options
=
array
)
:
boolean
Remove a constraint from an object container, e.g. DROP CONSTRAINT.
Arguments
- $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.
Output
- boolean
- True if the constraint is dropped successfully, otherwise false.
Details
- visibility
- public
- final
- false
- static
- false
removeField
removeField(
string $class, string $name, array $options
=
array
)
:
boolean
Remove a field from an object container, e.g. DROP COLUMN.
Arguments
- $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.
Output
- boolean
- True if the column is dropped successfully, otherwise false.
Details
- visibility
- public
- final
- false
- static
- false
removeIndex
removeIndex(
string $class, string $name, array $options
=
array
)
:
boolean
Remove an index from an object container, e.g. DROP INDEX.
Arguments
- $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.
Output
- boolean
- True if the index is dropped successfully, otherwise false.
Details
- visibility
- public
- final
- false
- static
- false
removeObjectContainer
removeObjectContainer(
string $className
)
:
boolean
Drop an object container (i.e. database table), if it exists.
Arguments
- $className
- string
The object container to drop.
Output
- boolean
- Returns true on successful drop, false on failure.
Details
- visibility
- public
- final
- false
- static
- false
removeSourceContainer
removeSourceContainer(
$dsnArray
=
null, string $username
=
null, string $password
=
null
)
:
boolean
Drops a physical data source container, if it exists.
Arguments
- $dsnArray
- $username
- string
Database username with privileges to drop tables. - $password
- string
Database user password.
Output
- boolean
- Returns true on successful drop, false on failure.
Details
- visibility
- public
- final
- false
- static
- false