Datamanager 2 Data Manager controller base class.

This class encapsulates a controlling instance of the Datamanager class system. You do not need to use it, it is possible to implement your own, custom form processing solely on the basis of form/datamanager classes. The controllers are intended to ease the integration work and provide more advanced frameworks for example for multi-page forms or AJAX callbacks.

The base class implements only a framework for controllers, along with a factory methods for getting real instances which you need to initialize. For all instances, you have to set the schema database using the load_schemadb() helper.

See the individual subclass documentations for details about the initialization procedure.

You cannot use this class directly, consider it as an abstract base class!

package midcom.helper.datamanager2


create (string $type)

This is a static factory method which lets you dynamically create controller instances.

It takes care of loading the required class files. The returned instances will be created but not initialized.

On any error (class not found etc.) the factory method will throw midcom_error.



stringThe type of the controller (the file name from the controller directory).


\midcom_helper_datamanager2_controllerA reference to the newly created controller instance.

display_form ()

This function invokes the display_form() hook on the form manager class.

initialize (string $identifier)

Empty default implementation, this calls won't do much.



stringThe form identifier


booleanIndicating success.

load_schemadb (mixed $schemapath)

Loads a schema definition from disk and creates the corresponding schema class instances.

If you have an array of schema classes already, use set_schemadb() instead.

see \midcom_helper_datamanager2_schema::load_database()



mixedA schema database source suitable for use with midcom_helper_datamanager2_schema::load_database()

process_form ()

This function should process the form data sent to the server.

Its behavior is dependant on the controller used, see the individual class documentations for details.


stringThe exitcode of the form processing, usually related to the formmanager result constants.

set_schemadb (array $schemadb)

Uses an already loaded schema database.

If you want to load a schema database from disk, use the load_schemadb method instead.

see \load_schemadb()



array&$schemadb The schema database to use, this must be an array of midcom_helper_datamanager2_schema instances, which is taken by reference.

set_storage (object $storage, string $schema)

Sets the current datamanager instance to the storage object given, which may either be a MidCOM DBA object (which is encapsulated by a midgard datamanager storage instance).

You must load a schema database before actually



object&$storage A reference to either an initialized datamanager, an initialized storage backend or to a DBA compatible class instance.


stringThis is an optional schema name that should be used to edit the storage object. If it is null, the controller will try to autodetect the schema to use by using the datamanager's autoset_storage interface.

show_unlock ()

Show the lock status



\midcom_helper_datamanager2_datamanager $datamanager

The datamanager instance which is used for data I/O processing.

Set this member using the set_storage() helper function unless you definitely know what you're doing.


\midcom_helper_datamanager2_formmanager $formmanager

The form manager instance which is currently in use by this class.

This should always be the a single instance, even for multi-page forms. Usually, it is created by the controller class during initialization.


boolean $lock_object

Override the whole locking scheme

integer $lock_timeout

Lock timeout defines the length of lock in seconds.

Array $schemadb

The schemadb to handle by this controller.

This is a list of midcom_helper_datamanager2_schema instances, indexed by their name. Set this member using the load_schemadb or set_schemadb helpers unless you know what you're doing.