Temporary data management service.

Currently the class supports management of temporary MidCOM objects. One example where they are used is the creation mode wrapper of DM2. No sessioning is done on the side of this class, you need to do that yourself.

Temporary objects are identified by their object ID, they are not safely replicateable. A MidCOM CRON handler will delete all temporary objects which have not been accessed for longer then one hour. Nevertheless you should explicitly delete temporary objects you do no longer need using the default delete call.

This service is available as midcom::get('tmp').

Temporary object privileges

All temporary objects have no privilege restrictions whatsoever. Everybody has full control (that is, midgard:owner privileges) on the temporary object. Newly created temporary objects have all their privileges reset, so that applications can store privileges on temporary object which will be transferred using the move_extensions_to_object() call on the temporary object (see there).

package midcom.services

 Methods

create_object ()

This class creates a new temporary object for use with the application.

The id member of the object is used in the future to reference it in request and release operations. The GUID of the object should not be used for further references.

In case the temporary object cannot be created, midcom_error is thrown.

All existing privileges (created by the DBA core) will be dropped, so that privileges can be created at will by the application (f.x. using DM(2) privilege types). Since EVERYONE owns all temporary objects using magic default privileges, full access is ensured.

Returns

\midcom_core_temporary_objectThe newly created object.

request_object (int $id)

Loads the temporary object identified by the argument from the DB, verifies ownership (using the midgard:owner privilege) and returns the instance.

The object timestamp is updated implicitly by the temporary object class.

Objects which have exceeded their lifetime will no longer be returned for security reasons.

Parameters

$id

intThe temporary object ID to load.

Returns

\midcom_core_temporary_objectThe associated object or null in case that it is unavailable.