class Propel
Propel's main resource pool and initialization & configuration class.
This static class is used to handle Propel initialization and to maintain all of the open database connections and instantiated database maps.
Constants
VERSION |
The Propel version.
|
DEFAULT_NAME |
A constant for
|
LOG_EMERG |
A constant defining 'System is unusuable' logging level
|
LOG_ALERT |
A constant defining 'Immediate action required' logging level
|
LOG_CRIT |
A constant defining 'Critical conditions' logging level
|
LOG_ERR |
A constant defining 'Error conditions' logging level
|
LOG_WARNING |
A constant defining 'Warning conditions' logging level
|
LOG_NOTICE |
A constant defining 'Normal but significant' logging level
|
LOG_INFO |
A constant defining 'Informational' logging level
|
LOG_DEBUG |
A constant defining 'Debug-level messages' logging level
|
CLASS_PDO |
The class name for a PDO object.
|
CLASS_PROPEL_PDO |
The class name for a PropelPDO object.
|
CLASS_DEBUG_PDO |
The class name for a DebugPDO object.
|
CONNECTION_READ |
Constant used to request a READ connection (applies to replication).
|
CONNECTION_WRITE |
Constant used to request a WRITE connection (applies to replication).
|
Methods
static |
initialize()
Initializes Propel |
|
static |
configure(string $configFile)
Configure Propel a PHP (array) config file. |
|
static |
init(string $c)
Initialization of Propel a PHP (array) configuration file. |
|
static bool |
isInit()
Determine whether Propel has already been initialized. |
|
static |
setConfiguration(mixed $c)
Sets the configuration for Propel and all dependencies. |
|
static mixed |
getConfiguration(int $type = PropelConfiguration::TYPE_ARRAY)
Get the configuration for this component. |
|
static |
setLogger(object $logger)
Override the configured logger. |
|
static bool |
hasLogger()
Returns true if a logger, for example PEAR::Log, has been configured, otherwise false. |
|
static object |
logger()
Get the configured logger. |
|
static bool |
log(string $message, string $level = self::LOG_DEBUG)
Logs a message If a logger has been configured, the logger will be used, otherwrise the logging message will be discarded without any further action |
|
static DatabaseMap |
getDatabaseMap(string $name = null)
Returns the database map information. |
|
static |
setDatabaseMap(string $name, DatabaseMap $map)
Sets the database map object to use for specified datasource. |
|
static |
setForceMasterConnection(boolean $bit)
For replication, set whether to always force the use of a master connection. |
|
static boolean |
getForceMasterConnection()
For replication, whether to always force the use of a master connection. |
|
static |
setConnection(string $name, PropelPDO $con, string $mode = Propel::CONNECTION_WRITE)
Sets a Connection for specified datasource name. |
|
static PDO |
getConnection(string $name = null, string $mode = Propel::CONNECTION_WRITE)
Gets an already-opened PDO connection or opens a new one for passed-in db name. |
|
static PDO |
getMasterConnection(string $name)
Gets an already-opened write PDO connection or opens a new one for passed-in db name. |
|
static PDO |
getSlaveConnection(string $name)
Gets an already-opened read PDO connection or opens a new one for passed-in db name. |
|
static PDO |
initConnection(array $conparams, string $name, string $defaultClass = Propel::CLASS_PROPEL_PDO)
Opens a new PDO connection for passed-in db name. |
|
static DBAdapter |
getDB(string $name = null)
Returns database adapter for a specific datasource. |
|
static |
setDB(string $name, DBAdapter $adapter)
Sets a database adapter for specified datasource. |
|
static string |
getDefaultDB()
Returns the name of the default database. |
|
static |
close()
Closes any associated resource handles. |
|
static boolean |
autoload(string $className)
Autoload function for loading propel dependencies. |
|
static |
initBaseDir()
Initialize the base directory for the autoloader. |
|
static string |
importClass($path)
Include once a file specified in DOT notation and return unqualified classname. |
|
static |
setDatabaseMapClass(string $name)
Set your own class-name for Database-Mapping. |
|
static boolean |
disableInstancePooling()
Disable instance pooling. |
|
static boolean |
enableInstancePooling()
Enable instance pooling (enabled by default). |
|
static boolean |
isInstancePoolingEnabled()
the instance pooling behaviour. |
Details
at line 262
static public
initialize()
Initializes Propel
at line 300
static public
configure(string $configFile)
Configure Propel a PHP (array) config file.
at line 336
static public
init(string $c)
Initialization of Propel a PHP (array) configuration file.
at line 347
static public bool
isInit()
Determine whether Propel has already been initialized.
at line 357
static public
setConfiguration(mixed $c)
Sets the configuration for Propel and all dependencies.
at line 379
static public mixed
getConfiguration(int $type = PropelConfiguration::TYPE_ARRAY)
Get the configuration for this component.
at line 396
static public
setLogger(object $logger)
Override the configured logger.
This is primarily for things like unit tests / debugging where you want to change the logger without altering the configuration file.
You can use any logger class that implements the propel.logger.BasicLogger interface. This interface is based on PEAR::Log, so you can also simply pass a PEAR::Log object to this method.
at line 407
static public bool
hasLogger()
Returns true if a logger, for example PEAR::Log, has been configured, otherwise false.
at line 417
static public object
logger()
Get the configured logger.
at line 432
static public bool
log(string $message, string $level = self::LOG_DEBUG)
Logs a message If a logger has been configured, the logger will be used, otherwrise the logging message will be discarded without any further action
at line 471
static public DatabaseMap
getDatabaseMap(string $name = null)
Returns the database map information.
Name relates to the name of the connection pool to associate with the map.
The database maps are "registered" by the generated map builder classes.
at line 494
static public
setDatabaseMap(string $name, DatabaseMap $map)
Sets the database map object to use for specified datasource.
at line 507
static public
setForceMasterConnection(boolean $bit)
For replication, set whether to always force the use of a master connection.
at line 517
static public boolean
getForceMasterConnection()
For replication, whether to always force the use of a master connection.
at line 529
static public
setConnection(string $name, PropelPDO $con, string $mode = Propel::CONNECTION_WRITE)
Sets a Connection for specified datasource name.
at line 551
static public PDO
getConnection(string $name = null, string $mode = Propel::CONNECTION_WRITE)
Gets an already-opened PDO connection or opens a new one for passed-in db name.
at line 577
static public PDO
getMasterConnection(string $name)
Gets an already-opened write PDO connection or opens a new one for passed-in db name.
at line 603
static public PDO
getSlaveConnection(string $name)
Gets an already-opened read PDO connection or opens a new one for passed-in db name.
at line 649
static public PDO
initConnection(array $conparams, string $name, string $defaultClass = Propel::CLASS_PROPEL_PDO)
Opens a new PDO connection for passed-in db name.
at line 755
static public DBAdapter
getDB(string $name = null)
Returns database adapter for a specific datasource.
at line 779
static public
setDB(string $name, DBAdapter $adapter)
Sets a database adapter for specified datasource.
at line 792
static public string
getDefaultDB()
Returns the name of the default database.
at line 808
static public
close()
Closes any associated resource handles.
This method frees any database connection handles that have been opened by the getConnection() method.
at line 823
static public boolean
autoload(string $className)
Autoload function for loading propel dependencies.
at line 839
static public
initBaseDir()
Initialize the base directory for the autoloader.
Avoids a call to dirname(FILE) each time self::autoload() is called. FIXME put in the constructor if the Propel class ever becomes a singleton
at line 859
static public string
importClass($path)
Include once a file specified in DOT notation and return unqualified classname.
Typically, Propel uses autoload is used to load classes and expects that all classes referenced within Propel are included in Propel's autoload map. This method is only called when a specific non-Propel classname was specified -- for example, the classname of a validator in the schema.xml. This method will attempt to include that class via autoload and then relative to a location on the include_path.
at line 893
static public
setDatabaseMapClass(string $name)
Set your own class-name for Database-Mapping.
Then you can change the whole TableMap-Model, but keep its functionality for Criteria.
at line 904
static public boolean
disableInstancePooling()
Disable instance pooling.
at line 920
static public boolean
enableInstancePooling()
Enable instance pooling (enabled by default).
at line 935
static public boolean
isInstancePoolingEnabled()
the instance pooling behaviour.
True by default.