Class: Doctrine_Relation

Source Location: /Doctrine/Relation.php

Class Doctrine_Relation

Class Overview

Implements interfaces:

  • ArrayAccess (internal interface)

Doctrine_Relation This class represents a relation between components

Located in /Doctrine/Relation.php [line 33]



		
				Author(s):
		
		
		API Tags:
Abstract:  

Information Tags:
Version:  $Revision: 1973 $
Link:  www.phpdoctrine.com
Since:  1.0
License:  LGPL

Properties

Methods

[ Top ]
Direct descendents
Child Class Description
Doctrine_Relation_Association Doctrine_Relation_Association this class takes care of association mapping (= many-to-many relationships, where the relationship is handled with an additional relational table which holds 2 foreign keys)
Doctrine_Relation_ForeignKey Doctrine_Relation_ForeignKey This class represents a foreign key relation
Doctrine_Relation_LocalKey Doctrine_Relation_LocalKey This class represents a local key relation

[ Top ]
Constant Summary
MANY  
MANY_AGGREGATE   constant for MANY_TO_MANY and ONE_TO_MANY aggregate relationships
MANY_COMPOSITE   constant for MANY_TO_MANY and ONE_TO_MANY composite relationships
ONE  
ONE_AGGREGATE   constant for ONE_TO_ONE and MANY_TO_ONE aggregate relationships
ONE_COMPOSITE   constant for ONE_TO_ONE and MANY_TO_ONE composite relationships

[ Top ]
Property Summary
mixed   $definition  

[ Top ]
Method Summary
Doctrine_Relation   __construct()   constructor
Doctrine_Record|Doctrine_Collection   fetchRelatedFor()   fetchRelatedFor
string   getAlias()   getAlias returns the relation alias
string   getForeign()   getForeign returns the name of the foreignkey column where the localkey column is pointing at
string   getLocal()   getLocal returns the name of the local column
string   getRelationDql()   getRelationDql
object Doctrine_Table   getTable()   getTable returns the foreign table object
integer   getType()   getType returns the relation type, either 0 or 1
boolean   hasConstraint()   hasConstraint whether or not this relation has an explicit constraint
boolean   isComposite()   isComposite returns whether or not this relation is a composite relation
void   isDeferrable()  
void   isDeferred()  
void   isEqual()  
boolean   isOneToOne()   isOneToOne returns whether or not this relation is a one-to-one relation
void   offsetExists()  
void   offsetGet()  
void   offsetSet()  
void   offsetUnset()  
array   toArray()   toArray
string   __toString()   __toString

[ Top ]
Properties
mixed   $definition = array('alias' => true,
'foreign' => true,
'local' => true,
'class' => true,
'type' => true,
'table' => true,
'name' => false,
'refTable' => false,
'onDelete' => false,
'onUpdate' => false,
'deferred' => false,
'deferrable' => false,
'constraint' => false,
'equal' => false,
)
[line 59]
API Tags:
Access:  protected


[ Top ]
Methods
Constructor __construct  [line 119]

  Doctrine_Relation __construct( $definition  )

constructor

Parameters:
array   $definition: 

an associative array with the following structure: name foreign key constraint name

local the local field(s)

foreign the foreign reference field(s)

table the foreign table object

refTable the reference table object (if any)

onDelete referential delete action

onUpdate referential update action

deferred deferred constraint checking

alias relation alias

type the relation type, either Doctrine_Relation::ONE or Doctrine_Relation::MANY

constraint boolean value, true if the relation has an explicit referential integrity constraint

The onDelete and onUpdate keys accept the following values:

CASCADE: Delete or update the row from the parent table and automatically delete or update the matching rows in the child table. Both ON DELETE CASCADE and ON UPDATE CASCADE are supported. Between two tables, you should not define several ON UPDATE CASCADE clauses that act on the same column in the parent table or in the child table.

SET NULL: Delete or update the row from the parent table and set the foreign key column or columns in the child table to NULL. This is valid only if the foreign key columns do not have the NOT NULL qualifier specified. Both ON DELETE SET NULL and ON UPDATE SET NULL clauses are supported.

NO ACTION: In standard SQL, NO ACTION means no action in the sense that an attempt to delete or update a primary key value is not allowed to proceed if there is a related foreign key value in the referenced table.

RESTRICT: Rejects the delete or update operation for the parent table. NO ACTION and RESTRICT are the same as omitting the ON DELETE or ON UPDATE clause.

SET DEFAULT


API Tags:
Access:  public


[ Top ]
fetchRelatedFor  [line 295]

  Doctrine_Record|Doctrine_Collection fetchRelatedFor( Doctrine_Record $record  )

fetchRelatedFor

fetches a component related to given record

Parameters:
Doctrine_Record   $record: 

API Tags:
Abstract:  
Access:  public


Redefined in descendants as:

[ Top ]
getAlias  [line 201]

  string getAlias( )

getAlias returns the relation alias


API Tags:
Access:  public


[ Top ]
getForeign  [line 245]

  string getForeign( )

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


API Tags:
Access:  public


[ Top ]
getLocal  [line 234]

  string getLocal( )

getLocal returns the name of the local column


API Tags:
Access:  public


[ Top ]
getRelationDql  [line 277]

  string getRelationDql( integer $count  )

getRelationDql

Parameters:
integer   $count: 

API Tags:
Access:  public


Redefined in descendants as:

[ Top ]
getTable  [line 222]

  object Doctrine_Table getTable( )

getTable returns the foreign table object


API Tags:
Access:  public


[ Top ]
getType  [line 212]

  integer getType( )

getType returns the relation type, either 0 or 1


API Tags:
See:  Doctrine_Relation MANY_* and ONE_* constants
Access:  public


[ Top ]
hasConstraint  [line 141]

  boolean hasConstraint( )

hasConstraint whether or not this relation has an explicit constraint


API Tags:
Access:  public


[ Top ]
isComposite  [line 255]

  boolean isComposite( )

isComposite returns whether or not this relation is a composite relation


API Tags:
Access:  public


[ Top ]
isDeferrable  [line 152]

  void isDeferrable( )


API Tags:
Access:  public


[ Top ]
isDeferred  [line 147]

  void isDeferred( )


API Tags:
Access:  public


[ Top ]
isEqual  [line 156]

  void isEqual( )


API Tags:
Access:  public


[ Top ]
isOneToOne  [line 266]

  boolean isOneToOne( )

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


API Tags:
Access:  public


[ Top ]
offsetExists  [line 161]

  void offsetExists( $offset  )

Parameters:
   $offset: 

API Tags:
Access:  public


Implementation of:
ArrayAccess::offsetExists

[ Top ]
offsetGet  [line 166]

  void offsetGet( $offset  )

Parameters:
   $offset: 

API Tags:
Access:  public


Implementation of:
ArrayAccess::offsetGet

[ Top ]
offsetSet  [line 175]

  void offsetSet( $offset, $value  )

Parameters:
   $offset: 
   $value: 

API Tags:
Access:  public


Implementation of:
ArrayAccess::offsetSet

[ Top ]
offsetUnset  [line 182]

  void offsetUnset( $offset  )

Parameters:
   $offset: 

API Tags:
Access:  public


Implementation of:
ArrayAccess::offsetUnset

[ Top ]
toArray  [line 191]

  array toArray( )

toArray


API Tags:
Access:  public


[ Top ]
__toString  [line 301]

  string __toString( )

__toString


API Tags:
Access:  public


[ Top ]
Constants
MANY = 2 [line 57]

[ Top ]
MANY_AGGREGATE = 2 [line 50]

constant for MANY_TO_MANY and ONE_TO_MANY aggregate relationships


[ Top ]
MANY_COMPOSITE = 3 [line 54]

constant for MANY_TO_MANY and ONE_TO_MANY composite relationships


[ Top ]
ONE = 0 [line 56]

[ Top ]
ONE_AGGREGATE = 0 [line 42]

constant for ONE_TO_ONE and MANY_TO_ONE aggregate relationships


[ Top ]
ONE_COMPOSITE = 1 [line 46]

constant for ONE_TO_ONE and MANY_TO_ONE composite relationships


[ Top ]