Datamanager 2 Data Manager simple controller class.

This is a very simple controller class intended for usage directly with a storage backend. It has no creation support whatsoever, but the multi-edit loop will work without problems. The form will only be synchronized with the datamanager if validation succeeds. (Naturally, types operating directly on blobs / parameters are exempt of this.)

You need to set both datamanager and (thus) schema database before initializing.

package midcom.helper.datamanager2

 Methods

initialize (string $identifier)

Check if a schema has been set

Parameters

$identifier

stringThe form identifier

Returns

booleanIndicating success.

process_form ()

This function wraps the form manager processing.

If processing is successful, (that is, only 'save'). If editing was successful, the form is frozen in case you want to display it again (usually you want to redirect to the view target).

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'. If you want to have save the data for example even during 'next', you need to call datamanager->save after this function returned the according return code.

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.

todo Integrate type validation checks cleanly.

Returns

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

_save_form ($result)

Parameters

$result