Reapplied changes to Doctrine.php made by jonwage.
This commit is contained in:
parent
d9112ad1d7
commit
bd2e0d8ec5
713
lib/Doctrine.php
713
lib/Doctrine.php
@ -33,6 +33,25 @@
|
|||||||
*/
|
*/
|
||||||
final class Doctrine
|
final class Doctrine
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* DEPRECATED ATTRIBUTE CONSTANT NAMES AND VALUES
|
||||||
|
*
|
||||||
|
* REMOVE BEFORE 1.0
|
||||||
|
* These were deprecated either because they are not used anymore or because they didn't follow the naming pattern required
|
||||||
|
* by Doctrine attributes
|
||||||
|
*
|
||||||
|
* Attribute names must be ATTR_{ATTR_NAME} and the values must be {ATTR_NAME}_NAME_OF_VALUE
|
||||||
|
*/
|
||||||
|
const LIMIT_ROWS = 1;
|
||||||
|
const LIMIT_RECORDS = 2;
|
||||||
|
const FETCH_IMMEDIATE = 0;
|
||||||
|
const FETCH_BATCH = 1;
|
||||||
|
const FETCH_OFFSET = 3;
|
||||||
|
const FETCH_LAZY_OFFSET = 4;
|
||||||
|
const FETCH_VHOLDER = 1;
|
||||||
|
const FETCH_RECORD = 2;
|
||||||
|
const FETCH_ARRAY = 3;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VERSION
|
* VERSION
|
||||||
*/
|
*/
|
||||||
@ -81,9 +100,9 @@ final class Doctrine
|
|||||||
/**
|
/**
|
||||||
* PDO derived constants
|
* PDO derived constants
|
||||||
*/
|
*/
|
||||||
const CASE_LOWER = 2;
|
|
||||||
const CASE_NATURAL = 0;
|
const CASE_NATURAL = 0;
|
||||||
const CASE_UPPER = 1;
|
const CASE_UPPER = 1;
|
||||||
|
const CASE_LOWER = 2;
|
||||||
const CURSOR_FWDONLY = 0;
|
const CURSOR_FWDONLY = 0;
|
||||||
const CURSOR_SCROLL = 1;
|
const CURSOR_SCROLL = 1;
|
||||||
const ERRMODE_EXCEPTION = 2;
|
const ERRMODE_EXCEPTION = 2;
|
||||||
@ -163,7 +182,6 @@ final class Doctrine
|
|||||||
const ATTR_TBLNAME_FORMAT = 120;
|
const ATTR_TBLNAME_FORMAT = 120;
|
||||||
const ATTR_EXPORT = 140;
|
const ATTR_EXPORT = 140;
|
||||||
const ATTR_DECIMAL_PLACES = 141;
|
const ATTR_DECIMAL_PLACES = 141;
|
||||||
|
|
||||||
const ATTR_PORTABILITY = 106;
|
const ATTR_PORTABILITY = 106;
|
||||||
const ATTR_VALIDATE = 107;
|
const ATTR_VALIDATE = 107;
|
||||||
const ATTR_COLL_KEY = 108;
|
const ATTR_COLL_KEY = 108;
|
||||||
@ -175,12 +193,10 @@ final class Doctrine
|
|||||||
const ATTR_EMULATE_DATABASE = 116;
|
const ATTR_EMULATE_DATABASE = 116;
|
||||||
const ATTR_USE_NATIVE_ENUM = 117;
|
const ATTR_USE_NATIVE_ENUM = 117;
|
||||||
const ATTR_DEFAULT_SEQUENCE = 133;
|
const ATTR_DEFAULT_SEQUENCE = 133;
|
||||||
|
|
||||||
const ATTR_FETCHMODE = 118;
|
const ATTR_FETCHMODE = 118;
|
||||||
const ATTR_NAME_PREFIX = 121;
|
const ATTR_NAME_PREFIX = 121;
|
||||||
const ATTR_CREATE_TABLES = 122;
|
const ATTR_CREATE_TABLES = 122;
|
||||||
const ATTR_COLL_LIMIT = 123;
|
const ATTR_COLL_LIMIT = 123;
|
||||||
|
|
||||||
const ATTR_CACHE = 150;
|
const ATTR_CACHE = 150;
|
||||||
const ATTR_RESULT_CACHE = 150;
|
const ATTR_RESULT_CACHE = 150;
|
||||||
const ATTR_CACHE_LIFESPAN = 151;
|
const ATTR_CACHE_LIFESPAN = 151;
|
||||||
@ -193,7 +209,350 @@ final class Doctrine
|
|||||||
const ATTR_QUERY_CACHE_LIFESPAN = 158;
|
const ATTR_QUERY_CACHE_LIFESPAN = 158;
|
||||||
const ATTR_AUTOLOAD_TABLE_CLASSES = 160;
|
const ATTR_AUTOLOAD_TABLE_CLASSES = 160;
|
||||||
const ATTR_MODEL_LOADING = 161;
|
const ATTR_MODEL_LOADING = 161;
|
||||||
|
const ATTR_LOCK = 162;
|
||||||
|
const ATTR_HYDRATE = 163;
|
||||||
|
const ATTR_IDENTIFIER = 164;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* QUERY_LIMIT CONSTANTS
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* QUERY_LIMIT_ROWS
|
||||||
|
*
|
||||||
|
* constant for row limiting
|
||||||
|
*
|
||||||
|
* @see self::ATTR_QUERY_LIMIT
|
||||||
|
*/
|
||||||
|
const QUERY_LIMIT_ROWS = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* constant for record limiting
|
||||||
|
* @see self::ATTR_QUERY_LIMIT
|
||||||
|
*/
|
||||||
|
const QUERY_LIMIT_RECORDS = 2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* FETCHMODE CONSTANTS
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IMMEDIATE FETCHING
|
||||||
|
* mode for immediate fetching
|
||||||
|
* @see self::ATTR_FETCHMODE
|
||||||
|
*/
|
||||||
|
const FETCHMODE_IMMEDIATE = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* FETCHMODE_BATCH
|
||||||
|
*
|
||||||
|
* mode for batch fetching
|
||||||
|
*
|
||||||
|
* @see self::ATTR_FETCHMODE
|
||||||
|
*/
|
||||||
|
const FETCHMODE_BATCH = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* FETCHMODE_OFFSET
|
||||||
|
*
|
||||||
|
* mode for offset fetching
|
||||||
|
*
|
||||||
|
* @see self::ATTR_FETCHMODE
|
||||||
|
*/
|
||||||
|
const FETCHMODE_OFFSET = 3;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* FETCHMODE_LAZY_OFFSET
|
||||||
|
*
|
||||||
|
* mode for lazy offset fetching
|
||||||
|
*
|
||||||
|
* @see self::ATTR_FETCHMODE
|
||||||
|
*/
|
||||||
|
const FETCHMODE_LAZY_OFFSET = 4;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* FETCHMODE CONSTANTS
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* FETCHMODE_VHOLDER
|
||||||
|
*
|
||||||
|
* @see self::ATTR_FETCHMODE
|
||||||
|
*/
|
||||||
|
const FETCHMODE_VHOLDER = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* FETCHMODE_RECORD
|
||||||
|
*
|
||||||
|
* Specifies that the fetch method shall return Doctrine_Record
|
||||||
|
* objects as the elements of the result set.
|
||||||
|
*
|
||||||
|
* This is the default fetchmode.
|
||||||
|
*
|
||||||
|
* @see self::ATTR_FETCHMODE
|
||||||
|
*/
|
||||||
|
const FETCHMODE_RECORD = 2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* FETCHMODE_ARRAY
|
||||||
|
*
|
||||||
|
* @see self::ATTR_FETCHMODE
|
||||||
|
*/
|
||||||
|
const FETCHMODE_ARRAY = 3;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PORTABILITY CONSTANTS
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PORTABILITY_NONE
|
||||||
|
*
|
||||||
|
* Portability: turn off all portability features.
|
||||||
|
*
|
||||||
|
* @see self::ATTR_PORTABILITY
|
||||||
|
*/
|
||||||
|
const PORTABILITY_NONE = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PORTABILITY_FIX_CASE
|
||||||
|
*
|
||||||
|
* Portability: convert names of tables and fields to case defined in the
|
||||||
|
* "field_case" option when using the query*(), fetch*() methods.
|
||||||
|
*
|
||||||
|
* @see self::ATTR_PORTABILITY
|
||||||
|
*/
|
||||||
|
const PORTABILITY_FIX_CASE = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PORTABILITY_RTRIM
|
||||||
|
*
|
||||||
|
* Portability: right trim the data output by query*() and fetch*().
|
||||||
|
*
|
||||||
|
* @see self::ATTR_PORTABILITY
|
||||||
|
*/
|
||||||
|
const PORTABILITY_RTRIM = 2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PORTABILITY_DELETE_COUNT
|
||||||
|
*
|
||||||
|
* Portability: force reporting the number of rows deleted.
|
||||||
|
*
|
||||||
|
* @see self::ATTR_PORTABILITY
|
||||||
|
*/
|
||||||
|
const PORTABILITY_DELETE_COUNT = 4;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PORTABILITY_EMPTY_TO_NULL
|
||||||
|
*
|
||||||
|
* Portability: convert empty values to null strings in data output by
|
||||||
|
* query*() and fetch*().
|
||||||
|
*
|
||||||
|
* @see self::ATTR_PORTABILITY
|
||||||
|
*/
|
||||||
|
const PORTABILITY_EMPTY_TO_NULL = 8;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PORTABILITY_FIX_ASSOC_FIELD_NAMES
|
||||||
|
*
|
||||||
|
* Portability: removes database/table qualifiers from associative indexes
|
||||||
|
*
|
||||||
|
* @see self::ATTR_PORTABILITY
|
||||||
|
*/
|
||||||
|
const PORTABILITY_FIX_ASSOC_FIELD_NAMES = 16;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PORTABILITY_EXPR
|
||||||
|
*
|
||||||
|
* Portability: makes Doctrine_Expression throw exception for unportable RDBMS expressions
|
||||||
|
*
|
||||||
|
* @see self::ATTR_PORTABILITY
|
||||||
|
*/
|
||||||
|
const PORTABILITY_EXPR = 32;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PORTABILITY_ALL
|
||||||
|
*
|
||||||
|
* Portability: turn on all portability features.
|
||||||
|
*
|
||||||
|
* @see self::ATTR_PORTABILITY
|
||||||
|
*/
|
||||||
|
const PORTABILITY_ALL = 63;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LOCK CONSTANTS
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LOCK_OPTIMISTIC
|
||||||
|
*
|
||||||
|
* mode for optimistic locking
|
||||||
|
* @see self::ATTR_LOCK
|
||||||
|
*/
|
||||||
|
const LOCK_OPTIMISTIC = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LOCK_PESSIMISTIC
|
||||||
|
*
|
||||||
|
* mode for pessimistic locking
|
||||||
|
*
|
||||||
|
* @see self::ATTR_LOCK
|
||||||
|
*/
|
||||||
|
const LOCK_PESSIMISTIC = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* EXPORT CONSTANTS
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* EXPORT_NONE
|
||||||
|
*
|
||||||
|
* @see self::ATTR_EXPORT
|
||||||
|
*/
|
||||||
|
const EXPORT_NONE = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* EXPORT_TABLES
|
||||||
|
*
|
||||||
|
* @see self::ATTR_EXPORT
|
||||||
|
*/
|
||||||
|
const EXPORT_TABLES = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* EXPORT_CONSTRAINTS
|
||||||
|
*
|
||||||
|
* @see self::ATTR_EXPORT
|
||||||
|
*/
|
||||||
|
const EXPORT_CONSTRAINTS = 2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* EXPORT_PLUGINS
|
||||||
|
*
|
||||||
|
* @see self::ATTR_EXPORT
|
||||||
|
*/
|
||||||
|
const EXPORT_PLUGINS = 4;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* EXPORT_ALL
|
||||||
|
*
|
||||||
|
* @see self::ATTR_EXPORT
|
||||||
|
*/
|
||||||
|
const EXPORT_ALL = 7;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HYDRATE CONSTANTS
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HYDRATE_RECORD
|
||||||
|
*
|
||||||
|
* @see self::ATTR_HYDRATE
|
||||||
|
*/
|
||||||
|
const HYDRATE_RECORD = 2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HYDRATE_ARRAY
|
||||||
|
*
|
||||||
|
* @see self::ATTR_HYDRATE
|
||||||
|
*/
|
||||||
|
const HYDRATE_ARRAY = 3;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HYDRATE_NONE
|
||||||
|
*
|
||||||
|
* @see self::ATTR_HYDRATE
|
||||||
|
*/
|
||||||
|
const HYDRATE_NONE = 4;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* VALIDATE CONSTANTS
|
||||||
|
*
|
||||||
|
* @see self::ATTR_VALIDATE
|
||||||
|
*/
|
||||||
|
const VALIDATE_NONE = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* VALIDATE_LENGTHS
|
||||||
|
*
|
||||||
|
* @see self::ATTR_VALIDATE
|
||||||
|
*/
|
||||||
|
const VALIDATE_LENGTHS = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* VALIDATE_TYPES
|
||||||
|
*
|
||||||
|
* @see self::ATTR_VALIDATE
|
||||||
|
*/
|
||||||
|
const VALIDATE_TYPES = 2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* VALIDATE_CONSTRAINTS
|
||||||
|
*
|
||||||
|
* @see self::ATTR_VALIDATE
|
||||||
|
*/
|
||||||
|
const VALIDATE_CONSTRAINTS = 4;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* VALIDATE_ALL
|
||||||
|
*
|
||||||
|
* @see self::ATTR_VALIDATE
|
||||||
|
*/
|
||||||
|
const VALIDATE_ALL = 7;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IDENTIFIER_AUTOINC
|
||||||
|
*
|
||||||
|
* constant for auto_increment identifier
|
||||||
|
*
|
||||||
|
* @see self::ATTR_IDENTIFIER
|
||||||
|
*/
|
||||||
|
const IDENTIFIER_AUTOINC = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IDENTIFIER_SEQUENCE
|
||||||
|
*
|
||||||
|
* constant for sequence identifier
|
||||||
|
*
|
||||||
|
* @see self::ATTR_IDENTIFIER
|
||||||
|
*/
|
||||||
|
const IDENTIFIER_SEQUENCE = 2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IDENTIFIER_NATURAL
|
||||||
|
*
|
||||||
|
* constant for normal identifier
|
||||||
|
*
|
||||||
|
* @see self::ATTR_IDENTIFIER
|
||||||
|
*/
|
||||||
|
const IDENTIFIER_NATURAL = 3;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IDENTIFIER_COMPOSITE
|
||||||
|
*
|
||||||
|
* constant for composite identifier
|
||||||
|
* @see self::ATTR_IDENTIFIER
|
||||||
|
*/
|
||||||
|
const IDENTIFIER_COMPOSITE = 4;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MODEL_LOADING_AGGRESSIVE
|
||||||
|
*
|
||||||
|
* Constant for agressive model loading
|
||||||
|
* Will require_once() all found model files
|
||||||
|
*
|
||||||
|
* @see self::ATTR_MODEL_LOADING
|
||||||
|
*/
|
||||||
|
const MODEL_LOADING_AGGRESSIVE = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MODEL_LOADING_CONSERVATIVE
|
||||||
|
*
|
||||||
|
* Constant for conservative model loading
|
||||||
|
* Will not require_once() found model files inititally instead it will build an array
|
||||||
|
* and reference it in autoload() when a class is needed it will require_once() it
|
||||||
|
*
|
||||||
|
* @see self::ATTR_MODEL_LOADING
|
||||||
|
*/
|
||||||
|
const MODEL_LOADING_CONSERVATIVE= 2;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* INHERITANCE TYPE CONSTANTS.
|
* INHERITANCE TYPE CONSTANTS.
|
||||||
@ -221,255 +580,6 @@ final class Doctrine
|
|||||||
const INHERITANCETYPE_TABLE_PER_CLASS = 3;
|
const INHERITANCETYPE_TABLE_PER_CLASS = 3;
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* LIMIT CONSTANTS
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* constant for row limiting
|
|
||||||
*/
|
|
||||||
const LIMIT_ROWS = 1;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* constant for record limiting
|
|
||||||
*/
|
|
||||||
const LIMIT_RECORDS = 2;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* FETCHMODE CONSTANTS
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* IMMEDIATE FETCHING
|
|
||||||
* mode for immediate fetching
|
|
||||||
*/
|
|
||||||
const FETCH_IMMEDIATE = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* BATCH FETCHING
|
|
||||||
* mode for batch fetching
|
|
||||||
*/
|
|
||||||
const FETCH_BATCH = 1;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* LAZY FETCHING
|
|
||||||
* mode for offset fetching
|
|
||||||
*/
|
|
||||||
const FETCH_OFFSET = 3;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* LAZY OFFSET FETCHING
|
|
||||||
* mode for lazy offset fetching
|
|
||||||
*/
|
|
||||||
const FETCH_LAZY_OFFSET = 4;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* FETCH CONSTANTS
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* FETCH VALUEHOLDER
|
|
||||||
*/
|
|
||||||
const FETCH_VHOLDER = 1;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* FETCH RECORD
|
|
||||||
*
|
|
||||||
* Specifies that the fetch method shall return Doctrine_Record
|
|
||||||
* objects as the elements of the result set.
|
|
||||||
*
|
|
||||||
* This is the default fetchmode.
|
|
||||||
*/
|
|
||||||
const FETCH_RECORD = 2;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* FETCH ARRAY
|
|
||||||
*/
|
|
||||||
const FETCH_ARRAY = 3;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PORTABILITY CONSTANTS
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Portability: turn off all portability features.
|
|
||||||
* @see self::ATTR_PORTABILITY
|
|
||||||
*/
|
|
||||||
const PORTABILITY_NONE = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Portability: convert names of tables and fields to case defined in the
|
|
||||||
* "field_case" option when using the query*(), fetch*() methods.
|
|
||||||
* @see self::ATTR_PORTABILITY
|
|
||||||
*/
|
|
||||||
const PORTABILITY_FIX_CASE = 1;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Portability: right trim the data output by query*() and fetch*().
|
|
||||||
* @see self::ATTR_PORTABILITY
|
|
||||||
*/
|
|
||||||
const PORTABILITY_RTRIM = 2;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Portability: force reporting the number of rows deleted.
|
|
||||||
* @see self::ATTR_PORTABILITY
|
|
||||||
*/
|
|
||||||
const PORTABILITY_DELETE_COUNT = 4;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Portability: convert empty values to null strings in data output by
|
|
||||||
* query*() and fetch*().
|
|
||||||
* @see self::ATTR_PORTABILITY
|
|
||||||
*/
|
|
||||||
const PORTABILITY_EMPTY_TO_NULL = 8;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Portability: removes database/table qualifiers from associative indexes
|
|
||||||
* @see self::ATTR_PORTABILITY
|
|
||||||
*/
|
|
||||||
const PORTABILITY_FIX_ASSOC_FIELD_NAMES = 16;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Portability: makes Doctrine_Expression throw exception for unportable RDBMS expressions
|
|
||||||
* @see self::ATTR_PORTABILITY
|
|
||||||
*/
|
|
||||||
const PORTABILITY_EXPR = 32;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Portability: turn on all portability features.
|
|
||||||
* @see self::ATTR_PORTABILITY
|
|
||||||
*/
|
|
||||||
const PORTABILITY_ALL = 63;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* LOCKMODE CONSTANTS
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* mode for optimistic locking
|
|
||||||
*/
|
|
||||||
const LOCK_OPTIMISTIC = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* mode for pessimistic locking
|
|
||||||
*/
|
|
||||||
const LOCK_PESSIMISTIC = 1;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* EXPORT CONSTANTS
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* EXPORT_NONE
|
|
||||||
*/
|
|
||||||
const EXPORT_NONE = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* EXPORT_TABLES
|
|
||||||
*/
|
|
||||||
const EXPORT_TABLES = 1;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* EXPORT_CONSTRAINTS
|
|
||||||
*/
|
|
||||||
const EXPORT_CONSTRAINTS = 2;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* EXPORT_PLUGINS
|
|
||||||
*/
|
|
||||||
const EXPORT_PLUGINS = 4;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* EXPORT_ALL
|
|
||||||
*/
|
|
||||||
const EXPORT_ALL = 7;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* HYDRATION CONSTANTS
|
|
||||||
*/
|
|
||||||
const HYDRATE_RECORD = 2;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* HYDRATE_ARRAY
|
|
||||||
*/
|
|
||||||
const HYDRATE_ARRAY = 3;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* HYDRATE_NONE
|
|
||||||
*/
|
|
||||||
const HYDRATE_NONE = 4;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* VALIDATION CONSTANTS
|
|
||||||
*/
|
|
||||||
const VALIDATE_NONE = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* VALIDATE_LENGTHS
|
|
||||||
*/
|
|
||||||
const VALIDATE_LENGTHS = 1;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* VALIDATE_TYPES
|
|
||||||
*/
|
|
||||||
const VALIDATE_TYPES = 2;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* VALIDATE_CONSTRAINTS
|
|
||||||
*/
|
|
||||||
const VALIDATE_CONSTRAINTS = 4;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* VALIDATE_ALL
|
|
||||||
*/
|
|
||||||
const VALIDATE_ALL = 7;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* IDENTIFIER_AUTOINC
|
|
||||||
*
|
|
||||||
* constant for auto_increment identifier
|
|
||||||
*/
|
|
||||||
const IDENTIFIER_AUTOINC = 1;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* IDENTIFIER_SEQUENCE
|
|
||||||
*
|
|
||||||
* constant for sequence identifier
|
|
||||||
*/
|
|
||||||
const IDENTIFIER_SEQUENCE = 2;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* IDENTIFIER_NATURAL
|
|
||||||
*
|
|
||||||
* constant for normal identifier
|
|
||||||
*/
|
|
||||||
const IDENTIFIER_NATURAL = 3;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* IDENTIFIER_COMPOSITE
|
|
||||||
*
|
|
||||||
* constant for composite identifier
|
|
||||||
*/
|
|
||||||
const IDENTIFIER_COMPOSITE = 4;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* MODEL_LOADING_AGGRESSIVE
|
|
||||||
*
|
|
||||||
* Constant for agressive model loading
|
|
||||||
* Will require_once() all found model files
|
|
||||||
*/
|
|
||||||
const MODEL_LOADING_AGGRESSIVE = 1;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* MODEL_LOADING_CONSERVATIVE
|
|
||||||
*
|
|
||||||
* Constant for conservative model loading
|
|
||||||
* Will not require_once() found model files inititally instead it will build an array
|
|
||||||
* and reference it in autoload() when a class is needed it will require_once() it
|
|
||||||
*/
|
|
||||||
const MODEL_LOADING_CONSERVATIVE= 2;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Path
|
* Path
|
||||||
*
|
*
|
||||||
@ -477,15 +587,6 @@ final class Doctrine
|
|||||||
*/
|
*/
|
||||||
private static $_path;
|
private static $_path;
|
||||||
|
|
||||||
/**
|
|
||||||
* Debug
|
|
||||||
*
|
|
||||||
* Bool true/false
|
|
||||||
*
|
|
||||||
* @var boolean $_debug
|
|
||||||
*/
|
|
||||||
private static $_debug = false;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* _loadedModelFiles
|
* _loadedModelFiles
|
||||||
*
|
*
|
||||||
@ -495,14 +596,6 @@ final class Doctrine
|
|||||||
*/
|
*/
|
||||||
private static $_loadedModelFiles = array();
|
private static $_loadedModelFiles = array();
|
||||||
|
|
||||||
/**
|
|
||||||
* _validators
|
|
||||||
*
|
|
||||||
* Array of all the loaded validators
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
private static $_validators = array();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* __construct
|
* __construct
|
||||||
*
|
*
|
||||||
@ -514,21 +607,6 @@ final class Doctrine
|
|||||||
throw new Doctrine_Exception('Doctrine is static class. No instances can be created.');
|
throw new Doctrine_Exception('Doctrine is static class. No instances can be created.');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* debug
|
|
||||||
*
|
|
||||||
* @param string $bool
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public static function debug($bool = null)
|
|
||||||
{
|
|
||||||
if ($bool !== null) {
|
|
||||||
self::$_debug = (bool) $bool;
|
|
||||||
}
|
|
||||||
|
|
||||||
return self::$_debug;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* getPath
|
* getPath
|
||||||
* returns the doctrine root
|
* returns the doctrine root
|
||||||
@ -566,7 +644,7 @@ final class Doctrine
|
|||||||
$e = explode('.', $file->getFileName());
|
$e = explode('.', $file->getFileName());
|
||||||
if (end($e) === 'php' && strpos($file->getFileName(), '.inc') === false) {
|
if (end($e) === 'php' && strpos($file->getFileName(), '.inc') === false) {
|
||||||
|
|
||||||
if ($manager->getAttribute(Doctrine::ATTR_MODEL_LOADING) == Doctrine::MODEL_LOADING_CONSERVATIVE) {
|
if ($manager->getAttribute(Doctrine::ATTR_MODEL_LOADING) === Doctrine::MODEL_LOADING_CONSERVATIVE) {
|
||||||
self::$_loadedModelFiles[$e[0]] = $file->getPathName();
|
self::$_loadedModelFiles[$e[0]] = $file->getPathName();
|
||||||
$loadedModels[] = $e[0];
|
$loadedModels[] = $e[0];
|
||||||
} else {
|
} else {
|
||||||
@ -600,15 +678,12 @@ final class Doctrine
|
|||||||
* Will filter through an array of classes and return the Doctrine_Records out of them.
|
* Will filter through an array of classes and return the Doctrine_Records out of them.
|
||||||
* If you do not specify $classes it will return all of the currently loaded Doctrine_Records
|
* If you do not specify $classes it will return all of the currently loaded Doctrine_Records
|
||||||
*
|
*
|
||||||
* @param classes Array of classes to filter through, otherwise uses get_declared_classes()
|
|
||||||
* @return array $loadedModels
|
* @return array $loadedModels
|
||||||
*/
|
*/
|
||||||
public static function getLoadedModels($classes = null)
|
public static function getLoadedModels()
|
||||||
{
|
{
|
||||||
if ($classes === null) {
|
|
||||||
$classes = get_declared_classes();
|
$classes = get_declared_classes();
|
||||||
$classes = array_merge($classes, array_keys(self::$_loadedModelFiles));
|
$classes = array_merge($classes, array_keys(self::$_loadedModelFiles));
|
||||||
}
|
|
||||||
|
|
||||||
return self::filterInvalidModels($classes);
|
return self::filterInvalidModels($classes);
|
||||||
}
|
}
|
||||||
@ -718,7 +793,7 @@ final class Doctrine
|
|||||||
*/
|
*/
|
||||||
public static function generateYamlFromDb($yamlPath)
|
public static function generateYamlFromDb($yamlPath)
|
||||||
{
|
{
|
||||||
$directory = '/tmp/tmp_doctrine_models';
|
$directory = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'tmp_doctrine_models';
|
||||||
|
|
||||||
Doctrine::generateModelsFromDb($directory);
|
Doctrine::generateModelsFromDb($directory);
|
||||||
|
|
||||||
@ -888,7 +963,7 @@ final class Doctrine
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$connection->export->dropDatabase($name);
|
$connection->export->dropDatabase($connection->getDatabaseName());
|
||||||
|
|
||||||
$results[$name] = true;
|
$results[$name] = true;
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
@ -1007,34 +1082,6 @@ final class Doctrine
|
|||||||
return Doctrine_Manager::table($tableName);
|
return Doctrine_Manager::table($tableName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* fileFinder
|
|
||||||
*
|
|
||||||
* @param string $type
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public static function fileFinder($type)
|
|
||||||
{
|
|
||||||
return Doctrine_FileFinder::type($type);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* compile
|
|
||||||
*
|
|
||||||
* method for making a single file of most used doctrine runtime components
|
|
||||||
* including the compiled file instead of multiple files (in worst
|
|
||||||
* cases dozens of files) can improve performance by an order of magnitude
|
|
||||||
*
|
|
||||||
* @param string $target
|
|
||||||
* @param array $includedDrivers
|
|
||||||
* @throws Doctrine_Exception
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public static function compile($target = null, $includedDrivers = array())
|
|
||||||
{
|
|
||||||
return Doctrine_Compiler::compile($target, $includedDrivers);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* autoload
|
* autoload
|
||||||
*
|
*
|
||||||
@ -1073,6 +1120,19 @@ final class Doctrine
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function locate($name)
|
||||||
|
{
|
||||||
|
$findPattern = self::$_path . DIRECTORY_SEPARATOR . '*' . DIRECTORY_SEPARATOR . str_replace('_', DIRECTORY_SEPARATOR, str_replace('Doctrine_', '', $name));
|
||||||
|
|
||||||
|
$matches = glob($findPattern);
|
||||||
|
|
||||||
|
if ( isset($matches[0])) {
|
||||||
|
return $matches[0];
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* dump
|
* dump
|
||||||
*
|
*
|
||||||
@ -1136,17 +1196,4 @@ final class Doctrine
|
|||||||
{
|
{
|
||||||
return Doctrine_Inflector::classify($tableName);
|
return Doctrine_Inflector::classify($tableName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* isValidClassName
|
|
||||||
*
|
|
||||||
* checks for valid class name (uses camel case and underscores)
|
|
||||||
*
|
|
||||||
* @param string $classname
|
|
||||||
* @return boolean
|
|
||||||
*/
|
|
||||||
public static function isValidClassname($className)
|
|
||||||
{
|
|
||||||
return Doctrine_Lib::isValidClassName($className);
|
|
||||||
}
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user