Class: Doctrine_Table

Source Location: /Doctrine/Table.php

Class Doctrine_Table

Class Overview
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
array   $columnAliases  
integer   $columnCount  
array   $columns  
Doctrine_Connection   $conn  
array   $data  
boolean   $hasDefaultValues  
mixed   $identifier  
integer   $identifierType  
array   $identityMap  
array   $options  
array   $primaryKeys  
Doctrine_Table_Repository   $repository  
Doctrine_Tree   $tree  
Doctrine_Relation_Parser   $_parser  
array   $_templates  

[ Top ]
Method Summary
void   __construct()   the constructor
void   addCheckConstraint()   addCheckConstraint
void   addForeignKey()   addForeignKey
void   addIndex()   addIndex
boolean   addRecord()   addRecord adds a record to identity map
void   addTemplate()  
string   applyInheritance()   applyInheritance
void   bind()  
void   clear()   clear clears the first level cache (identityMap)
integer   count()   count
Doctrine_Record   create()   create creates a new record
Doctrine_Query   createQuery()   createQuery creates a new Doctrine_Query object and adds the component name of this table as the query 'from' part
mixed   enumIndex()   enumIndex
mixed   enumValue()   enumValue
boolean   export()   export exports this table to database based on column and option definitions
void   exportConstraints()   exportConstraints exports the constraints of this table into database based on option definitions
Doctrine_Record|false   find()   finds a record by its identifier
Doctrine_Collection   findAll()   findAll returns a collection of records
void   findByDql()  
Doctrine_Collection   findBySql()   findByDql finds records with given DQL where clause returns a collection of records
string   getClassnameToReturn()   Get the classname to return. Most often this is just the options['name']
integer   getColumnCount()   getColumnCount
string   getColumnName()   getColumnName
array   getColumnNames()   returns an array containing all the column names
array   getColumns()   returns all columns and their definitions
void   getComponentName()  
Doctrine_Connection   getConnection()  
array   getData()   returns internal data, used by Doctrine_Record instances when retrieving data from database
mixed   getDefaultValueOf()   getDefaultValueOf returns the default value(if any) for given column
mixed   getDefinitionOf()   getDefinitionOf
array   getEnumValues()  
array   getExportableFormat()   getExportableFormat returns exportable presentation of this object
mixed   getIdentifier()  
integer   getIdentifierType()  
array|boolean   getIndex()   getIndex
mixed   getOption()   getOption returns the value of given option
array   getOptions()   getOptions returns all options of this table and the associated values
array   getPrimaryKeys()   returns all primary keys
void   getProxy()  
Doctrine_Query   getQueryObject()  
Doctrine_Record   getRecord()   getRecord first checks if record exists in identityMap, if not returns a new record
void   getRelation()   getRelation
Doctrine_Relation_Parser   getRelationParser()   getRelationParser return the relation parser associated with this table
array   getRelations()   getRelations returns an array containing all relation objects
Doctrine_Table_Repository   getRepository()   getRepository
void   getTableName()  
void   getTemplate()  
array   getTemplates()   getTemplates returns all templates attached to this table
mixed   getTree()   getter for associated tree
mixed   getTypeOf()   getTypeOf
boolean   hasColumn()   hasColumn
boolean   hasDefaultValues()   hasDefaultValues returns true if this table has default values, otherwise false
boolean   hasPrimaryKey()  
boolean   hasRelation()   hasRelation
mixed   isTree()   determine if table acts as tree
mixed   prepareValue()   prepareValue this method performs special data preparation depending on the type of the given column
void   setColumn()   setColumn
void   setData()   setData doctrine uses this function internally users are strongly discouraged to use this function
Doctrine_Table   setOption()   setOption sets an option and returns this object in order to allow flexible method chaining
void   setPrimaryKey()  
void   setTableName()  
void   __get()   __get an alias for getOption
void   __isset()   __isset
string   __toString()   returns a string representation of this object

[ Top ]
Properties
array   $columnAliases = array() [line 85]
API Tags:
Access:  protected


[ Top ]
integer   $columnCount [line 90]
API Tags:
Access:  private


[ Top ]
array   $columns = array() [line 80]
API Tags:
Access:  protected


[ Top ]
Doctrine_Connection   $conn [line 56]
API Tags:
Access:  private


[ Top ]
array   $data = array() [line 39]
API Tags:
Access:  private


[ Top ]
boolean   $hasDefaultValues [line 94]
API Tags:
Access:  private


[ Top ]
mixed   $identifier [line 47]
API Tags:
Access:  private


[ Top ]
integer   $identifierType [line 52]
API Tags:
See:  Doctrine_Identifier constants
Access:  private


[ Top ]
array   $identityMap = array() [line 60]
API Tags:
Access:  private


[ Top ]
array   $options = array('name' => null,
'tableName' => null,
'sequenceName' => null,
'inheritanceMap' => array(),'enumMap'=>array(),'engine'=>null,'charset'=>null,'collation'=>null,'treeImpl'=>null,'treeOptions'=>null,'indexes'=>array(),'parents'=>array(),'versioning'=>null,)
[line 136]
API Tags:
Access:  protected


[ Top ]
array   $primaryKeys = array() [line 43]
API Tags:
Access:  private


[ Top ]
Doctrine_Table_Repository   $repository [line 64]
API Tags:
Access:  private


[ Top ]
Doctrine_Tree   $tree [line 153]
API Tags:
Access:  protected


[ Top ]
Doctrine_Relation_Parser   $_parser [line 157]
API Tags:
Access:  protected


[ Top ]
array   $_templates [line 161]
API Tags:
Access:  protected


[ Top ]
Methods
Constructor __construct  [line 170]

  void __construct( $name, Doctrine_Connection $conn  )

the constructor

Parameters:
   $name: 
Doctrine_Connection   $conn: 

API Tags:
Access:  public

Information Tags:
Throws:  Doctrine_Table_Exception if there is already an instance of this table
Throws:  Doctrine_Connection_Exception if there are no opened connections

[ Top ]
addCheckConstraint  [line 488]

  void addCheckConstraint( $definition, $name  )

addCheckConstraint

adds a check constraint to this table

Parameters:
   $definition: 
   $name: 

API Tags:
Access:  public


[ Top ]
addForeignKey  [line 477]

  void addForeignKey( $definition  )

addForeignKey

adds a foreignKey to this table

Parameters:
array   $definition: 

API Tags:
Access:  public


[ Top ]
addIndex  [line 505]

  void addIndex( $index, $definition  )

addIndex

adds an index to this table

Parameters:
   $index: 
array   $definition: 

API Tags:
Access:  public


[ Top ]
addRecord  [line 944]

  boolean addRecord( Doctrine_Record $record  )

addRecord adds a record to identity map

Parameters:
Doctrine_Record   $record:  record to be added

API Tags:
Access:  public


[ Top ]
addTemplate  [line 1315]

  void addTemplate( $template, Doctrine_Template $impl  )

Parameters:
   $template: 
Doctrine_Template   $impl: 

API Tags:
Access:  public


[ Top ]
applyInheritance  [line 885]

  string applyInheritance( $where $where  )

applyInheritance

Parameters:
$where   $where:  query where part to be modified

API Tags:
Return:  query where part with column aggregation inheritance added
Access:  public


[ Top ]
bind  [line 522]

  void bind( $args, $type  )

Parameters:
   $args: 
   $type: 

API Tags:
Access:  public


[ Top ]
clear  [line 933]

  void clear( )

clear clears the first level cache (identityMap)


API Tags:
Access:  public


[ Top ]
count  [line 1075]

  integer count( )

count


API Tags:
Access:  public


Implementation of:
Countable::count

[ Top ]
create  [line 846]

  Doctrine_Record create( [ $array = array()]  )

create creates a new record

Parameters:
$array   $array:  an array where keys are field names and values representing field values

API Tags:
Access:  public


[ Top ]
createQuery  [line 604]

  Doctrine_Query createQuery( )

createQuery creates a new Doctrine_Query object and adds the component name of this table as the query 'from' part


API Tags:
Access:  public


[ Top ]
enumIndex  [line 1122]

  mixed enumIndex( string $field, mixed $value  )

enumIndex

Parameters:
string   $field: 
mixed   $value: 

API Tags:
Access:  public


[ Top ]
enumValue  [line 1108]

  mixed enumValue( string $field, integer $index  )

enumValue

Parameters:
string   $field: 
integer   $index: 

API Tags:
Access:  public


[ Top ]
export  [line 316]

  boolean export( )

export exports this table to database based on column and option definitions


API Tags:
Return:  whether or not the export operation was successful false if table already existed in the database
Access:  public

Information Tags:
Throws:  Doctrine_Connection_Exception if some error other than Doctrine::ERR_ALREADY_EXISTS occurred during the create table operation

[ Top ]
exportConstraints  [line 413]

  void exportConstraints( )

exportConstraints exports the constraints of this table into database based on option definitions


API Tags:
Access:  public

Information Tags:
Throws:  Doctrine_Connection_Exception if something went wrong on db level

[ Top ]
find  [line 858]

  Doctrine_Record|false find( $id $id  )

finds a record by its identifier

Parameters:
$id   $id:  database row id

API Tags:
Return:  a record for given database identifier
Access:  public


[ Top ]
findAll  [line 903]

  Doctrine_Collection findAll( )

findAll returns a collection of records


API Tags:
Access:  public


[ Top ]
findByDql  [line 924]

  void findByDql( $dql, [ $params = array()]  )

Parameters:
   $dql: 
array   $params: 

API Tags:
Access:  public


[ Top ]
findBySql  [line 918]

  Doctrine_Collection findBySql( string $dql, [ $params = array()]  )

findByDql finds records with given DQL where clause returns a collection of records

Parameters:
string   $dql:  DQL after WHERE clause
array   $params:  query parameters

API Tags:
Access:  public


[ Top ]
getClassnameToReturn  [line 1027]

  string getClassnameToReturn( )

Get the classname to return. Most often this is just the options['name']

Check the subclasses option and the inheritanceMap for each subclass to see if all the maps in a subclass is met. If this is the case return that subclass name. If no subclasses match or if there are no subclasses defined return the name of the class for this tables record.


API Tags:
Return:  The name of the class to create
Access:  public

Information Tags:
Todo:  this function could use reflection to check the first time it runs if the subclassing option is not set.

[ Top ]
getColumnCount  [line 1133]

  integer getColumnCount( )

getColumnCount


API Tags:
Return:  the number of columns in this table
Access:  public


[ Top ]
getColumnName  [line 668]

  string getColumnName( string $alias  )

getColumnName

returns a column name for column alias if the actual name for the alias cannot be found this method returns the given alias

Parameters:
string   $alias:  column alias

API Tags:
Return:  column name
Access:  public


[ Top ]
getColumnNames  [line 1152]

  array getColumnNames( )

returns an array containing all the column names


API Tags:
Access:  public


[ Top ]
getColumns  [line 1143]

  array getColumns( )

returns all columns and their definitions


API Tags:
Access:  public


[ Top ]
getComponentName  [line 1285]

  void getComponentName( )


API Tags:
Access:  public


[ Top ]
getConnection  [line 835]

  Doctrine_Connection getConnection( )


API Tags:
Access:  public


[ Top ]
getData  [line 1198]

  array getData( )

returns internal data, used by Doctrine_Record instances when retrieving data from database


API Tags:
Access:  public


[ Top ]
getDefaultValueOf  [line 768]

  mixed getDefaultValueOf( string $column  )

getDefaultValueOf returns the default value(if any) for given column

Parameters:
string   $column: 

API Tags:
Access:  public


[ Top ]
getDefinitionOf  [line 1161]

  mixed getDefinitionOf( $column  )

getDefinitionOf

Parameters:
   $column: 

API Tags:
Return:  array on success, false on failure
Access:  public


[ Top ]
getEnumValues  [line 1093]

  array getEnumValues( string $field  )

Parameters:
string   $field: 

API Tags:
Access:  public


[ Top ]
getExportableFormat  [line 326]

  array getExportableFormat( [ $parseForeignKeys = true]  )

getExportableFormat returns exportable presentation of this object

Parameters:
   $parseForeignKeys: 

API Tags:
Access:  public


[ Top ]
getIdentifier  [line 783]

  mixed getIdentifier( )


API Tags:
Access:  public


[ Top ]
getIdentifierType  [line 790]

  integer getIdentifierType( )


API Tags:
Access:  public


[ Top ]
getIndex  [line 514]

  array|boolean getIndex( $index  )

getIndex

Parameters:
   $index: 

API Tags:
Return:  array on success, FALSE on failure
Access:  public


[ Top ]
getOption  [line 651]

  mixed getOption( string $name  )

getOption returns the value of given option

Parameters:
string   $name:  the name of the option

API Tags:
Return:  the value of given option
Access:  public


[ Top ]
getOptions  [line 466]

  array getOptions( )

getOptions returns all options of this table and the associated values


API Tags:
Return:  all options and their values
Access:  public


[ Top ]
getPrimaryKeys  [line 821]

  array getPrimaryKeys( )

returns all primary keys


API Tags:
Access:  public


[ Top ]
getProxy  [line 1053]

  void getProxy( [$id $id = null]  )

Parameters:
$id   $id:  database row id

API Tags:
Access:  public

Information Tags:
Throws:  Doctrine_Find_Exception

[ Top ]
getQueryObject  [line 1083]

  Doctrine_Query getQueryObject( )


API Tags:
Return:  a Doctrine_Query object
Access:  public


[ Top ]
getRecord  [line 963]

  Doctrine_Record getRecord( )

getRecord first checks if record exists in identityMap, if not returns a new record


API Tags:
Access:  public


[ Top ]
getRelation  [line 583]

  void getRelation( string $alias, [ $recursive = true]  )

getRelation

Parameters:
string   $alias:  relation alias
   $recursive: 

API Tags:
Access:  public


[ Top ]
getRelationParser  [line 434]

  Doctrine_Relation_Parser getRelationParser( )

getRelationParser return the relation parser associated with this table


API Tags:
Return:  relation parser object
Access:  public


[ Top ]
getRelations  [line 593]

  array getRelations( )

getRelations returns an array containing all relation objects


API Tags:
Return:  an array of Doctrine_Relation objects
Access:  public


[ Top ]
getRepository  [line 613]

  Doctrine_Table_Repository getRepository( )

getRepository


API Tags:
Access:  public


[ Top ]
getTableName  [line 1289]

  void getTableName( )


API Tags:
Access:  public


[ Top ]
getTemplate  [line 1306]

  void getTemplate( $template  )

Parameters:
   $template: 

API Tags:
Access:  public


[ Top ]
getTemplates  [line 303]

  array getTemplates( )

getTemplates returns all templates attached to this table


API Tags:
Return:  an array containing all templates
Access:  public


[ Top ]
getTree  [line 1272]

  mixed getTree( )

getter for associated tree


API Tags:
Return:  if tree return instance of Doctrine_Tree, otherwise returns false
Access:  public


[ Top ]
getTypeOf  [line 1173]

  mixed getTypeOf( $column  )

getTypeOf

Parameters:
   $column: 

API Tags:
Return:  string on success, false on failure
Access:  public


[ Top ]
hasColumn  [line 798]

  boolean hasColumn( $name  )

hasColumn

Parameters:
   $name: 

API Tags:
Access:  public


[ Top ]
hasDefaultValues  [line 757]

  boolean hasDefaultValues( )

hasDefaultValues returns true if this table has default values, otherwise false


API Tags:
Access:  public


[ Top ]
hasPrimaryKey  [line 828]

  boolean hasPrimaryKey( $key  )

Parameters:
   $key: 

API Tags:
Access:  public


[ Top ]
hasRelation  [line 573]

  boolean hasRelation( string $alias  )

hasRelation

Parameters:
string   $alias:  the relation to check if exists

API Tags:
Return:  true if the relation exists otherwise false
Access:  public


[ Top ]
isTree  [line 1302]

  mixed isTree( )

determine if table acts as tree


API Tags:
Return:  if tree return true, otherwise returns false
Access:  public


[ Top ]
prepareValue  [line 1225]

  mixed prepareValue( string $field, string $value  )

prepareValue this method performs special data preparation depending on the type of the given column

  1. It unserializes array and object typed columns
  2. Uncompresses gzip typed columns
  3. Gets the appropriate enum values for enum typed columns
  4. Initializes special null object pointer for null values (for fast column existence checking purposes)
example: <code type='php'> $field = 'name'; $value = null; $table->prepareValue($field, $value); // Doctrine_Null </code>

Parameters:
string   $field:  the name of the field
string   $value:  field value

API Tags:
Return:  prepared value
Access:  public

Information Tags:
Throws:  Doctrine_Table_Exception if uncompression of gzip typed column fails *
Throws:  Doctrine_Table_Exception if unserialization of array/object typed column fails or

[ Top ]
setColumn  [line 687]

  void setColumn( string $name, string $type, [integer $length = null], [mixed $options = array()]  )

setColumn

Parameters:
string   $name: 
string   $type: 
integer   $length: 
mixed   $options: 

API Tags:
Access:  public

Information Tags:
Throws:  Doctrine_Table_Exception if trying use wrongly typed parameter

[ Top ]
setData  [line 1188]

  void setData( $data  )

setData doctrine uses this function internally users are strongly discouraged to use this function

Parameters:
array   $data:  internal data

API Tags:
Access:  public


[ Top ]
setOption  [line 627]

  Doctrine_Table setOption( string $name, mixed $value  )

setOption sets an option and returns this object in order to allow flexible method chaining

Parameters:
string   $name:  the name of the option to set
mixed   $value:  the value of the option

API Tags:
Return:  this object
See:  Doctrine_Table::$_options for available options
Access:  public


[ Top ]
setPrimaryKey  [line 806]

  void setPrimaryKey( mixed $key  )

Parameters:
mixed   $key: 

API Tags:
Access:  public


[ Top ]
setTableName  [line 1293]

  void setTableName( $tableName  )

Parameters:
   $tableName: 

API Tags:
Access:  public


[ Top ]
__get  [line 444]

  void __get( string $option  )

__get an alias for getOption

Parameters:
string   $option: 

API Tags:
Access:  public


[ Top ]
__isset  [line 456]

  void __isset( string $option  )

__isset

Parameters:
string   $option: 

API Tags:
Access:  public


[ Top ]
__toString  [line 1324]

  string __toString( )

returns a string representation of this object


API Tags:
Access:  public


[ Top ]