Class Xyster_Orm

Description

The main front-end for the ORM package

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

Located in /Orm.php (line 32)


	
			
Variable Summary
Method Summary
Xyster_Orm __construct ()
void clear ()
void commit ()
Xyster_Orm_Entity find (string $className,  $criteria)
void findAll (string $className, mixed $criteria, [mixed $sorts = null])
Xyster_Orm_Entity get (string $className, mixed $id)
Xyster_Orm_Set getAll (string $className, [ $ids = null])
Xyster_Orm_Binder getBinder (Xyster_Orm_Entity $entity, [boolean $allowPrimary = false])
Xyster_Orm_Entity getOrFail (string $className, mixed $id)
Xyster_Orm_Plugin_Abstract|array|false getPlugin (string $class)
array getPlugins ()
Zend_Cache_Core getSecondaryCache ()
boolean hasPlugin (string $class)
void persist (Xyster_Orm_Entity $entity)
Xyster_Orm_Query query (string $className, [string $xsql = null])
void refresh (Xyster_Orm_Entity $entity)
Xyster_Orm registerPlugin (Xyster_Orm_Plugin_Abstract $plugin, [int $stackIndex = null])
void remove (Xyster_Orm_Entity $entity)
Xyster_Orm_Query_Report reportQuery (string $className, [string $xsql = null])
Xyster_Orm setSecondaryCache ([mixed $cache = null])
void setup (string $className)
Variables
static Xyster_Orm $_instance (line 39)

The singleton instance of this class

  • access: protected
Xyster_Orm_Manager $_manager (line 46)

The orm manager

  • access: protected
Xyster_Orm_WorkUnit $_work (line 53)

The "unit of work" to hold our pending transactions

  • access: protected
Methods
static method getInstance (line 68)

Gets an instance of Xyster_Orm

  • access: public
static Xyster_Orm getInstance ()
Constructor __construct (line 58)

Creates a new Xyster_Orm object, hide from userland

  • access: protected
Xyster_Orm __construct ()
clear (line 82)

Abandons the current session

This will unload the repository and unset the singleton instance. The next call to getInstance will return a new session.

  • access: public
void clear ()
commit (line 93)

Commits pending operations to the data store

  • access: public
void commit ()
find (line 120)

Gets the first entity found matching a set of criteria

  • return: The entity found or null if none
  • access: public
Xyster_Orm_Entity find (string $className,  $criteria)
  • string $className
  • array $criteria
findAll (line 132)

Finds all entities matching a given criteria

  • access: public
void findAll (string $className, mixed $criteria, [mixed $sorts = null])
get (line 144)

Gets an entity by class and primary key

  • access: public
Xyster_Orm_Entity get (string $className, mixed $id)
  • string $className
  • mixed $id
getAll (line 156)

Gets all entities from the data source or a subset if given the keys

  • access: public
Xyster_Orm_Set getAll (string $className, [ $ids = null])
  • string $className
  • array $ids
getBinder (line 168)

Gets a value binder for an entity

  • access: public
Xyster_Orm_Binder getBinder (Xyster_Orm_Entity $entity, [boolean $allowPrimary = false])
  • Xyster_Orm_Entity $entity: The entity to use for binding
  • boolean $allowPrimary: Whether to allow the primary key to be set
getMapperFactory (line 179)

Gets the factory for entity mappers

  • access: public
getOrFail (line 192)

Gets an entity by class and primary key, throws exception if not found

  • throws: Xyster_Orm_Exception
  • access: public
Xyster_Orm_Entity getOrFail (string $className, mixed $id)
  • string $className
  • mixed $id
getPlugin (line 214)

Retrieve a plugin or plugins by class

  • return: False if none, the plugin if only one, and array of plugins if multiple of same class
  • access: public
Xyster_Orm_Plugin_Abstract|array|false getPlugin (string $class)
  • string $class: Class name of plugin(s) desired
getPlugins (line 224)

Retrieve all plugins

  • access: public
array getPlugins ()
getSecondaryCache (line 234)

Gets the secondary cache for storing entities

  • access: public
Zend_Cache_Core getSecondaryCache ()
hasPlugin (line 245)

Checks whether a plugin of a particular class is registered

  • access: public
boolean hasPlugin (string $class)
  • string $class
persist (line 256)

Sets an entity to be added to the data store

  • throws: Xyster_Orm_Exception if the entity is already persisted
  • access: public
void persist (Xyster_Orm_Entity $entity)
query (line 273)

Creates a query object to return entities

  • return: The query object
  • access: public
Xyster_Orm_Query query (string $className, [string $xsql = null])
  • string $className: The entity class name
  • string $xsql: The XSQL expression to use
refresh (line 291)

Refreshes the values of an entity

  • access: public
void refresh (Xyster_Orm_Entity $entity)
registerPlugin (line 303)

Register a plugin

  • return: provides a fluent interface
  • access: public
Xyster_Orm registerPlugin (Xyster_Orm_Plugin_Abstract $plugin, [int $stackIndex = null])
remove (line 314)

Sets an entity to be removed

  • access: public
void remove (Xyster_Orm_Entity $entity)
reportQuery (line 326)

Creates a report query object to return a data set

  • return: The report query object
  • access: public
Xyster_Orm_Query_Report reportQuery (string $className, [string $xsql = null])
  • string $className: The entity class name
  • string $xsql: The XSQL expression to use
setMapperFactory (line 347)

Sets the factory for entity mappers

  • return: provides a fluent interface
  • access: public
Xyster_Orm setMapperFactory (Xyster_Orm_Mapper_Factory_Interface $mapFactory)
setSecondaryCache (line 361)

Sets the secondary cache for storing entities

If $cache is null, then no secondary cache is used.

  • return: provides a fluent interface
  • access: public
Xyster_Orm setSecondaryCache ([mixed $cache = null])
  • mixed $cache: Either a Cache object, or a string naming a Registry key
setup (line 380)

Makes sure all classes and metadata are defined for a type of entity

This method should be called if you want to instantiate a new, blank type of entity and you haven't retrieved any from the data store.

For instance, if you've used findAll to pull out a set of entities, the classes should be defined and the metadata should be loaded. If you haven't done any interaction with the backend yet, it's necessary to call this method.

  • access: public
void setup (string $className)
  • string $className
unregisterPlugin (line 395)

Unregister a plugin.

  • return: provides a fluent interface
  • access: public
Xyster_Orm unregisterPlugin (string|Xyster_Orm_Plugin_Abstract $plugin)
_getRepository (line 406)

Gets the entity repository

  • access: protected
Xyster_Orm_Repository _getRepository ()
_getWorkUnit (line 416)

Gets the work unit

  • access: protected
Xyster_Orm_WorkUnit _getWorkUnit ()

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