Datamanager 2 Data Manager null storage controller class.

This is a very simple controller class intended for usage directly without a true storage backend. Its main intent is for forms you don't need in the database directly.

The class allows you to select a schema and a set of default values suitable for the types you use in the schema.

package midcom.helper.datamanager2

 Methods

initialize (string $identifier)

You need to set the schema database before calling this function.

Optionally you may set defaults and the schemaname to use as well.

Parameters

$identifier

stringThe form identifier

Returns

booleanIndicating success.

process_form ()

This function wraps the form manager processing.

If processing is successful, (that is, not 'cancel' or 'edit').

There are several possible return values:

  • save and the variants next and previous (for wizard usage) suggest successful form processing. The form has already been validated, synchronized with and saved to the data source.
  • cancel the user cancelled the form processing, no I/O has been done.
  • edit, previous, next indicates that the form is not yet successfully completed. This can mean many things, including validation errors, which the renderer already outlines in the Form output. No I/O processing has been done.

The form will be automatically validated for 'save' and 'next', but not for 'previous'.

Normally, all validation should be done during the Form processing, but sometimes this is not possible. These are the cases where type validation rules fail instead of form validation ones. At this time, the integration of type validation is rudimentary and will transparently return edit instead of validation.

Note, that this call does not actually execute the save call to the datamanager, there is nothing to save at this point.

todo Integrate type validation checks cleanly.

Returns

stringOne of 'save', 'cancel', 'next', 'previous', 'edit', depending on the schema configuration.

 Properties

 

Array $defaults

The defaults to initialize the form manager with.

This array is indexed by field names.

 

mixed $schemaname

The name of the schema to use.

If this is left to null, the first schema from the database is used instead.