Interface Xyster_Orm_Mapper_Interface

Description

Responsible for translating data store records into entities

Fowler describes a data mapper as "A layer of Mappers that moves data between objects and a database while keeping them independent of each other and the mapper itself". http://www.martinfowler.com/eaaCatalog/dataMapper.html

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

Located in /Orm/Mapper/Interface.php (line 28)


	
			
Method Summary
void delete (Xyster_Orm_Entity $entity)
Xyster_Orm_Entity find (mixed $criteria)
Xyster_Orm_Set findAll (mixed $criteria, [mixed $sorts = null])
Xyster_Orm_Entity get (mixed $id)
Xyster_Orm_Set getAll ([ $ids = null])
string getDomain ()
string getEntityName ()
array getFields ()
array getIndex ()
int getLifetime ()
mixed getOption (string $name)
array getOptions ()
Xyster_Orm_Set getSet ([ $entities = null])
string getTable ()
void init ()
void refresh (Xyster_Orm_Entity $entity)
void save (Xyster_Orm_Entity $entity)
string translateField (string $field)
string untranslateField (string $field)
Methods
delete (line 40)

Deletes an entity

void delete (Xyster_Orm_Entity $entity)
find (line 47)

Gets the first entity from the data store matching the criteria

  • return: The entity found
Xyster_Orm_Entity find (mixed $criteria)
  • mixed $criteria
findAll (line 55)

Gets all entities from the data store matching the criteria

  • return: A collection of the entities
Xyster_Orm_Set findAll (mixed $criteria, [mixed $sorts = null])
  • mixed $criteria
  • mixed $sorts
get (line 62)

Gets an entity with the supplied identifier

  • return: The data entity found, or null if none
Xyster_Orm_Entity get (mixed $id)
  • mixed $id: The id of the entity to get
getAll (line 69)

Gets all entities from the data store

  • return: A collection of the entities
Xyster_Orm_Set getAll ([ $ids = null])
  • array $ids: An array of ids for which entities to retrieve
getDomain (line 75)

Gets the name of the domain to which this mapper belongs

  • return: The domain
string getDomain ()
getEntityName (line 87)

Gets the class name of the entity

  • return: The class name of the entity
string getEntityName ()
getEntityType (line 81)

Gets the entity metadata

Xyster_Orm_Entity_Type getEntityType ()
getFactory (line 93)

Gets the factory that created the mapper

getFields (line 103)

Gets the fields for an entity as they appear in the backend

The array should come in the format of the describeTable method of the Zend_Db_Adapter_Abstract class.

  • see: Zend_Db_Adapter_Abstract::describeTable()
array getFields ()
getIndex (line 112)

Gets the columns that should be used to index the entity

The array should consist of index names as keys and arrays of the columns contained within as values.

array getIndex ()
getJoined (line 120)

Gets entities via a many-to-many table

Xyster_Orm_Set getJoined (Xyster_Orm_Entity $entity, Xyster_Orm_Relation $relation)
getLifetime (line 126)

Gets the time in seconds an entity should be cached

int getLifetime ()
getOption (line 133)

Gets the value of an option

  • return: The option value
mixed getOption (string $name)
  • string $name: The name of the option
getOptions (line 139)

Gets the options for this mapper

array getOptions ()
getSet (line 145)

Gets an empty entity set for the mapper's entity type

  • return: An empty set
Xyster_Orm_Set getSet ([ $entities = null])
getTable (line 156)

Gets the table from which an entity comes

What the "table" means is up to the implementation. In an RDBMS, this is obvious. If the mapper is for a set of XML documents, this might represent the file name. An LDAP implementation might be a DN with an object type.

  • return: The table name
string getTable ()
init (line 34)

Allows for subclassing without overwriting constructor

void init ()
query (line 163)

Performs a query

refresh (line 169)

Reloads an entity's values with fresh ones from the backend

void refresh (Xyster_Orm_Entity $entity)
save (line 175)

Saves an entity (insert or update)

void save (Xyster_Orm_Entity $entity)
translateField (line 186)

Translates the field from the original format into the entity field name

For instance, many database users prefer to use underscores for column names, and the class should have this as a camel case word. (user_name vs. userName).

string translateField (string $field)
  • string $field
untranslateField (line 197)

Translates the field from the entity format back into the original

For instance, many database users prefer to use underscores for column names, and the class should have this as a camel case word. (user_name vs. userName).

string untranslateField (string $field)
  • string $field

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