xPDOA wrapper for PDO that powers an object-relational data model.
xPDO provides centralized data access via a simple object-oriented API, to a defined data structure. It provides the de facto methods for connecting to a data source, getting persistence metadata for any class extended from the xPDOObject class (core or custom), loading data source managers when needed to manage table structures, and retrieving instances (or rows) of any object in the model.
Through various extensions, you can also reverse and forward engineer classes and metadata maps for xPDO, have classes, models, and properties maintain their own containers (databases, tables, columns, etc.) or changes to them, and much more.
Located in /xpdo.class.php (line 93)
xPDO
__construct
(mixed $dsn, [string $username = ''], [string $password = ''], [array|string $options = array()], [mixed $driverOptions = null])
array|string|null
fromCache
(string|xPDOCriteria $signature, [string $class = ''], [array $options = array()])
object The
getCacheManager
([string $class = 'cache.xPDOCacheManager'], [ $options = array('path' => XPDO_CORE_PATH, 'ignorePkg' => true)], string $path, boolean $ignorePkg)
array|null
getCollection
(string $className, [object|array|string $criteria = null], [mixed $cacheFlag = false])
array
getCollectionGraph
(string $className, string|array $graph, [mixed $criteria = null], [boolean $cacheFlag = true])
xPDOCriteria
getCriteria
(string $className, [string $type = null], [boolean|integer $cacheFlag = true])
object The
getObjectGraph
(string $className, string|array $graph, [mixed $criteria = null], [boolean|integer $cacheFlag = true])
string
getSelectColumns
(string $className, [string $tableAlias = ''], [string $columnPrefix = ''], [array $columns = array ()], [boolean $exclude = false])
object The
getService
(string $name, [string $class = ''], [string $path = ''], [array $params = array ()])
void
log
(integer $level, string $msg, [string $target = ''], [string $def = ''], [string $file = ''], [string $line = ''])
boolean
toCache
(string|xPDOCriteria $signature, object $object, [integer $lifetime = 0], [array $options = array()])
void
_log
(integer $level, string $msg, [string $target = ''], [string $def = ''], [string $file = ''], [string $line = ''])
xPDOCacheManager
$cacheManager
= null (line 180)
Constants
array
$config
= null (line 144)
A array of xPDO configuration attributes.
Constants
int
$executedQueries
= 0 (line 197)
Constants
integer
$logLevel
= xPDO::LOG_LEVEL_FATAL (line 206)
Constants
string
$logTarget
= 'ECHO' (line 211)
Constants
xPDOManager
$manager
= null (line 175)
xPDOManager instance, loaded only if needed to manage datasource containers, data structures, etc.
Constants
array
$map
= array () (line 156)
A map of data source meta data for all loaded classes.
Constants
string
$package
= '' (line 162)
A default package for specifying classes by name.
Constants
array
$packages
= array () (line 168)
An array storing packages and package-specific information.
Constants
PDO
$pdo
= null (line 138)
A PDO instance used by xPDO for database access.
Constants
int
$queryTime
= 0 (line 201)
Constants
array
$services
= array () (line 188)
Constants
float
$startTime
= 0 (line 193)
Constants
boolean
$_cacheEnabled
= false (line 224)
A global cache flag that can be used to enable/disable all xPDO caching.
Constants
boolean
$_debug
= false (line 218)
Indicates the debug state of this instance.
Constants
string
$_escapeCharClose
= '' (line 236)
Indicates the closing escape character used for a particular database engine.
Constants
string
$_escapeCharOpen
= '' (line 230)
Indicates the opening escape character used for a particular database engine.
Constants
static escSplit (line 2109)
Splits a string on a specified character, ignoring escaped content.
Constants
static parseDSN (line 1689)
Parses a DSN and returns an array of the connection details.
Constants
Constructor __construct (line 255)
The xPDO Constructor.
Constants
This method is used to create a new xPDO object with a connection to a specific database container.
addDerivativeCriteria (line 890)
Add criteria when requesting a derivative class row automatically.
Constants
This applies class_key filtering for single-table inheritance queries and may provide a convenient location for similar features in the future.
addPackage (line 389)
Adds a model package and base class path for including classes and/or maps from.
Constants
beginTransaction (line 1921)
Constants
call (line 558)
Call a static method from a valid package class with arguments.
Constants
Will always search for database-specific class files first.
commit (line 1931)
Constants
connect (line 318)
Create the PDO connection to a database specified in the configuration.
Constants
errorCode (line 1957)
Constants
errorInfo (line 1967)
Constants
escape (line 1645)
Escapes the provided string using the platform-specific escape character.
Constants
Different database engines escape string literals in SQL using different characters. For example, this is used to escape column names that might match a reserved string for that SQL interpreter. To write database agnostic queries with xPDO, it is highly recommend to escape any database or column names in any native SQL strings used.
exec (line 1941)
Constants
fromCache (line 1721)
Retrieves a result array from the object cache.
Constants
fromJSON (line 1899)
Converts a JSON source string into an equivalent PHP representation.
Constants
getAggregates (line 1228)
Gets a collection of aggregate foreign key relationship definitions.
Constants
getAncestry (line 1271)
Retrieves the complete ancestry for a class.
Constants
getAttribute (line 1977)
Constants
getCacheManager (line 1428)
Gets the xPDOCacheManager instance.
Constants
This class is responsible for handling all types of caching operations for the xPDO core.
getCachePath (line 1407)
Gets the absolute path to the cache directory.
Constants
getCollection (line 679)
Retrieves a collection of xPDOObjects by the specified xPDOCriteria.
Constants
getCollectionGraph (line 838)
Retrieves a collection of xPDOObject instances with related objects.
Constants
getComposites (line 1248)
Gets a collection of composite foreign key relationship definitions.
Constants
getCount (line 773)
Retrieves a count of xPDOObjects by the specified xPDOCriteria.
Constants
getCriteria (line 859)
Convert any valid criteria into an xPDOQuery instance.
Constants
getCriteriaType (line 869)
Validate and return the type of a specified criteria variable.
Constants
getDebug (line 1444)
Returns the debug state for the XPDO connection.
Constants
getDebugBacktrace (line 1592)
Returns an abbreviated backtrace of debugging information.
Constants
This function returns just the fields returned via xPDOObject::toArray() on xPDOObject instances, and simply the classname for other objects, to reduce the amount of unnecessary information returned.
getDriver (line 1388)
Gets the driver class for this xPDO connection.
Constants
The driver class provides baseline data and operations for a specific database driver.
getFieldMeta (line 1079)
Gets a list of field (or column) definitions for an object by class name.
Constants
These definitions are used by the objects themselves to build their own meta data based on class inheritence.
getFields (line 1053)
Gets a list of fields (or columns) for an object by class name.
Constants
This includes default values for each field and is used by the objects themselves to build their initial attributes based on class inheritence.
getFKDefinition (line 1315)
Gets an aggregate or composite relation definition from a class.
Constants
getIndexMeta (line 1125)
Get indices defined for a table class.
Constants
getIterator (line 694)
Retreives an iterable representation of a collection of xPDOObjects.
Constants
getLogLevel (line 1472)
Constants
getLogTarget (line 1503)
Constants
getManager (line 1365)
Gets the manager class for this xPDO connection.
Constants
The manager class can perform operations such as creating or altering table structures, creating data containers, generating custom persistence classes, and other advanced operations that do not need to be loaded frequently.
getMicroTime (line 2068)
Convert current microtime() result into seconds.
Constants
getModelVersion (line 1344)
Gets the version string of the schema the specified class was generated from.
Constants
getObject (line 658)
Retrieves a single object instance by the specified criteria.
Constants
The criteria can be a primary key value, and array of primary key values (for multiple primary key objects) or an xPDOCriteria object. If no $criteria parameter is specified, no class is found, or an object cannot be located by the supplied criteria, null is returned.
getObjectGraph (line 812)
Retrieves an xPDOObject instance with specified related objects.
Constants
getObjectLoader (line 620)
Finds the class responsible for loading instances of the specified class.
Constants
getOption (line 516)
Get an xPDO configuration option value by key.
Constants
getPackage (line 918)
Gets the package name from a specified class name.
Constants
getPDOType (line 2210)
Get the appropriate PDO::PARAM_ type constant from a PHP value.
Constants
getPK (line 1151)
Gets the primary key field(s) for a class.
Constants
getPKType (line 1194)
Gets the type of primary key field for a class.
Constants
getSelectColumns (line 1303)
Gets select columns from a specific class for building a query.
Constants
getService (line 945)
Load and return a named service class instance.
Constants
getTableMeta (line 1023)
Gets the actual run-time table metadata from a specified class name.
Constants
getTableName (line 982)
Gets the actual run-time table name from a specified class name.
Constants
getValidationRules (line 1102)
Gets a set of validation rules defined for an object by class name.
Constants
lastInsertId (line 1987)
Constants
literal (line 1656)
Use to insert a literal string into a SQL query without escaping or quoting.
Constants
loadClass (line 424)
Load a class by fully qualified name.
Constants
The $fqn should in the format:
dir_a.dir_b.dir_c.classname
which will translate to:
XPDO_CORE_PATH/om/dir_a/dir_b/dir_c/dbtype/classname.class.php
log (line 1519)
Log a message with details about where and when an event occurs.
Constants
newObject (line 598)
Creates a new instance of a specified class.
Constants
All new objects created with this method are transient until xPDOObject::save() is called the first time and is reflected by the xPDOObject::$_new property.
newQuery (line 2082)
Creates an new xPDOQuery for a specified xPDOObject class.
Constants
parseBindings (line 2156)
Parses parameter bindings in SQL prepared statements.
Constants
prepare (line 1997)
Constants
query (line 2007)
Constants
quote (line 2023)
Constants
removeCollection (line 741)
Remove a collection of instances by the supplied className and criteria.
Constants
removeObject (line 705)
Remove an instance of the specified className by a supplied criteria.
Constants
rollBack (line 2045)
Constants
setAttribute (line 2055)
Constants
setDebug (line 1453)
Sets the debug state for the XPDO connection.
Constants
setLogLevel (line 1463)
Sets the logging level state for the XPDO instance.
Constants
setLogTarget (line 1494)
Sets the log target for xPDO::_log() calls.
Constants
Valid target values include:
setOption (line 542)
Sets an xPDO configuration option value.
Constants
setPackage (line 370)
Sets a specific model package to use when looking up classes.
Constants
This package is of the form package.subpackage.subsubpackage and will be added to the beginning of every xPDOObject class that is referenced in xPDO methods such as xPDO::loadClass(), xPDO::getObject(), xPDO::getCollection(), xPDOObject::getOne(), xPDOObject::addOne(), etc.
toCache (line 1782)
Places a result set in the object cache.
Constants
toJSON (line 1875)
Converts a PHP array into a JSON encoded string.
Constants
_getLogLevel (line 1614)
Gets a logging level as a string representation.
Constants
_loadClass (line 484)
Constants
_log (line 1535)
Log a message as appropriate for the level and target.
Constants
LOG_LEVEL_DEBUG
= 4
(line 129)
Constants
LOG_LEVEL_ERROR
= 1
(line 126)
Constants
LOG_LEVEL_FATAL
= 0
(line 125)
Constants
LOG_LEVEL_INFO
= 3
(line 128)
Constants
LOG_LEVEL_WARN
= 2
(line 127)
Constants
OPT_BASE_CLASSES
= 'base_classes'
(line 97)
Constants
OPT_BASE_PACKAGES
= 'base_packages'
(line 98)
Constants
OPT_CACHE_COMPRESS
= 'cache_compress'
(line 99)
Constants
OPT_CACHE_DB
= 'cache_db'
(line 100)
Constants
OPT_CACHE_DB_COLLECTIONS
= 'cache_db_collections'
(line 101)
Constants
OPT_CACHE_DB_EXPIRES
= 'cache_db_expires'
(line 103)
Constants
OPT_CACHE_DB_HANDLER
= 'cache_db_handler'
(line 104)
Constants
OPT_CACHE_DB_OBJECTS_BY_PK
= 'cache_db_objects_by_pk'
(line 102)
Constants
OPT_CACHE_EXPIRES
= 'cache_expires'
(line 105)
Constants
OPT_CACHE_HANDLER
= 'cache_handler'
(line 106)
Constants
OPT_CACHE_KEY
= 'cache_key'
(line 107)
Constants
OPT_CACHE_PATH
= 'cache_path'
(line 108)
Constants
OPT_CALLBACK_ON_REMOVE
= 'callback_on_remove'
(line 109)
Constants
OPT_CALLBACK_ON_SAVE
= 'callback_on_save'
(line 110)
Constants
OPT_HYDRATE_ADHOC_FIELDS
= 'hydrate_adhoc_fields'
(line 112)
Constants
OPT_HYDRATE_FIELDS
= 'hydrate_fields'
(line 111)
Constants
OPT_HYDRATE_RELATED_OBJECTS
= 'hydrate_related_objects'
(line 113)
Constants
OPT_LOADER_CLASSES
= 'loader_classes'
(line 118)
Constants
OPT_ON_SET_STRIPSLASHES
= 'on_set_stripslashes'
(line 119)
Constants
OPT_SETUP
= 'setup'
(line 120)
Constants
OPT_TABLE_PREFIX
= 'table_prefix'
(line 121)
Constants
OPT_VALIDATE_ON_SAVE
= 'validate_on_save'
(line 122)
Constants
OPT_VALIDATOR_CLASS
= 'validator_class'
(line 123)
Constants
SCHEMA_VERSION
= '1.1'
(line 131)
Constants
Documentation generated on Mon, 27 Dec 2010 11:08:26 -0700 by phpDocumentor 1.4.3