Class Xyster_Orm_Relation

Description

A factory and instance for entity relationships

  • copyright: Copyright (c) 2007-2008 Irrational Logic (http://irrationallogic.net)
  • license: New BSD License

Located in /Orm/Relation.php (line 24)


	
			
Class Constant Summary
 ACTION_CASCADE = 0x000001
 ACTION_NONE = 0x000000
 ACTION_REMOVE = 0x000003
 ACTION_SET_NULL = 0x000002
Variable Summary
Method Summary
Xyster_Orm_Relation __construct (Xyster_Orm_Entity_Type $meta, string $type, string $name, [ $options = array()], Xyster_Orm_Mapper $map)
string getFrom ()
array getId ()
array getLeft ()
string getName ()
int getOnDelete ()
int getOnUpdate ()
array getRight ()
string getTable ()
string getTo ()
string getType ()
boolean hasBelongsTo ()
boolean isCollection ()
mixed load (Xyster_Orm_Entity $entity, string $name)
Variables
Xyster_Data_Criterion $_filters (line 66)

Any filters associated with the relation

  • access: protected
string $_from (line 48)

The class that defines the relation

  • access: protected
array $_id (line 60)

The primary key field(s) involved in the relation

  • access: protected
array $_joinLeft (line 90)

The join table field linking to the left entity's primary key fields

  • access: protected
array $_joinRight (line 96)

The join table field linking to the right entity's primary key fields

  • access: protected
string $_joinTable (line 84)

In a join relationship, this is the table linking the two entities

  • access: protected
Xyster_Orm_Mapper_Factory_Interface $_mapFactory (line 110)

The mapper factory

  • access: protected
string $_name (line 42)

The name of the relation

  • access: protected
string $_onDelete = self::ACTION_NONE (line 72)

The activity to perform on entity delete

  • access: protected
string $_onUpdate = self::ACTION_NONE (line 78)

The activity to perform when a primary key is changed

  • access: protected
Xyster_Orm_Relation $_reverse (line 103)

The "belongs" relation opposite a "many"

  • access: protected
string $_to (line 54)

The class on the target end of the relation

  • access: protected
string $_type (line 36)

The type of relation; one of ('one','belongs','many','joined')

  • access: protected
Methods
Constructor __construct (line 127)

Create a new relationship

  • access: public
Xyster_Orm_Relation __construct (Xyster_Orm_Entity_Type $meta, string $type, string $name, [ $options = array()], Xyster_Orm_Mapper $map)
  • Xyster_Orm_Mapper $map: The mapper of the class owning the relation
  • string $type: One of belongs, one, many, joined
  • string $name: The name of the relationship
  • array $options: An array of options
  • Xyster_Orm_Entity_Type $meta
getFilters (line 221)

Gets the filters

  • access: public
Xyster_Data_Criterion getFilters ()
getFrom (line 231)

Gets the class that owns the relationship

  • access: public
string getFrom ()
getId (line 241)

Gets the ids involved

  • access: public
array getId ()
getLeft (line 251)

Gets the left entity column name in the join table

  • access: public
array getLeft ()
getName (line 261)

Gets the name of the relationship

  • access: public
string getName ()
getOnDelete (line 271)

Gets the action type to perform onDelete

  • access: public
int getOnDelete ()
getOnUpdate (line 281)

Gets the action type to perform onUpdate

  • access: public
int getOnUpdate ()
getReverse (line 332)

If this relation is a 'many', this returns the 'belongs' relation

  • throws: Xyster_Orm_Relation_Exception
  • access: public
Xyster_Orm_Relation getReverse ()
getRight (line 291)

Gets the right entity column name in the join table

  • access: public
array getRight ()
getTable (line 301)

Gets the join table name

  • access: public
string getTable ()
getTo (line 311)

Gets the class of the relationship

  • access: public
string getTo ()
getType (line 321)

Gets the type of the relationship

  • access: public
string getType ()
hasBelongsTo (line 367)

Checks to see if the class referenced by this relationship has a belongs

This relationship must be a 'many' to return true, and the target class must have a 'belongs' relationship pointing back to this declaring class

  • access: public
boolean hasBelongsTo ()
isCollection (line 377)

This returns true if the type is 'many' or 'joined', false otherwise

  • access: public
boolean isCollection ()
load (line 390)

Loads the Xyster_Orm_Entity or Xyster_Orm_Set

  • access: public
mixed load (Xyster_Orm_Entity $entity, string $name)
relate (line 462)

Relates one entity to another (if one-to-one)

  • throws: Xyster_Orm_Relation_Exception if $from or $to are of the wrong type
  • access: public
void relate (Xyster_Orm_Entity $from, Xyster_Orm_Entity $to)
Class Constants
ACTION_CASCADE = 0x000001 (line 27)
ACTION_NONE = 0x000000 (line 26)
ACTION_REMOVE = 0x000003 (line 29)
ACTION_SET_NULL = 0x000002 (line 28)

Documentation generated on Mon, 19 May 2008 17:07:31 -0400 by phpDocumentor 1.4.2