Class Xyster_Orm_Entity

Description

A data entity: the basic data unit of the ORM package

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

Located in /Orm/Entity.php (line 28)


	
			
Direct descendents
Class Description
Xyster_Orm_Entity_Resource Entity that doubles as an ACL resource
Variable Summary
Method Summary
static void addType (Xyster_Orm_Entity_Type $type)
Xyster_Orm_Entity __construct ([ $values = null])
void clearListeners ()
boolean equals (Xyster_Orm_Entity $object)
array getBase ()
array getDirtyFields ()
mixed getPrimaryKey ([boolean $base = false])
Xyster_Data_Criterion getPrimaryKeyAsCriterion ([boolean $base = false])
string getPrimaryKeyAsString ([boolean $base = false])
int hashCode ()
void import ( $values)
boolean isDirty ()
boolean isLoaded (string $name)
void setDirty ([boolean $dirty = true])
array toArray ()
mixed _getLookup (string $name)
mixed _getRelated (string $name)
void _setField (string $name, mixed $value)
void _setLookup (string $name, mixed $value)
void _setRelated (string $name, mixed $value)
mixed __call (string $name,  $args)
mixed __get (string $name)
void __set (string $name, mixed $value)
string __toString ()
Variables
array $_base = array() (line 35)

The "base" values from object instantiation

  • access: protected
boolean $_dirty = false (line 42)

For quick modification checking

  • access: protected
Xyster_Collection_Set $_listeners = null (line 49)

A set of event listeners

  • access: protected
array $_lookups = array() (line 56)

Looked-up values

  • access: protected
array $_related = array() (line 63)

Related entities or sets

  • access: protected
array $_values = array() (line 70)

The entity values

  • access: protected
Methods
static method addType (line 107)

Adds an entity meta information object

This shouldn't be called except by the Xyster_Orm_Mapper

  • access: public
static void addType (Xyster_Orm_Entity_Type $type)
Constructor __construct (line 84)

Creates a new entity

  • access: public
Xyster_Orm_Entity __construct ([ $values = null])
  • array $values: Values for the entity
addListener (line 197)

Adds a listener for value edit events

Listeners can only be registered once. Trying to add a listener a second time will return false.

  • return: Whether the listener was added
  • access: public
boolean addListener (Xyster_Orm_Entity_Listener $listener)
clearListeners (line 210)

Removes the listeners

  • access: public
void clearListeners ()
equals (line 225)

Compares two values for equality

An entity is equal to another entity if they're identical or they're the same class name and have the same primary key. If the primary key is empty, the actual values are compared.

  • access: public
boolean equals (Xyster_Orm_Entity $object)
getBase (line 244)

Gets the original values of the entity

  • access: public
array getBase ()
getDirtyFields (line 254)

Gets the fields that have been changed since the entity was created

  • access: public
array getDirtyFields ()
getPrimaryKey (line 268)

Gets the primary key of the entity

  • return: An array or scalar key value
  • access: public
mixed getPrimaryKey ([boolean $base = false])
  • boolean $base: True to return the original primary key (if changed)
getPrimaryKeyAsCriterion (line 280)

Gets the primary key of the entity as a Xyster_Data_Criterion

  • return: The primary key
  • access: public
Xyster_Data_Criterion getPrimaryKeyAsCriterion ([boolean $base = false])
  • boolean $base: True to return the original primary key (if changed)
getPrimaryKeyAsString (line 308)

Gets the primary key of the entity as a string

  • return: A string representation of the primary key
  • access: public
string getPrimaryKeyAsString ([boolean $base = false])
  • boolean $base: True to return the original primary key (if changed)
hashCode (line 328)

Gets the hash code for the entity

  • access: public
int hashCode ()
import (line 338)

Imports the values in the array into the corresponding fields

  • access: public
void import ( $values)
  • array $values
isDirty (line 352)

Determines whether or not this entity has changed values since creation

  • return: Whether this entity has changed
  • access: public
boolean isDirty ()
isLoaded (line 364)

Checks whether a related entity or set has been loaded

  • return: true if the relation has been loaded
  • throws: Xyster_Orm_Exception if the relationship name is invalid
  • access: public
boolean isLoaded (string $name)
  • string $name: The name of the relation
removeListener (line 376)

Removes a specific listener from the entity

  • return: Whether anything was changed
  • access: public
boolean removeListener (Xyster_Orm_Entity_Listener $listener)
setDirty (line 391)

Sets the entity as dirty or clean

This is only used by the transactional layer or associated collections to notify changes in an entity's state. You shouldn't call this method directly.

  • access: public
void setDirty ([boolean $dirty = true])
  • boolean $dirty: Whether the entity should be set dirty
toArray (line 401)

Returns an array copy of the entity

  • return: The entity values
  • access: public
array toArray ()
_getLookup (line 433)

Gets a lookup value

  • return: The lookup value
  • throws: Xyster_Orm_Entity_Exception if the lookup name is invalid
  • access: protected
mixed _getLookup (string $name)
  • string $name: The name of the lookup
_getRelated (line 448)

Gets a related property

  • return: The related Xyster_Orm_Entity or Xyster_Orm_Set
  • throws: Xyster_Orm_Exception if the property name is invalid
  • access: protected
mixed _getRelated (string $name)
  • string $name: The name of the property
_getType (line 556)

Gets the entity type

  • access: protected
_setField (line 465)

The base method for setting fields

If overriding this method, make sure to call the parent or else the entity won't mark itself dirty.

  • access: protected
void _setField (string $name, mixed $value)
  • string $name
  • mixed $value
_setLookup (line 484)

Sets the lookup value

  • throws: Xyster_Orm_Entity_Exception if the lookup value is incorrect
  • throws: Xyster_Orm_Entity_Exception if the lookup name is incorrect
  • access: protected
void _setLookup (string $name, mixed $value)
  • string $name
  • mixed $value
_setRelated (line 499)

Sets a linked property and registers the entity as dirty

  • throws: Xyster_Orm_Exception if the value is incorrect for the property
  • throws: Xyster_Orm_Exception if the property name is invalid
  • access: protected
void _setRelated (string $name, mixed $value)
  • string $name: The name of the property
  • mixed $value: The new property value
__call (line 121)

Overloader for getting/setting linked properties

  • return: The result of the method
  • magic:
  • throws: Xyster_Orm_Entity_Exception if the name is invalid
  • access: public
mixed __call (string $name,  $args)
  • string $name: The method name
  • array $args: Any arguments used
__get (line 159)

Overloader for getting fields

  • return: The value of the field
  • magic:
  • throws: Xyster_Orm_Entity_Exception if the field is invalid
  • access: public
mixed __get (string $name)
  • string $name
__set (line 183)

Overloader for setting fields

  • magic:
  • throws: Xyster_Orm_Entity_Exception if the field is invalid
  • access: public
void __set (string $name, mixed $value)
  • string $name: The field name
  • mixed $value: The field value
__toString (line 412)

Returns a string value of this entity

  • magic:
  • access: public
string __toString ()

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