Class:Doctrine_Table - Superclass: Doctrine_Configurable Class:Doctrine_Configurable - Superclass: Doctrine_Locator_Injectable Doctrine_Locator_Injectable
⌊ Doctrine_Configurable
⌊ Doctrine_Table
public class Doctrine_Table
extends Doctrine_Configurable
www.doctrine-project.org| Field Summary | |
|---|---|
| protected array $_columnNames an array of column names keys are field names and values column names. used to look up column names from field names. this is the reverse lookup map of $_fieldNames. | . |
| protected array $columns an array of column definitions, keys are column names and values are column definitions the definition array has atleast the following values: -- type the column type, eg. 'integer' -- length the column length, eg. 11 additional keys: -- notnull whether or not the column is marked as notnull -- values enum values -- notblank notblank validator + notnull constraint ... many more | . |
| protected Doctrine_Connection $conn Doctrine_Connection object that created this table | . |
| protected array $data temporary data which is then loaded into Doctrine_Record::$_data | . |
| protected array $_fieldNames an array of field names, used to look up field names from column names. Keys are column names and values are field names. Alias for columns are here. | . |
| protected array $_filters an array containing all record filters attached to this table | . |
| protected Doctrine_Record_Generator $generator | Generator instance responsible for constructing this table. |
| protected array $_generators an array containing all generators attached to this table | . |
| protected mixed $identifier The field names of all fields that are part of the identifier/primary key | . |
| protected integer $identifierType the type of identifier this table uses | . |
| protected array $identityMap first level cache | . |
| protected array $_invokedMethods method invoker cache | . |
| protected array $options an array containing all options -- name name of the component, for example component name of the GroupTable is 'Group' -- parents the parent classes of this component -- declaringClass name of the table definition declaring class (when using inheritance the class that defines the table structure can be any class in the inheritance hierarchy, hence we need reflection to check out which class actually calls setTableDefinition) -- tableName database table name, in most cases this is the same as component name but in some cases where one-table-multi-class inheritance is used this will be the name of the inherited table -- sequenceName Some databases need sequences instead of auto incrementation primary keys, you can set specific sequence for your table by calling setOption('sequenceName', $seqName) where $seqName is the name of the desired sequence -- enumMap enum value arrays -- inheritanceMap inheritanceMap is used for inheritance mapping, keys representing columns and values the column values that should correspond to child classes -- type table type (mysql example: INNODB) -- charset character set -- foreignKeys the foreign keys of this table -- checks the check constraints of this table, eg. 'price > dicounted_price' -- collate collate attribute -- indexes the index definitions of this table -- treeImpl the tree implementation of this table (if any) -- treeOptions the tree options -- queryParts the bound query parts -- versioning | . |
| protected Doctrine_Relation_Parser $_parser relation parser object | . |
| protected Doctrine_Table_Repository $repository record repository | . |
| protected array $_templates an array containing all templates attached to this table | . |
| protected Doctrine_Tree $tree tree object associated with this table | . |
| protected array $_uniques | Array of unique sets of fields. |
| protected integer $columnCount cached column count, Doctrine_Record uses this column count in when determining its state | . |
| protected boolean $hasDefaultValues whether or not this table has default values | . |
| protected Doctrine_Record $record empty instance of the given model | . |
| Fields inherited from Doctrine\Doctrine_Configurable | |
|---|---|
| _impl, _params, attributes, parent | |
| Fields inherited from Doctrine\Doctrine_Locator_Injectable | |
|---|---|
| _locator, _null, _resources | |
| Constructor Summary | |
|---|---|
Doctrine_Table(string name, Doctrine_Connection conn, boolean initDefinition) the constructor. |
|
| Method Summary | |
|---|---|
| void | addCheckConstraint(mixed definition, mixed name, $definition ) Adds a check constraint to the table in-memory definition. |
| void | addForeignKey(array definition) Adds a foreignKey to the table in-memory definition. |
| Doctrine_Table | addGenerator(Doctrine_Record_Generator generator, string name) Adds a generate to the table instance.. |
| void | addIndex(string index, array definition) Adds an index to this table in-memory definition. |
| void | addNamedQuery(mixed queryKey, string|Doctrine_Query query) Adds a named query in the query registry. |
| boolean | addRecord(Doctrine_Record record) Adds a record to the first level cache (identity map). |
| Doctrine_Table | addTemplate(string template, Doctrine_Template impl) Adds a template to this table.. |
| final string | applyInheritance(mixed where, $where query) applyInheritance. |
| Doctrine_Locator | bind(array args, integer type, string name, mixed resource, mixed value) Adds a relation to the table. |
| Doctrine_Record | bindQueryPart(string queryPart, mixed value) Adds default query parts to the selects executed on this table. |
| Doctrine_Table | bindQueryParts(array queryParts) Binds query parts to this component.. |
| void | buildFindByWhere(mixed fieldName) |
| void | clear() Clears the first level cache (identityMap). |
| void | Construct template method. |
| integer | count() Implements Countable interface.. |
| Doctrine_Record | create(mixed array, $array an) Creates a new record. |
| Doctrine_Query | createNamedQuery(string queryKey) Creates a named query from one in the query registry. |
| Doctrine_Query | createQuery(string alias) Creates a query on this table. |
| integer | enumIndex(string fieldName, mixed value) Retrieves an enum index.. |
| mixed | enumValue(string fieldName, integer index) Retrieves an enum value. |
| Doctrine_Collection|array | execute(string queryKey, array params, int hydrationMode) Finds result of a named query. |
| Doctrine_Record|array | executeOne(string queryKey, array params, int hydrationMode) Fetches one record with a named query. |
| boolean | export() Exports this table to database based on the schema definition. |
| mixed | find(mixed name, mixed params, int hydrationMode) Finds a record by its identifier. |
| Doctrine_Collection|array | findAll(int hydrationMode) Retrieves all the records stored in this table.. |
| Doctrine_Collection|array | findBy(mixed fieldName, string value, int hydrationMode, string column) Find records basing on a field.. |
| Doctrine_Collection|array | findByDql(string dql, array params, int hydrationMode) Finds records in this table with a given DQL where clause.. |
| Doctrine_Collection|array | findBySql(string dql, array params, int hydrationMode) Finds records in this table with a given SQL where clause.. |
| Doctrine_Record | findOneBy(mixed fieldName, string value, int hydrationMode, string column) Finds the first record that satisfy the clause.. |
| string | getBoundQueryPart(string queryPart) Retrieves a bound query part.. |
| string | Get the classname to return. |
| integer | . |
| array | getColumnDefinition(string columnName) Retrieves a column definition from this table schema.. |
| string | getColumnName(mixed fieldName, string alias) Returns a column name for a column alias. |
| array | getColumnNames(mixed fieldNames) Returns an array containing all the column names.. |
| string | getColumnOwner(string columnName) Gets the owner of a column. |
| array | Retrieves all columns of the table.. |
| string | Gets the subclass of Doctrine_Record that belongs to this table.. |
| Doctrine_Connection|null | Returns the connection associated with this table (if any).. |
| array | getData() Returns internal data. |
| mixed | getDefaultValueOf(string fieldName) Retrieves the default value (if any) for a given column.. |
| array | getDefinitionOf(string fieldName) Retrieves the definition of a field. |
| array | getEnumValues(string fieldName) Retrieves the enum values for a given field.. |
| array | getExportableFormat(boolean parseForeignKeys) Returns an exportable representation of this object. |
| integer | getFieldLength(string fieldName) Gets the maximum length of a field. |
| string | getFieldName(string columnName) Returns a column alias for a column name. |
| array | Returns an array containing all the field names.. |
| array | getFieldValidators(string fieldName) Gets the names of all validators being applied on a field.. |
| array | getFilters. |
| Doctrine_Record_Generator | getGenerator(string generator) Gets generator instance for a passed name.. |
| array | Gets all the generators for this table.. |
| string | Returns the definition of the identifier key.. |
| array | Returns an array with all the identifier column names.. |
| integer | Retrieves the type of primary key. |
| array|boolean | getIndex(string index) Retrieves an index definition. |
| void | getMethodOwner(string method) getMethodOwner. |
| mixed | getOption(string name) Returns the value of a given option.. |
| array | Retrieves all options of this table and the associated values.. |
| string | getOrderByStatement(string alias, boolean columnNames) Get the table orderby statement. |
| Doctrine_Record_Generator | Get the parent generator responsible for this table instance. |
| final Doctrine_Record | getProxy(mixed id, $id database) . |
| Doctrine_Query | . |
| Doctrine_Record | Returns a new record. |
| Doctrine_Record | Gets the record instance for this table. |
| Doctrine_Relation | getRelation(string alias, mixed recursive) Retrieves a relation object for this component.. |
| Doctrine_Relation_Parser | Retrieves the relation parser associated with this table.. |
| array | Retrieves all relation objects defined on this table.. |
| Doctrine_Table_Repository | Gets the internal record repository.. |
| string | Gets the table name in the db.. |
| Doctrine_Template | getTemplate(string template) Retrieves a particular template by class name. |
| array | Retrieves all templates (behaviors) attached to this table.. |
| Doctrine_Tree | getTree() Gets associated tree. |
| string | getTypeOf(string fieldName) Retrieves the type of a field.. |
| string | getTypeOfColumn(string columnName) Retrieves the type of a column.. |
| array | Gets the array of unique fields sets.. |
| boolean | hasColumn(string columnName) Finds out whether the table definition contains a given column.. |
| boolean | Finds out whether this table has default values for columns.. |
| boolean | hasField(string fieldName) Finds out whether the table definition has a given field. |
| void | hasGenerator(string generator) Checks if a generator name exists.. |
| Doctrine_Record | hasMany(string componentName, string options) Binds One-to-Many / Many-to-Many aggregate relation. |
| Doctrine_Record | hasOne(string componentName, string options) Binds One-to-One aggregate relation. |
| boolean | hasRelation(string alias) Tests if a relation exists. |
| boolean | hasTemplate(string template) Checks if the table has a given template.. |
| void | initDefinition(string name) Initializes the in-memory table definition.. |
| void | Initializes the primary key. |
| boolean | Check whether this table was created by a record generator or not. |
| boolean | isIdentifier(string fieldName) Checks whether a field is in the primary key. |
| boolean | Checks whether a field identifier is of type autoincrement. |
| boolean | Checks whether a field identifier is a composite key.. |
| boolean | isInheritedColumn(mixed columnName, $columnName The) Checks whether a column is inherited from a component further up in the hierarchy.. |
| boolean | isTree() Determines if table acts as tree.. |
| mixed | prepareValue(mixed fieldName, string value, string typeHint, string field) Performs special data preparation. |
| string | processOrderBy(string alias, string orderBy, string columnNames) Process an order by statement to be prefixed with the passed alias and field names converted to column names if the 3rd argument is true.. |
| boolean | removeColumn(string fieldName) Removes a field name from the table schema information.. |
| boolean | removeRecord(Doctrine_Record record) Removes a record from the identity map. |
| void | setColumn(string name, string type, integer length, mixed options, boolean prepend) Adds a column to the schema. |
| void | setColumnOption(string columnName, string option, string value) Set an individual column option. |
| void | setColumnOptions(string columnName, mixed options, array validators) Customize the array of options for a column or multiple columns. |
| void | setColumns(array definitions) Set multiple column definitions at once. |
| Doctrine_Table | setConnection(mixed conn) Sets the default connection for this table. |
| void | setData(array data) Doctrine uses this function internally. |
| void | setGenerator(Doctrine_Record_Generator generator) Set the generator responsible for creating this table. |
| void | setMethodOwner(string method, string class) setMethodOwner. |
| Doctrine_Table | setOption(string name, mixed value) Sets an option for the table. |
| void | setOptions(array options) Sets all the options. |
| void | setTableName(string tableName) sets the table name in the schema definition.. |
| void | unique(array fields, array options, bool createUniqueIndex) Defines a n-uple of fields that must be unique for every record. |
| Doctrine_Table | unshiftFilter(Doctrine_Record_Filter filter) unshiftFilter. |
| Doctrine_Validator_ErrorStack | validateField(string fieldName, string value, Doctrine_Record record) Validates a given field using table ATTR_VALIDATE rules.. |
| void | validateUniques(Doctrine_Record record) Validates all the unique indexes. |
| Methods inherited from Doctrine\Doctrine_Configurable | |
|---|---|
| addListener, addRecordListener, getAttribute, getAttributes, getCharset, getCollate, getImpl, getListener, getParam, getParamNamespaces, getParams, getParent, getRecordListener, hasImpl, setAttribute, setCharset, setCollate, setEventListener, setImpl, setListener, setParam, setParent, setRecordListener, unsetAttribute | |
| Methods inherited from Doctrine\Doctrine_Locator_Injectable | |
|---|---|
| bind, getLocator, getNullObject, initNullObject, locate, setLocator | |
protected array $_columnNames an array of column names keys are field names and values column names. used to look up column names from field names. this is the reverse lookup map of $_fieldNames. $_columnNames = array()
protected array $columns an array of column definitions, keys are column names and values are column definitions the definition array has atleast the following values: -- type the column type, eg. 'integer' -- length the column length, eg. 11 additional keys: -- notnull whether or not the column is marked as notnull -- values enum values -- notblank notblank validator + notnull constraint ... many more $_columns = array()
protected Doctrine_Connection $conn Doctrine_Connection object that created this table $_conn
protected array $data temporary data which is then loaded into Doctrine_Record::$_data $_data = array()
protected array $_fieldNames an array of field names, used to look up field names from column names. Keys are column names and values are field names. Alias for columns are here. $_fieldNames = array()
protected array $_filters an array containing all record filters attached to this table $_filters = array()
protected Doctrine_Record_Generator $generator $_generator
Generator instance responsible for constructing this table
protected array $_generators an array containing all generators attached to this table $_generators = array()
protected mixed $identifier The field names of all fields that are part of the identifier/primary key $_identifier = array()
protected integer $identifierType the type of identifier this table uses $_identifierType
protected array $identityMap first level cache $_identityMap = array()
protected array $_invokedMethods method invoker cache $_invokedMethods = array()
protected array $options an array containing all options -- name name of the component, for example component name of the GroupTable is 'Group' -- parents the parent classes of this component -- declaringClass name of the table definition declaring class (when using inheritance the class that defines the table structure can be any class in the inheritance hierarchy, hence we need reflection to check out which class actually calls setTableDefinition) -- tableName database table name, in most cases this is the same as component name but in some cases where one-table-multi-class inheritance is used this will be the name of the inherited table -- sequenceName Some databases need sequences instead of auto incrementation primary keys, you can set specific sequence for your table by calling setOption('sequenceName', $seqName) where $seqName is the name of the desired sequence -- enumMap enum value arrays -- inheritanceMap inheritanceMap is used for inheritance mapping, keys representing columns and values the column values that should correspond to child classes -- type table type (mysql example: INNODB) -- charset character set -- foreignKeys the foreign keys of this table -- checks the check constraints of this table, eg. 'price > dicounted_price' -- collate collate attribute -- indexes the index definitions of this table -- treeImpl the tree implementation of this table (if any) -- treeOptions the tree options -- queryParts the bound query parts -- versioning $_options = array(...)
protected Doctrine_Relation_Parser $_parser relation parser object $_parser
protected Doctrine_Table_Repository $repository record repository $_repository
protected array $_templates an array containing all templates attached to this table $_templates = array()
protected Doctrine_Tree $tree tree object associated with this table $_tree
protected array $_uniques $_uniques = array()
Array of unique sets of fields. These values are validated on save
protected integer $columnCount cached column count, Doctrine_Record uses this column count in when determining its state $columnCount
protected boolean $hasDefaultValues whether or not this table has default values $hasDefaultValues
protected Doctrine_Record $record empty instance of the given model $record
public Doctrine_Table(string name, Doctrine_Connection conn, boolean initDefinition)
the constructor
public void addCheckConstraint(mixed definition, mixed name, $definition )
Adds a check constraint to the table in-memory definition.
This method adds a CHECK constraint to the schema definition. It does not add the constraint to the physical table in the db; @see export().
public void addForeignKey(array definition)
Adds a foreignKey to the table in-memory definition.
This method adds a foreign key to the schema definition. It does not add the key to the physical table in the db; @see export().
public Doctrine_Table addGenerator(Doctrine_Record_Generator generator, string name)
Adds a generate to the table instance.
public void addIndex(string index, array definition)
Adds an index to this table in-memory definition.
This method adds an INDEX to the schema definition. It does not add the index to the physical table in the db; @see export().
public void addNamedQuery(mixed queryKey, string|Doctrine_Query query)
Adds a named query in the query registry.
This methods register a query object with a name to use in the future.
public boolean addRecord(Doctrine_Record record)
Adds a record to the first level cache (identity map).
This method is used internally to cache records, ensuring that only one object that represents a sql record exists in all scopes.
public Doctrine_Table addTemplate(string template, Doctrine_Template impl)
Adds a template to this table.
public final string applyInheritance(mixed where, $where query)
applyInheritance
public Doctrine_Locator bind(array args, integer type, string name, mixed resource, mixed value)
Adds a relation to the table.
This method defines a relation on this table, that will be present on every record belonging to this component.
public Doctrine_Record bindQueryPart(string queryPart, mixed value)
Adds default query parts to the selects executed on this table.
This method binds given value to given query part. Every query created by this table will have this part set by default.
public Doctrine_Table bindQueryParts(array queryParts)
Binds query parts to this component.
public void buildFindByWhere(mixed fieldName)
public void clear()
Clears the first level cache (identityMap).
This method ensures that records are reloaded from the db.
public void construct()
Construct template method.
This method provides concrete Table classes with the possibility to hook into the constructor procedure. It is called after the Doctrine_Table construction process is finished.
public integer count()
Implements Countable interface.
public Doctrine_Record create(mixed array, $array an)
Creates a new record.
This method create a new instance of the model defined by this table. The class of this record is the subclass of Doctrine_Record defined by this component. The record is not created in the database until you call @save().
public Doctrine_Query createNamedQuery(string queryKey)
Creates a named query from one in the query registry.
This method clones a new query object from a previously registered one.
public Doctrine_Query createQuery(string alias)
Creates a query on this table.
This method returns a new Doctrine_Query object and adds the component
name of this table as the query 'from' part.
$table = Doctrine_Core::getTable('User');
$table->createQuery('myuser')
->where('myuser.Phonenumber = ?', '5551234');
public integer enumIndex(string fieldName, mixed value)
Retrieves an enum index.
public mixed enumValue(string fieldName, integer index)
Retrieves an enum value.
This method finds a enum string value. If ATTR_USE_NATIVE_ENUM is set on the connection, index and value are the same thing.
public Doctrine_Collection|array execute(string queryKey, array params, int hydrationMode)
Finds result of a named query.
This method fetches data using the provided $queryKey to choose a named query in the query registry.
public Doctrine_Record|array executeOne(string queryKey, array params, int hydrationMode)
Fetches one record with a named query.
This method uses the provided $queryKey to clone and execute the associated named query in the query registry.
public boolean export()
Exports this table to database based on the schema definition.
This method create a physical table in the database, using the definition that comes from the component Doctrine_Record instance.
public mixed find(mixed name, mixed params, int hydrationMode)
Finds a record by its identifier.
$table->find(11);
$table->find(11, Doctrine_Core::HYDRATE_RECORD);
$table->find('namedQueryForYearArchive', array(2009), Doctrine_Core::HYDRATE_ARRAY);
public Doctrine_Collection|array findAll(int hydrationMode)
Retrieves all the records stored in this table.
public Doctrine_Collection|array findBy(mixed fieldName, string value, int hydrationMode, string column)
Find records basing on a field.
public Doctrine_Collection|array findByDql(string dql, array params, int hydrationMode)
Finds records in this table with a given DQL where clause.
public Doctrine_Collection|array findBySql(string dql, array params, int hydrationMode)
Finds records in this table with a given SQL where clause.
public Doctrine_Record findOneBy(mixed fieldName, string value, int hydrationMode, string column)
Finds the first record that satisfy the clause.
public string getBoundQueryPart(string queryPart)
Retrieves a bound query part.
public 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.
public integer getColumnCount()
public array getColumnDefinition(string columnName)
Retrieves a column definition from this table schema.
public string getColumnName(mixed fieldName, string alias)
Returns a column name for a column alias.
If the actual name for the alias cannot be found this method returns the given alias.
public array getColumnNames(mixed fieldNames)
Returns an array containing all the column names.
public string getColumnOwner(string columnName)
Gets the owner of a column.
The owner of a column is the name of the component in a hierarchy that defines the column.
public array getColumns()
Retrieves all columns of the table.
public string getComponentName()
Gets the subclass of Doctrine_Record that belongs to this table.
public Doctrine_Connection|null getConnection()
Returns the connection associated with this table (if any).
public array getData()
Returns internal data.
This method is used by Doctrine_Record instances when retrieving data from database.
public mixed getDefaultValueOf(string fieldName)
Retrieves the default value (if any) for a given column.
public array getDefinitionOf(string fieldName)
Retrieves the definition of a field.
This method retrieves the definition of the column, basing of $fieldName which can be a column name or a field name (alias).
public array getEnumValues(string fieldName)
Retrieves the enum values for a given field.
public array getExportableFormat(boolean parseForeignKeys)
Returns an exportable representation of this object.
This method produces a array representation of the table schema, where keys are tableName, columns (@see $_columns) and options. The options subarray contains 'primary' and 'foreignKeys'.
public integer getFieldLength(string fieldName)
Gets the maximum length of a field. For integer fields, length is bytes occupied. For decimal fields, it is the total number of cyphers
public string getFieldName(string columnName)
Returns a column alias for a column name.
If no alias can be found the column name is returned.
public array getFieldNames()
Returns an array containing all the field names.
public array getFieldValidators(string fieldName)
Gets the names of all validators being applied on a field.
public array getFilters()
getFilters
public Doctrine_Record_Generator getGenerator(string generator)
Gets generator instance for a passed name.
public array getGenerators()
Gets all the generators for this table.
public string getIdentifier()
Returns the definition of the identifier key.
public array getIdentifierColumnNames()
Returns an array with all the identifier column names.
public integer getIdentifierType()
Retrieves the type of primary key.
This method finds out if the primary key is multifield.
public array|boolean getIndex(string index)
Retrieves an index definition.
This method returns a given index definition: @see addIndex().
public void getMethodOwner(string method)
getMethodOwner
public mixed getOption(string name)
Returns the value of a given option.
public array getOptions()
Retrieves all options of this table and the associated values.
public string getOrderByStatement(string alias, boolean columnNames)
Get the table orderby statement
public Doctrine_Record_Generator getParentGenerator()
Get the parent generator responsible for this table instance
public final Doctrine_Record getProxy(mixed id, $id database)
public Doctrine_Query getQueryObject()
public Doctrine_Record getRecord()
Returns a new record.
This method checks if a internal record exists in identityMap, if does not exist it creates a new one.
public Doctrine_Record getRecordInstance()
Gets the record instance for this table.
The Doctrine_Table instance always holds at least one instance of a model so that it can be reused for several things, but primarily it is first used to instantiate all the internal in memory schema definition.
public Doctrine_Relation getRelation(string alias, mixed recursive)
Retrieves a relation object for this component.
public Doctrine_Relation_Parser getRelationParser()
Retrieves the relation parser associated with this table.
public array getRelations()
Retrieves all relation objects defined on this table.
public Doctrine_Table_Repository getRepository()
Gets the internal record repository.
public string getTableName()
Gets the table name in the db.
public Doctrine_Template getTemplate(string template)
Retrieves a particular template by class name.
This method retrieves a behavior/template object attached to the table. For Doctrine_Template_* classes, the base name can be used.
public array getTemplates()
Retrieves all templates (behaviors) attached to this table.
public Doctrine_Tree getTree()
Gets associated tree. This method returns the associated Tree object (if any exists). Normally implemented by NestedSet behavior.
public string getTypeOf(string fieldName)
Retrieves the type of a field.
public string getTypeOfColumn(string columnName)
Retrieves the type of a column.
public array getUniques()
Gets the array of unique fields sets.
public boolean hasColumn(string columnName)
Finds out whether the table definition contains a given column.
public boolean hasDefaultValues()
Finds out whether this table has default values for columns.
public boolean hasField(string fieldName)
Finds out whether the table definition has a given field.
This method returns true if @see hasColumn() returns true or if an alias named $fieldName exists.
public void hasGenerator(string generator)
Checks if a generator name exists.
public Doctrine_Record hasMany(string componentName, string options)
Binds One-to-Many / Many-to-Many aggregate relation
public Doctrine_Record hasOne(string componentName, string options)
Binds One-to-One aggregate relation
public boolean hasRelation(string alias)
Tests if a relation exists.
This method queries the table definition to find out if a relation is defined for this component. Alias defined with foreignAlias are not recognized as there's only one Doctrine_Relation object on the owning side.
public boolean hasTemplate(string template)
Checks if the table has a given template.
public void initDefinition(string name)
Initializes the in-memory table definition.
public void initIdentifier()
Initializes the primary key.
Called in the construction process, builds the identifier definition copying in the schema the list of the fields which constitutes the primary key.
public boolean isGenerator()
Check whether this table was created by a record generator or not
public boolean isIdentifier(string fieldName)
Checks whether a field is in the primary key.
Checks if $fieldName is part of the table identifier, which defines the one-column or multi-column primary key.
public boolean isIdentifierAutoincrement()
Checks whether a field identifier is of type autoincrement.
This method checks if the primary key is a AUTOINCREMENT column or if the table uses a natural key.
public boolean isIdentifierComposite()
Checks whether a field identifier is a composite key.
public boolean isInheritedColumn(mixed columnName, $columnName The)
Checks whether a column is inherited from a component further up in the hierarchy.
public boolean isTree()
Determines if table acts as tree.
public mixed prepareValue(mixed fieldName, string value, string typeHint, string field)
Performs special data preparation.
This method returns a representation of a field data, depending on the type of the given column.
1. It unserializes array and object typed columns 2. Uncompresses gzip typed columns 3. Initializes special null object pointer for null values (for fast column existence checking purposes)
example:
$field = 'name';
$value = null;
$table->prepareValue($field, $value); // Doctrine_Null
public string processOrderBy(string alias, string orderBy, string columnNames)
Process an order by statement to be prefixed with the passed alias and field names converted to column names if the 3rd argument is true.
public boolean removeColumn(string fieldName)
Removes a field name from the table schema information.
public boolean removeRecord(Doctrine_Record record)
Removes a record from the identity map.
This method deletes from the cache the given record; can be used to force reloading of an object from database.
public void setColumn(string name, string type, integer length, mixed options, boolean prepend)
Adds a column to the schema.
This method does not alter the database table; @see export();
public void setColumnOption(string columnName, string option, string value)
Set an individual column option
public void setColumnOptions(string columnName, mixed options, array validators)
Customize the array of options for a column or multiple columns. First argument can be a single field/column name or an array of them. The second argument is an array of options.
[php] public function setTableDefinition() { parent::setTableDefinition(); $this->setColumnOptions('username', array( 'unique' => true )); }
public void setColumns(array definitions)
Set multiple column definitions at once
public Doctrine_Table setConnection(mixed conn)
Sets the default connection for this table.
This method assign the connection which this table will use to create queries.
public void setData(array data)
Doctrine uses this function internally. Users are strongly discouraged to use this function.
public void setGenerator(Doctrine_Record_Generator generator)
Set the generator responsible for creating this table
public void setMethodOwner(string method, string class)
setMethodOwner
public Doctrine_Table setOption(string name, mixed value)
Sets an option for the table.
This method sets an option and returns this object in order to allow flexible method chaining.
public void setOptions(array options)
Sets all the options.
This method sets options of the table that are specified in the argument. It has no effect on other options.
public void setTableName(string tableName)
sets the table name in the schema definition.
public void unique(array fields, array options, bool createUniqueIndex)
Defines a n-uple of fields that must be unique for every record.
This method Will automatically add UNIQUE index definition and validate the values on save. The UNIQUE index is not created in the database until you use @see export().
public Doctrine_Table unshiftFilter(Doctrine_Record_Filter filter)
unshiftFilter
public Doctrine_Validator_ErrorStack validateField(string fieldName, string value, Doctrine_Record record)
Validates a given field using table ATTR_VALIDATE rules.
public void validateUniques(Doctrine_Record record)
Validates all the unique indexes.
This methods validates 'unique' sets of fields for the given Doctrine_Record instance. Pushes error to the record error stack if they are generated.
Doctrine_Table represents a database table each Doctrine_Table holds the information of foreignKeys and associations