Class: Doctrine_Hydrate

Source Location: /Doctrine/Hydrate.php

Class Doctrine_Hydrate

Class Overview
Direct descendents
Child Class Description
Doctrine_Query_Abstract Doctrine_Query_Abstract

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

Inherited From Doctrine_Object

Doctrine_Object::$_null

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 ]
Constant Summary
CREATE   constant for CREATE queries
DELETE   constant for DELETE queries
HYDRATE_ARRAY   Constant for the array hydration mode.
HYDRATE_RECORD   Constant for the record (object) hydration mode.
INSERT   constant for INSERT queries
SELECT   constant for SELECT queries
UPDATE   constant for UPDATE queries

[ Top ]
Property Summary
array   $aggregateMap  
array   $parts  
mixed   $pendingAggregates  
integer   $type  
array   $_aliasMap  
array   $_cache  
Doctrine_Connection   $_conn  
boolean   $_expireCache  
mixed   $_hydrationMode   The current hydration mode.
array   $_options  
array   $_params  
string   $_sql  
mixed   $_tableAliases  
array   $_tableAliasSeeds  
mixed   $_timeToLive  
Doctrine_View   $_view  

[ Top ]
Method Summary
Doctrine_Hydrate   __construct()   constructor
Doctrine_Hydrate   addQueryPart()   addQueryPart adds a query part in the query part array
Doctrine_Hydrate   addTableAlias()   addTableAlias adds an alias for table and associates it with given component alias
string   applyInheritance()   applyInheritance applies column aggregation inheritance to DQL / SQL query
void   clear()   clear resets all the variables
void   convertEnums()  
Doctrine_Hydrate   copyAliases()   copyAliases copy aliases from another Hydrate object
Doctrine_Hydrate   createSubquery()   createSubquery creates a subquery
Doctrine_Collection   execute()   execute executes the query and populates the data set
Doctrine_Hydrate   expireCache()   expireCache
array   fetchArray()   fetchArray Convenience method to execute using array fetching as hydration mode.
mixed   fetchOne()   fetchOne Convenience method to execute the query and return the first item of the collection.
string   generateNewTableAlias()   generateNewTableAlias generates a new alias from given table alias
string   generateTableAlias()   generateTableAlias generates a table alias from given table name and associates it with given component alias
array   getAliasDeclaration()   getAliasDeclaration get the declaration for given component alias
array   getAliasMap()   getAliasMap returns the component alias map
string   getCachedForm()   getCachedForm returns the cached form of this query for given resultSet
Doctrine_Cache_Interface|boolean|null   getCacheDriver()   getCacheDriver returns the cache driver associated with this object
string   getComponentAlias()   getComponentAlias get component alias associated with given table alias
Doctrine_Connection   getConnection()   getConnection
array   getParams()   getParams
Doctrine_Hydrate   getQueryPart()   setQueryPart sets a query part in the query part array
Doctrine_Table   getRoot()   getRoot returns the root component for this object
array   getRootAlias()   getRootAlias returns the alias of the the root component
array   getRootDeclaration()   getRootDeclaration returns the root declaration
string   getSql()   getSql return the sql associated with this object
string   getTableAlias()   getTableAlias some database such as Oracle need the identifier lengths to be < ~30 chars hence Doctrine creates as short identifier aliases as possible
array   getTableAliases()   getTableAliases returns all table aliases
integer   getTableAliasSeed()   getTableAliasSeed returns the alias seed for given table alias
integer   getType()   getType
Doctrine_View   getView()   getView returns the view associated with this query object (if any)
boolean   hasAliasDeclaration()   hasAliasDeclaration whether or not this object has a declaration for given component alias
boolean   hasTableAlias()   hasTableAlias whether or not this object has given tableAlias
boolean   isLimitSubqueryUsed()   limitSubqueryUsed whether or not limit subquery was used
array   parseData2()   parseData parses the data returned by statement object
Doctrine_Hydrate   removeQueryPart()   removeQueryPart removes a query part from the query part array
array   serialize()   serialize this method is automatically called when this Doctrine_Hydrate is serialized
Doctrine_Hydrate   setAliasMap()   setAliasMap sets the whole component alias map
Doctrine_Hydrate   setCacheLifeSpan()   setCacheLifeSpan
void   setHydrationMode()   Sets the fetchmode.
void   setParams()   setParams
Doctrine_Hydrate   setQueryPart()   setQueryPart sets a query part in the query part array
void   setView()   setView sets a database view this query object uses this method should only be called internally by doctrine
void   unserialize()   unseralize this method is automatically called everytime a Doctrine_Hydrate object is unserialized
Doctrine_Hydrate   useCache()   useCache
void   _execute()  
void   _setLastElement()   _setLastElement
string   __toString()  

[ Top ]
Properties
array   $aggregateMap = array() [line 104]
API Tags:
Access:  protected


[ Top ]
array   $parts = array(
'select' => array(),'distinct'=>false,'forUpdate'=>false,'from'=>array(),'set'=>array(),'join'=>array(),'where'=>array(),'groupby'=>array(),'having'=>array(),'orderby'=>array(),'limit'=>false,'offset'=>false,)
[line 120]
API Tags:
Access:  protected


[ Top ]
mixed   $pendingAggregates = array() [line 99]
API Tags:
Access:  protected


[ Top ]
integer   $type = self::SELECT [line 139]
API Tags:
See:  Doctrine_Query::* constants
Access:  protected


[ Top ]
array   $_aliasMap = array() [line 95]
API Tags:
Access:  protected


[ Top ]
array   $_cache [line 143]
API Tags:
Access:  protected


[ Top ]
Doctrine_Connection   $_conn [line 77]
API Tags:
Access:  protected


[ Top ]
boolean   $_expireCache = false [line 151]
API Tags:
Access:  protected


[ Top ]
mixed   $_hydrationMode = self::HYDRATE_RECORD [line 147]

The current hydration mode.

API Tags:
Access:  protected


[ Top ]
array   $_options = array(
'fetchMode' => Doctrine::FETCH_RECORD,
'parserCache' => false,
'resultSetCache' => false,
)
[line 108]
API Tags:
Access:  protected


[ Top ]
array   $_params = array() [line 73]
API Tags:
Access:  protected


[ Top ]
string   $_sql [line 116]
API Tags:
Access:  protected


[ Top ]
mixed   $_tableAliases = array() [line 155]
API Tags:
Access:  protected


[ Top ]
array   $_tableAliasSeeds = array() [line 161]
API Tags:
Access:  protected


[ Top ]
mixed   $_timeToLive [line 153]
API Tags:
Access:  protected


[ Top ]
Doctrine_View   $_view [line 82]
API Tags:
Access:  protected


[ Top ]
Methods
Constructor __construct  [line 167]

  Doctrine_Hydrate __construct( [Doctrine_Connection|null $connection = null]  )

constructor

Parameters:
Doctrine_Connection|null   $connection: 

API Tags:
Access:  public


[ Top ]
addQueryPart  [line 476]

  Doctrine_Hydrate addQueryPart( string $name, string $part  )

addQueryPart adds a query part in the query part array

Parameters:
string   $name:  the name of the query part to be added
string   $part:  query part string

API Tags:
Return:  this object
Access:  public

Information Tags:
Throws:  Doctrine_Hydrate_Exception if trying to add unknown query part

[ Top ]
addTableAlias  [line 435]

  Doctrine_Hydrate addTableAlias( string $tableAlias, string $componentAlias  )

addTableAlias adds an alias for table and associates it with given component alias

Parameters:
string   $componentAlias:  the alias for the query component associated with given tableAlias
string   $tableAlias:  the table alias to be added

API Tags:
Access:  public


[ Top ]
applyInheritance  [line 858]

  string applyInheritance( )

applyInheritance applies column aggregation inheritance to DQL / SQL query


API Tags:
Access:  public


[ Top ]
clear  [line 632]

  void clear( )

clear resets all the variables


API Tags:
Access:  protected


[ Top ]
convertEnums  [line 698]

  void convertEnums( $params  )

Parameters:
   $params: 

API Tags:
Access:  public


Redefined in descendants as:

[ Top ]
copyAliases  [line 590]

  Doctrine_Hydrate copyAliases( Doctrine_Hydrate $query  )

copyAliases copy aliases from another Hydrate object

this method is needed by DQL subqueries which need the aliases of the parent query

Parameters:
Doctrine_Hydrate   $query:  the query object from which the aliases are copied from

API Tags:
Return:  this object
Access:  public


[ Top ]
createSubquery  [line 603]

  Doctrine_Hydrate createSubquery( )

createSubquery creates a subquery


API Tags:
Access:  public


[ Top ]
execute  [line 781]

  Doctrine_Collection execute( [string $params = array()], [ $hydrationMode = null]  )

execute executes the query and populates the data set

Parameters:
string   $params: 
   $hydrationMode: 

API Tags:
Return:  the root collection
Access:  public


[ Top ]
expireCache  [line 256]

  Doctrine_Hydrate expireCache( [boolean $expire = true]  )

expireCache

Parameters:
boolean   $expire:  whether or not to force cache expiration

API Tags:
Return:  this object
Access:  public


[ Top ]
fetchArray  [line 918]

  array fetchArray( [string $params = array()]  )

fetchArray Convenience method to execute using array fetching as hydration mode.

Parameters:
string   $params: 

API Tags:
Access:  public


[ Top ]
fetchOne  [line 930]

  mixed fetchOne( [string $params = array()], [int $hydrationMode = null]  )

fetchOne Convenience method to execute the query and return the first item of the collection.

Parameters:
string   $params:  Parameters
int   $hydrationMode:  Hydration mode

API Tags:
Return:  Array or Doctrine_Collection or false if no result.
Access:  public


[ Top ]
generateNewTableAlias  [line 330]

  string generateNewTableAlias( string $tableAlias  )

generateNewTableAlias generates a new alias from given table alias

Parameters:
string   $tableAlias:  table alias from which to generate the new alias from

API Tags:
Return:  the created table alias
Access:  public


[ Top ]
generateTableAlias  [line 396]

  string generateTableAlias( string $componentAlias, string $tableName  )

generateTableAlias generates a table alias from given table name and associates it with given component alias

Parameters:
string   $componentAlias:  the component alias to be associated with generated table alias
string   $tableName:  the table name from which to generate the table alias

API Tags:
Return:  the generated table alias
Access:  public


[ Top ]
getAliasDeclaration  [line 571]

  array getAliasDeclaration( string $componentAlias  )

getAliasDeclaration get the declaration for given component alias

Parameters:
string   $componentAlias:  the component alias the retrieve the declaration from

API Tags:
Return:  the alias declaration
Access:  public


[ Top ]
getAliasMap  [line 721]

  array getAliasMap( )

getAliasMap returns the component alias map


API Tags:
Return:  component alias map
Access:  public


[ Top ]
getCachedForm  [line 732]

  string getCachedForm( $resultSet  )

getCachedForm returns the cached form of this query for given resultSet

Parameters:
array   $resultSet: 

API Tags:
Return:  serialized string representation of this query
Access:  public


[ Top ]
getCacheDriver  [line 283]

  Doctrine_Cache_Interface|boolean|null getCacheDriver( )

getCacheDriver returns the cache driver associated with this object


API Tags:
Return:  cache driver
Access:  public


[ Top ]
getComponentAlias  [line 366]

  string getComponentAlias( string $tableAlias  )

getComponentAlias get component alias associated with given table alias

Parameters:
string   $tableAlias:  the table alias that identifies the component alias

API Tags:
Return:  component alias
Access:  public


[ Top ]
getConnection  [line 655]

  Doctrine_Connection getConnection( )

getConnection


API Tags:
Access:  public


[ Top ]
getParams  [line 686]

  array getParams( )

getParams


API Tags:
Access:  public


[ Top ]
getQueryPart  [line 497]

  Doctrine_Hydrate getQueryPart( string $part, string $name  )

setQueryPart sets a query part in the query part array

Parameters:
string   $name:  the name of the query part to be set
string   $part:  query part string

API Tags:
Return:  this object
Access:  public

Information Tags:
Throws:  Doctrine_Hydrate_Exception if trying to set unknown query part

[ Top ]
getRoot  [line 208]

  Doctrine_Table getRoot( )

getRoot returns the root component for this object


API Tags:
Return:  root components table
Access:  public


[ Top ]
getRootAlias  [line 180]

  array getRootAlias( )

getRootAlias returns the alias of the the root component


API Tags:
Access:  public


[ Top ]
getRootDeclaration  [line 196]

  array getRootDeclaration( )

getRootDeclaration returns the root declaration


API Tags:
Access:  public


[ Top ]
getSql  [line 224]

  string getSql( )

getSql return the sql associated with this object


API Tags:
Return:  sql query string
Access:  public


[ Top ]
getTableAlias  [line 453]

  string getTableAlias( string $componentAlias, [string $tableName = null]  )

getTableAlias some database such as Oracle need the identifier lengths to be < ~30 chars hence Doctrine creates as short identifier aliases as possible

this method is used for the creation of short table aliases, its also smart enough to check if an alias already exists for given component (componentAlias)

Parameters:
string   $componentAlias:  the alias for the query component to search table alias for
string   $tableName:  the table name from which the table alias is being created

API Tags:
Return:  the generated / fetched short alias
Access:  public


[ Top ]
getTableAliases  [line 423]

  array getTableAliases( )

getTableAliases returns all table aliases


API Tags:
Return:  table aliases as an array
Access:  public


[ Top ]
getTableAliasSeed  [line 380]

  integer getTableAliasSeed( string $tableAlias  )

getTableAliasSeed returns the alias seed for given table alias

Parameters:
string   $tableAlias:  table alias that identifies the alias seed

API Tags:
Return:  table alias seed
Access:  public


[ Top ]
getType  [line 848]

  integer getType( )

getType

returns the type of this query object by default the type is Doctrine_Hydrate::SELECT but if update() or delete() are being called the type is Doctrine_Hydrate::UPDATE and Doctrine_Hydrate::DELETE, respectively


API Tags:
Return:  return the query type
See:  Doctrine_Hydrate::DELETE
See:  Doctrine_Hydrate::UPDATE
See:  Doctrine_Hydrate::SELECT
Access:  public


[ Top ]
getView  [line 677]

  Doctrine_View getView( )

getView returns the view associated with this query object (if any)


API Tags:
Return:  the view associated with this query object
Access:  public


[ Top ]
hasAliasDeclaration  [line 560]

  boolean hasAliasDeclaration( string $componentAlias  )

hasAliasDeclaration whether or not this object has a declaration for given component alias

Parameters:
string   $componentAlias:  the component alias the retrieve the declaration from

API Tags:
Access:  public


[ Top ]
hasTableAlias  [line 355]

  boolean hasTableAlias( string $tableAlias  )

hasTableAlias whether or not this object has given tableAlias

Parameters:
string   $tableAlias:  the table alias to be checked

API Tags:
Return:  true if this object has given alias, otherwise false
Access:  public


[ Top ]
isLimitSubqueryUsed  [line 622]

  boolean isLimitSubqueryUsed( )

limitSubqueryUsed whether or not limit subquery was used


API Tags:
Access:  public


Redefined in descendants as:

[ Top ]
parseData2  [line 964]

  array parseData2( mixed $stmt, $hydrationMode  )

parseData parses the data returned by statement object

This is method defines the core of Doctrine object population algorithm hence this method strives to be as fast as possible

The key idea is the loop over the rowset only once doing all the needed operations within this massive loop.

Parameters:
mixed   $stmt: 
   $hydrationMode: 

API Tags:
Access:  public


[ Top ]
removeQueryPart  [line 513]

  Doctrine_Hydrate removeQueryPart( string $name  )

removeQueryPart removes a query part from the query part array

Parameters:
string   $name:  the name of the query part to be removed

API Tags:
Return:  this object
Access:  public

Information Tags:
Throws:  Doctrine_Hydrate_Exception if trying to remove unknown query part

[ Top ]
serialize  [line 307]

  array serialize( )

serialize this method is automatically called when this Doctrine_Hydrate is serialized


API Tags:
Return:  an array of serialized properties
Access:  public


Implementation of:
Serializable::serialize

[ Top ]
setAliasMap  [line 709]

  Doctrine_Hydrate setAliasMap( $map  )

setAliasMap sets the whole component alias map

Parameters:
array   $map:  alias map

API Tags:
Return:  this object
Access:  public


[ Top ]
setCacheLifeSpan  [line 268]

  Doctrine_Hydrate setCacheLifeSpan( integer $timeToLive  )

setCacheLifeSpan

Parameters:
integer   $timeToLive:  how long the cache entry is valid

API Tags:
Return:  this object
Access:  public


[ Top ]
setHydrationMode  [line 296]

  void setHydrationMode( $hydrationMode, integer $fetchmode  )

Sets the fetchmode.

Parameters:
integer   $fetchmode:  One of the Doctrine_Hydrate::HYDRATE_* constants.
   $hydrationMode: 

API Tags:
Access:  public


[ Top ]
setParams  [line 695]

  void setParams( [ $params = array()]  )

setParams

Parameters:
array   $params: 

API Tags:
Access:  public


[ Top ]
setQueryPart  [line 535]

  Doctrine_Hydrate setQueryPart( string $name, string $part  )

setQueryPart sets a query part in the query part array

Parameters:
string   $name:  the name of the query part to be set
string   $part:  query part string

API Tags:
Return:  this object
Access:  public

Information Tags:
Throws:  Doctrine_Hydrate_Exception if trying to set unknown query part

[ Top ]
setView  [line 667]

  void setView( Doctrine_View $view  )

setView sets a database view this query object uses this method should only be called internally by doctrine

Parameters:
Doctrine_View   $view:  database view

API Tags:
Access:  public


[ Top ]
unserialize  [line 319]

  void unserialize( string $serialized  )

unseralize this method is automatically called everytime a Doctrine_Hydrate object is unserialized

Parameters:
string   $serialized:  Doctrine_Record as serialized string

API Tags:
Access:  public


Implementation of:
Serializable::unserialize

[ Top ]
useCache  [line 235]

  Doctrine_Hydrate useCache( [Doctrine_Cache_Interface|bool $driver = true], [integer $timeToLive = null]  )

useCache

Parameters:
Doctrine_Cache_Interface|bool   $driver:  cache driver
integer   $timeToLive:  how long the cache entry is valid

API Tags:
Return:  this object
Access:  public


[ Top ]
_execute  [line 749]

  void _execute( $params  )

Parameters:
   $params: 

API Tags:
Access:  public


[ Top ]
_setLastElement  [line 1182]

  void _setLastElement( &$prev, &$coll, boolean|integer $index, $alias, $oneToOne  )

_setLastElement

sets the last element of given data array / collection as previous element

Parameters:
boolean|integer   $index: 
   &$prev: 
   &$coll: 
   $alias: 
   $oneToOne: 

API Tags:
Access:  public


[ Top ]
__toString  [line 1213]

  string __toString( )


API Tags:
Return:  returns a string representation of this object
Access:  public


[ Top ]
Constants
CREATE = 4 [line 60]

constant for CREATE queries


[ Top ]
DELETE = 1 [line 48]

constant for DELETE queries


[ Top ]
HYDRATE_ARRAY = 3 [line 64]

Constant for the array hydration mode.


[ Top ]
HYDRATE_RECORD = 2 [line 68]

Constant for the record (object) hydration mode.


[ Top ]
INSERT = 3 [line 56]

constant for INSERT queries


[ Top ]
SELECT = 0 [line 44]

constant for SELECT queries


[ Top ]
UPDATE = 2 [line 52]

constant for UPDATE queries


[ Top ]