Class: Doctrine_Manager

Source Location: /Doctrine/Manager.php

Class Doctrine_Manager

Class Overview

Implements interfaces:

  • Countable (internal interface)
  • IteratorAggregate (internal interface)

Doctrine_Manager is the base component of all doctrine based projects.

It opens and keeps track of all connections (database connections).

Located in /Doctrine/Manager.php [line 34]

Doctrine_Object
   |
   --Doctrine_Configurable
      |
      --Doctrine_Manager
Author(s): Information Tags:
Version:  $Revision: 2290 $
Link:  www.phpdoctrine.com
Since:  1.0
License:  LGPL

Properties

Methods

[ Top ]
Inherited Properties, Constants, and Methods
Inherited Properties Inherited Methods Inherited Constants

Inherited From Doctrine_Configurable

Doctrine_Configurable::$attributes
Doctrine_Configurable::$parent
Doctrine_Configurable::$_impl

Inherited From Doctrine_Object

Doctrine_Object::$_null

Inherited From Doctrine_Configurable

Doctrine_Configurable::addListener()
addListener
Doctrine_Configurable::addRecordListener()
addRecordListener
Doctrine_Configurable::getAttribute()
returns the value of an attribute
Doctrine_Configurable::getAttributes()
getAttributes returns all attributes as an array
Doctrine_Configurable::getCacheDriver()
getCacheDriver
Doctrine_Configurable::getImpl()
getImpl returns the implementation for given class
Doctrine_Configurable::getListener()
getListener
Doctrine_Configurable::getParent()
getParent returns the parent of this component
Doctrine_Configurable::getRecordListener()
getListener
Doctrine_Configurable::setAttribute()
setAttribute sets a given attribute
Doctrine_Configurable::setEventListener()
Doctrine_Configurable::setImpl()
setImpl binds given class to given template name
Doctrine_Configurable::setListener()
setListener
Doctrine_Configurable::setParent()
sets a parent for this configurable component the parent must be configurable component itself
Doctrine_Configurable::setRecordListener()
setListener

Inherited From Doctrine_Object

Doctrine_Object::getNullObject()
getNullObject returns the null object associated with this object
Doctrine_Object::initNullObject()
initNullObject initializes the null object

[ Top ]
Property Summary
static mixed   $driverMap  
array   $_bound  
array   $_connections  
integer   $_currIndex  
integer   $_index  
array   $_integrityActions  
string   $_root  

[ Top ]
Method Summary
static Doctrine_Connection   connection()   connection
static Doctrine_Manager   getInstance()   getInstance returns an instance of this class (this class uses the singleton pattern)
static Doctrine_Table   table()   table this is the same as Doctrine_Connection::getTable() except that it works seamlessly in multi-server/connection environment
Doctrine_Manager   __construct()   constructor
void   addDeleteAction()  
void   addUpdateAction()  
boolean   bindComponent()   bindComponent
void   closeConnection()   closes the connection
boolean   contains()   contains whether or not the manager contains specified connection
integer   count()   count returns the number of opened connections
string   getComponentAlias()   getComponentAlias
object Doctrine_Connection   getConnection()   getConnection
Doctrine_Connection   getConnectionForComponent()   getConnectionForComponent
string   getConnectionName()   getConnectionName
array   getConnections()   getConnections returns all opened connections
Doctrine_Connection   getCurrentConnection()   getCurrentConnection returns the current connection
void   getDeleteActions()  
ArrayIterator   getIterator()   getIterator returns an ArrayIterator that iterates through all connections
string   getRoot()   returns the root directory of Doctrine
Doctrine_Table   getTable()   getTable this is the same as Doctrine_Connection::getTable() except that it works seamlessly in multi-server/connection environment
void   getUpdateActions()  
Doctrine_Connection   openConnection()   openConnection opens a new connection and saves it to Doctrine_Manager->connections
array   parseDsn()   parseDsn
Doctrine_Manager   setComponentAlias()   sets an alias for given component name very useful when building a large framework with a possibility to override any given class
void   setCurrentConnection()   setCurrentConnection sets the current connection to $key
boolean   setDefaultAttributes()   setDefaultAttributes sets default attributes
string   __toString()   __toString returns a string representation of this object

[ Top ]
Properties
static mixed   $driverMap = array('oci' => 'oracle') [line 62]
API Tags:
Access:  protected


[ Top ]
array   $_bound = array() [line 43]
API Tags:
Access:  protected


[ Top ]
array   $_connections = array() [line 39]
API Tags:
Access:  protected


[ Top ]
integer   $_currIndex = 0 [line 51]
API Tags:
Access:  protected


[ Top ]
integer   $_index = 0 [line 47]
API Tags:
Access:  protected


[ Top ]
array   $_integrityActions = array() [line 60]
API Tags:
Access:  protected


[ Top ]
string   $_root [line 55]
API Tags:
Access:  protected


[ Top ]
Methods
static method connection  [line 176]

  static Doctrine_Connection connection( [PDO|Doctrine_Adapter_Interface $adapter = null], [string $name = null]  )

connection

if the adapter parameter is set this method acts as a short cut for Doctrine_Manager::getInstance()->openConnection($adapter, $name);

if the adapter paramater is not set this method acts as a short cut for Doctrine_Manager::getInstance()->getCurrentConnection()

Parameters:
PDO|Doctrine_Adapter_Interface   $adapter:  database driver
string   $name:  name of the connection, if empty numeric key is used

API Tags:
Access:  public

Information Tags:
Throws:  Doctrine_Manager_Exception if trying to bind a connection with an existing name

[ Top ]
static method getInstance  [line 154]

  static Doctrine_Manager getInstance( )

getInstance returns an instance of this class (this class uses the singleton pattern)


API Tags:
Access:  public


[ Top ]
static method table  [line 446]

  static Doctrine_Table table( string $componentName  )

table this is the same as Doctrine_Connection::getTable() except that it works seamlessly in multi-server/connection environment

Parameters:
string   $componentName: 

API Tags:
See:  Doctrine_Connection::getTable()
Access:  public


[ Top ]
Constructor __construct  [line 68]

  Doctrine_Manager __construct( )

constructor

this is private constructor (use getInstance to get an instance of this class)


API Tags:
Access:  private


[ Top ]
addDeleteAction  [line 74]

  void addDeleteAction( $componentName, $foreignComponent, $action  )

Parameters:
   $componentName: 
   $foreignComponent: 
   $action: 

API Tags:
Access:  public


[ Top ]
addUpdateAction  [line 78]

  void addUpdateAction( $componentName, $foreignComponent, $action  )

Parameters:
   $componentName: 
   $foreignComponent: 
   $action: 

API Tags:
Access:  public


[ Top ]
bindComponent  [line 407]

  boolean bindComponent( string $componentName, string $connectionName  )

bindComponent

binds given component to given connection this means that when ever the given component uses a connection it will be using the bound connection instead of the current connection

Parameters:
string   $componentName: 
string   $connectionName: 

API Tags:
Access:  public


[ Top ]
closeConnection  [line 458]

  void closeConnection( Doctrine_Connection $connection  )

closes the connection

Parameters:
Doctrine_Connection   $connection: 

API Tags:
Access:  public


[ Top ]
contains  [line 504]

  boolean contains( mixed $key  )

contains whether or not the manager contains specified connection

Parameters:
mixed   $key:  the connection key

API Tags:
Access:  public


[ Top ]
count  [line 514]

  integer count( )

count returns the number of opened connections


API Tags:
Access:  public


Implementation of:
Countable::count

[ Top ]
getComponentAlias  [line 364]

  string getComponentAlias( string $componentName  )

getComponentAlias

retrieves the alias for given component name if the alias couldn't be found, this method returns the given component name

Parameters:
string   $componentName: 

API Tags:
Return:  the component alias
Access:  public


[ Top ]
getConnection  [line 347]

  object Doctrine_Connection getConnection( $name, integer $index  )

getConnection

Parameters:
integer   $index: 
   $name: 

API Tags:
Access:  public

Information Tags:
Throws:  Doctrine_Manager_Exception if trying to get a non-existent connection

[ Top ]
getConnectionForComponent  [line 417]

  Doctrine_Connection getConnectionForComponent( [string $componentName = null]  )

getConnectionForComponent

Parameters:
string   $componentName: 

API Tags:
Access:  public


[ Top ]
getConnectionName  [line 393]

  string getConnectionName( Doctrine_Connection $conn  )

getConnectionName

Parameters:
Doctrine_Connection   $conn:  connection object to be searched for

API Tags:
Return:  the name of the connection
Access:  public


[ Top ]
getConnections  [line 477]

  array getConnections( )

getConnections returns all opened connections


API Tags:
Access:  public


[ Top ]
getCurrentConnection  [line 535]

  Doctrine_Connection getCurrentConnection( )

getCurrentConnection returns the current connection


API Tags:
Access:  public

Information Tags:
Throws:  Doctrine_Connection_Exception if there are no open connections

[ Top ]
getDeleteActions  [line 82]

  void getDeleteActions( $componentName  )

Parameters:
   $componentName: 

API Tags:
Access:  public


[ Top ]
getIterator  [line 524]

  ArrayIterator getIterator( )

getIterator returns an ArrayIterator that iterates through all connections


API Tags:
Access:  public


Implementation of:
IteratorAggregate::getIterator

[ Top ]
getRoot  [line 143]

  string getRoot( )

returns the root directory of Doctrine


API Tags:
Access:  public


[ Top ]
getTable  [line 433]

  Doctrine_Table getTable( string $componentName  )

getTable this is the same as Doctrine_Connection::getTable() except that it works seamlessly in multi-server/connection environment

Parameters:
string   $componentName: 

API Tags:
See:  Doctrine_Connection::getTable()
Access:  public


[ Top ]
getUpdateActions  [line 90]

  void getUpdateActions( $componentName  )

Parameters:
   $componentName: 

API Tags:
Access:  public


[ Top ]
openConnection  [line 194]

  Doctrine_Connection openConnection( PDO|Doctrine_Adapter_Interface $adapter, [string $name = null], [ $setCurrent = true]  )

openConnection opens a new connection and saves it to Doctrine_Manager->connections

Parameters:
PDO|Doctrine_Adapter_Interface   $adapter:  database driver
string   $name:  name of the connection, if empty numeric key is used
   $setCurrent: 

API Tags:
Access:  public

Information Tags:
Throws:  Doctrine_Manager_Exception if trying to open connection for unknown driver
Throws:  Doctrine_Manager_Exception if trying to bind a connection with an existing name

[ Top ]
parseDsn  [line 270]

  array parseDsn( string $dsn  )

parseDsn

Parameters:
string   $dsn: 

API Tags:
Return:  Parsed contents of DSN
Access:  public


[ Top ]
setComponentAlias  [line 381]

  Doctrine_Manager setComponentAlias( string $componentName, string $alias  )

sets an alias for given component name very useful when building a large framework with a possibility to override any given class

Parameters:
string   $componentName:  the name of the component
string   $alias: 

API Tags:
Access:  public


[ Top ]
setCurrentConnection  [line 489]

  void setCurrentConnection( mixed $key  )

setCurrentConnection sets the current connection to $key

Parameters:
mixed   $key:  the connection key

API Tags:
Access:  public

Information Tags:
Throws:  InvalidKeyException

[ Top ]
setDefaultAttributes  [line 104]

  boolean setDefaultAttributes( )

setDefaultAttributes sets default attributes


API Tags:
Access:  public


[ Top ]
__toString  [line 549]

  string __toString( )

__toString returns a string representation of this object


API Tags:
Access:  public


[ Top ]