Class Xyster_Orm_Repository

Description

The "identity map" of persisted entities

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

Located in /Orm/Repository.php (line 32)


	
			
Variable Summary
Method Summary
Xyster_Orm_Repository __construct (Xyster_Orm_Mapper_Factory_Interface $mapFactory)
void add (Xyster_Orm_Entity $entity)
void addAll (Xyster_Orm_Set $set)
boolean contains (Xyster_Orm_Entity $entity)
Xyster_Orm_Entity find (string $class,  $values)
Xyster_Orm_Entity get (string $class, mixed $primaryKey)
array getClasses ()
boolean hasAll (string $class)
void remove (Xyster_Orm_Entity $entity)
void removeAll (Xyster_Orm_Set $set)
void removeAllByKey (string $class,  $ids)
void removeByKey (string $class, mixed $key)
void setHasAll (string $class, [boolean $hasAll = true])
string _getByHelper (mixed $class, string $key)
void _removeByClassAndKey (string $class, mixed $key)
string _stringifyPrimaryKey (mixed $key)
Variables
array $_items = array() (line 56)

A container for the entity objects

The array is structured using class names as keys, then another array with the keys 'byKey', 'byIndex', and 'hasAll'. hasAll is a boolean, the other two are Xyster_Collection_Map_String objects.

  1. array(
  2.          'entityName1' => array(
  3.              'byKey' => Xyster_Collection_Map_String,
  4.              'byIndex => Xyster_Collection_Map_String,
  5.              'hasAll' => false
  6.          ),
  7.          'entityName2' => array(
  8.              'byKey' => Xyster_Collection_Map_String,
  9.              'byIndex => Xyster_Collection_Map_String,
  10.              'hasAll' => false
  11.          )
  12.  );

  • access: protected
Xyster_Orm_Mapper_Factory_Interface $_mapFactory (line 63)

The mapper factory

  • access: protected
Methods
Constructor __construct (line 70)

Creates a new entity repository

  • access: public
Xyster_Orm_Repository __construct (Xyster_Orm_Mapper_Factory_Interface $mapFactory)
add (line 80)

Adds an entity to the repository

  • access: public
void add (Xyster_Orm_Entity $entity)
addAll (line 105)

Adds a set to the repository

  • access: public
void addAll (Xyster_Orm_Set $set)
contains (line 118)

Gets whether the repository contains the entity supplied

  • access: public
boolean contains (Xyster_Orm_Entity $entity)
find (line 130)

Finds an entity by indexed value

  • return: The entity found or null if none
  • access: public
Xyster_Orm_Entity find (string $class,  $values)
  • string $class
  • array $values
get (line 150)

Gets an item from the repository

  • return: The entity found or null if none
  • access: public
Xyster_Orm_Entity get (string $class, mixed $primaryKey)
  • string $class
  • mixed $primaryKey
getAll (line 172)

Gets all entities of a particular type

  • access: public
Xyster_Collection_Interface getAll ( $class)
  • $class
getClasses (line 162)

Gets the names of classes that are currently stored in this map

  • return: The names of the classes stored
  • access: public
array getClasses ()
hasAll (line 185)

Gets whether a given class has all of its entities loaded

  • return: Whether all entities have been loaded
  • access: public
boolean hasAll (string $class)
  • string $class: The entity class
remove (line 197)

Removes an entity from the repository

  • access: public
void remove (Xyster_Orm_Entity $entity)
removeAll (line 221)

Removes all entities supplied from the repository

  • access: public
void removeAll (Xyster_Orm_Set $set)
removeAllByKey (line 235)

Removes all entities by class and primary keys

  • access: public
void removeAllByKey (string $class,  $ids)
  • string $class
  • array $ids
removeByKey (line 209)

Removes an entity by class and primary key

  • access: public
void removeByKey (string $class, mixed $key)
  • string $class
  • mixed $key
setHasAll (line 250)

Sets whether a given class has all of its entities loaded

  • access: public
void setHasAll (string $class, [boolean $hasAll = true])
  • string $class: The entity class
  • boolean $hasAll: Whether all entities have been loaded
_getByHelper (line 284)

Sets up the array and class name

  • access: protected
string _getByHelper (mixed $class, string $key)
  • mixed $class
  • string $key
_getByIndexMap (line 272)

Convenience method to get the map (and create it if necessary)

  • access: protected
Xyster_Collection_Map_String _getByIndexMap (string $class)
  • string $class: The entity
_getByKeyMap (line 261)

Convenience method to get the map (and create it if necessary)

  • access: protected
Xyster_Collection_Map_String _getByKeyMap (string $class)
  • string $class: The entity
_getMapper (line 303)

Convenience method to get the entity's mapper

  • access: protected
Xyster_Orm_Mapper _getMapper (Xyster_Orm_Entity $entity)
_removeByClassAndKey (line 314)

Convenience method to remove an entity

  • access: protected
void _removeByClassAndKey (string $class, mixed $key)
  • string $class
  • mixed $key
_removeEntity (line 328)

Removes an entity from both maps

  • access: protected
void _removeEntity (Xyster_Orm_Entity $entity)
_stringifyPrimaryKey (line 347)

Convenience method to stringify the primary key

  • return: The primary key as a string
  • access: protected
string _stringifyPrimaryKey (mixed $key)
  • mixed $key: A primary key or an entity whose primary key is used

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