Doctrine 1.2.4
Doctrine_Relation_Association_Self Class Reference

Inherits Doctrine_Relation_Association.

Public Member Functions

 __toString ()
 
 getAlias ()
 
 getAssociationFactory ()
 
 getClass ()
 
 getForeign ()
 
 getForeignColumnName ()
 
 getForeignFieldName ()
 
 getForeignKeyName ()
 
 getForeignRefColumnName ()
 
 getForeignRefFieldName ()
 
 getLocal ()
 
 getLocalColumnName ()
 
 getLocalFieldName ()
 
 getLocalRefColumnName ()
 
 getLocalRefFieldName ()
 
 getOrderBy ($alias=null, $columnNames=false)
 
 getOrderByStatement ($alias=null, $columnNames=false)
 
 getRelationDql ($count, $context= 'record')
 
 getRelationDql ($count)
 
 getTable ()
 
 getType ()
 
 hasConstraint ()
 
 isCascadeDelete ()
 
 isOneToOne ()
 
 toArray ()
 

Data Fields

const MANY = 1
 
const ONE = 0
 

Detailed Description

Definition at line 33 of file Self.php.

Member Function Documentation

Doctrine_Relation::__toString ( )
inherited

__toString

Returns
string

Definition at line 444 of file Relation.php.

{
$r[] = "<pre>";
foreach ($this->definition as $k => $v) {
if (is_object($v)) {
$v = 'Object(' . get_class($v) . ')';
}
$r[] = $k . ' : ' . $v;
}
$r[] = "</pre>";
return implode("\n", $r);
}
Doctrine_Relation::getAlias ( )
finalinherited

getAlias returns the relation alias

Returns
string

Definition at line 214 of file Relation.php.

{
return $this->definition['alias'];
}
Doctrine_Relation_Association::getAssociationFactory ( )
inherited
Returns
Doctrine_Table

Definition at line 41 of file Association.php.

{
return $this->definition['refTable'];
}
Doctrine_Relation::getClass ( )
finalinherited

getClass returns the name of the related class

Returns
string

Definition at line 261 of file Relation.php.

{
return $this->definition['class'];
}
Doctrine_Relation::getForeign ( )
finalinherited

getForeign returns the name of the foreignkey column where the localkey column is pointing at

Returns
string

Definition at line 304 of file Relation.php.

{
return $this->definition['foreign'];
}
Doctrine_Relation::getForeignColumnName ( )
finalinherited

getForeignColumnName returns the column name of the foreign column

Returns
string $columnName

Definition at line 324 of file Relation.php.

{
return $this->definition['table']->getColumnName($this->definition['foreign']);
}
Doctrine_Relation::getForeignFieldName ( )
finalinherited

getLocalFieldName returns the field name of the foreign column

Definition at line 313 of file Relation.php.

{
return $this->definition['table']->getFieldName($this->definition['foreign']);
}
Doctrine_Relation::getForeignKeyName ( )
inherited

Get the name of the foreign key for this relationship

Returns
string $foreignKeyName

Definition at line 373 of file Relation.php.

{
if (isset($this->definition['foreignKeyName'])) {
return $this->definition['foreignKeyName'];
}
return $this['localTable']->getConnection()->generateUniqueRelationForeignKeyName($this);
}
Doctrine_Relation_Association::getForeignRefColumnName ( )
finalinherited

getForeignRefColumnName returns the column name of the foreign reference column

Definition at line 104 of file Association.php.

{
return $this->definition['refTable']->getColumnName($this->definition['foreign']);
}
Doctrine_Relation_Association::getForeignRefFieldName ( )
finalinherited

getForeignRefFieldName returns the field name of the foreign reference column

Definition at line 113 of file Association.php.

{
return $this->definition['refTable']->getFieldName($this->definition['foreign']);
}
Doctrine_Relation::getLocal ( )
finalinherited

getLocal returns the name of the local column

Returns
string

Definition at line 272 of file Relation.php.

{
return $this->definition['local'];
}
Doctrine_Relation::getLocalColumnName ( )
finalinherited

getLocalColumnName returns the column name of the local column

Returns
string $columnName

Definition at line 292 of file Relation.php.

{
return $this->definition['localTable']->getColumnName($this->definition['local']);
}
Doctrine_Relation::getLocalFieldName ( )
finalinherited

getLocalFieldName returns the field name of the local column

Definition at line 281 of file Relation.php.

{
return $this->definition['localTable']->getFieldName($this->definition['local']);
}
Doctrine_Relation_Association::getLocalRefColumnName ( )
finalinherited

getLocalRefColumnName returns the column name of the local reference column

Definition at line 86 of file Association.php.

{
return $this->definition['refTable']->getColumnName($this->definition['local']);
}
Doctrine_Relation_Association::getLocalRefFieldName ( )
finalinherited

getLocalRefFieldName returns the field name of the local reference column

Definition at line 95 of file Association.php.

{
return $this->definition['refTable']->getFieldName($this->definition['local']);
}
Doctrine_Relation::getOrderBy (   $alias = null,
  $columnNames = false 
)
inherited

Get the relationship orderby SQL/DQL

Parameters
string$aliasThe alias to use
boolean$columnNamesWhether or not to use column names instead of field names
Returns
string $orderBy

Definition at line 388 of file Relation.php.

{
if ( ! $alias) {
$alias = $this->getTable()->getComponentName();
}
if ($orderBy = $this->getOrderByStatement($alias, $columnNames)) {
return ' ORDER BY ' . $orderBy;
}
}
Doctrine_Relation::getOrderByStatement (   $alias = null,
  $columnNames = false 
)
inherited

Get the relationship orderby statement

Parameters
string$aliasThe alias to use
boolean$columnNamesWhether or not to use column names instead of field names
Returns
string $orderByStatement

Definition at line 406 of file Relation.php.

{
$table = $this->getTable();
if ( ! $alias) {
$alias = $table->getComponentName();
}
if (isset($this->definition['orderBy'])) {
return $table->processOrderBy($alias, $this->definition['orderBy'], $columnNames);
} else {
return $table->getOrderByStatement($alias, $columnNames);
}
}
Doctrine_Relation_Association_Self::getRelationDql (   $count,
  $context = 'record' 
)

getRelationDql

Parameters
integer$count
Returns
string

Definition at line 41 of file Self.php.

{
switch ($context) {
case 'record':
$identifierColumnNames = $this->definition['table']->getIdentifierColumnNames();
$identifier = array_pop($identifierColumnNames);
$sub = 'SELECT '.$this->definition['foreign']
. ' FROM '.$this->definition['refTable']->getTableName()
. ' WHERE '.$this->definition['local']
. ' = ?';
$sub2 = 'SELECT '.$this->definition['local']
. ' FROM '.$this->definition['refTable']->getTableName()
. ' WHERE '.$this->definition['foreign']
. ' = ?';
$dql = 'FROM ' . $this->definition['table']->getComponentName()
. '.' . $this->definition['refTable']->getComponentName()
. ' WHERE ' . $this->definition['table']->getComponentName()
. '.' . $identifier
. ' IN (' . $sub . ')'
. ' || ' . $this->definition['table']->getComponentName()
. '.' . $identifier
. ' IN (' . $sub2 . ')';
$dql .= $this->getOrderBy($this->definition['table']->getComponentName(), false);
break;
case 'collection':
$sub = substr(str_repeat('?, ', $count),0,-2);
$dql = 'FROM '.$this->definition['refTable']->getComponentName()
. '.' . $this->definition['table']->getComponentName()
. ' WHERE '.$this->definition['refTable']->getComponentName()
. '.' . $this->definition['local'] . ' IN (' . $sub . ')';
$dql .= $this->getOrderBy($this->definition['refTable']->getComponentName(), false);
};
return $dql;
}
Doctrine_Relation::getRelationDql (   $count)
inherited

getRelationDql

Parameters
integer$count
Returns
string

Definition at line 346 of file Relation.php.

{
$component = $this->getTable()->getComponentName();
$dql = 'FROM ' . $component
. ' WHERE ' . $component . '.' . $this->definition['foreign']
. ' IN (' . substr(str_repeat('?, ', $count), 0, -2) . ')'
. $this->getOrderBy($component);
return $dql;
}
Doctrine_Relation::getTable ( )
finalinherited

getTable returns the foreign table object

Returns
Doctrine_Table

Definition at line 248 of file Relation.php.

{
->getConnectionForComponent($this->definition['class'])
->getTable($this->definition['class']);
}
Doctrine_Relation::getType ( )
finalinherited

getType returns the relation type, either 0 or 1

See Also
Doctrine_Relation MANY_* and ONE_* constants
Returns
integer

Definition at line 226 of file Relation.php.

{
return $this->definition['type'];
}
Doctrine_Relation::hasConstraint ( )
inherited

hasConstraint whether or not this relation has an explicit constraint

Returns
boolean

Definition at line 150 of file Relation.php.

{
return ($this->definition['constraint'] ||
($this->definition['onUpdate']) ||
($this->definition['onDelete']));
}
Doctrine_Relation::isCascadeDelete ( )
inherited

Checks whether this relation cascades deletions to the related objects on the application level.

Returns
boolean

Definition at line 237 of file Relation.php.

{
return in_array('delete', $this->definition['cascade']);
}
Doctrine_Relation::isOneToOne ( )
finalinherited

isOneToOne returns whether or not this relation is a one-to-one relation

Returns
boolean

Definition at line 335 of file Relation.php.

{
return ($this->definition['type'] == Doctrine_Relation::ONE);
}
Doctrine_Relation::toArray ( )
inherited

toArray

Returns
array

Definition at line 203 of file Relation.php.

{
return $this->definition;
}

Field Documentation

const Doctrine_Relation::MANY = 1
inherited

constant for MANY_TO_MANY and ONE_TO_MANY relationships

Definition at line 48 of file Relation.php.

const Doctrine_Relation::ONE = 0
inherited

RELATION CONSTANTS constant for ONE_TO_ONE and MANY_TO_ONE relationships

Definition at line 43 of file Relation.php.


The documentation for this class was generated from the following file: