Class DataContainer

Description

The DataContainer class encapsulates a FieldSet, and a RuleSet and sets up field-setting restrictions.

The class is abstract and allows children to set up a list of fields (keys) that can be set/accessed, and rules to be associated with them.

  • abstract:
  • version: $Id: DataContainer.abstract.php,v 1.8 2007/09/05 19:55:22 adamfranco Exp $
  • license: GNU General Public License (GPL)
  • copyright: Copyright © 2005, Middlebury College

Located in /harmoni/core/utilities/DataContainer.abstract.php (line 21)

DataContainerInterface
   |
   --DataContainer
Direct descendents
Class Description
HarmoniConfig The HamoniConfig is a DataContainer for the Harmoni object.
UserDataContainer A UserDataContainer is like a DataContainer, but is targeted towards data used from http forms instead of configuration options in a script.
Variable Summary
Method Summary
void add (string $field, ref $rule, [optional $message = null], [mixed $type = ''])
boolean checkAll ()
mixed get (string $field)
void init ()
boolean set (string $field, mixed $val)
Variables
object FieldSet $_fieldSet (line 29)

The FieldSet where we will store our data.

  • access: private
object RuleSet $_ruleSet (line 36)

The RuleSet that will define both rules and what keys are allowed.

  • access: private
Methods
add (line 57)

The add method adds a new field with associated rule and optional error if validation fails.

void add (string $field, ref $rule, [optional $message = null], [mixed $type = ''])
  • string $field: The key of the field to add.
  • ref $rule: object ValidatorRule $rule The validator rule to apply to the value set to this key.
  • optional $message: object Error $error The error to throw if validation of this key fails.

Redefinition of:
DataContainerInterface::add()
The add method adds a new field with associated rule and optional error if validation fails.
checkAll (line 114)

Goes through all the keys and makes sure they comply to the rules specified for them.

  • return: TRUE if all are OK, FALSE otherwise.
  • access: public
boolean checkAll ()

Redefinition of:
DataContainerInterface::checkAll()
Goes through all the keys and makes sure they comply to the rules specified for them.
get (line 78)

The get method returns the value stored in the FieldSet for $field.

  • return: The value of $field.
  • access: public
mixed get (string $field)
  • string $field: The field to get.

Redefinition of:
DataContainerInterface::get()
The get method returns the value stored in the FieldSet for $field.
init (line 43)

The init function -- sets up the private variables.

  • access: protected
void init ()

Redefinition of:
DataContainerInterface::init()
The init function -- sets up the private variables.
set (line 94)

The set method sets the value for a field while checking constrictions.

  • return: True if setting $field succeeds.
  • access: public
boolean set (string $field, mixed $val)
  • string $field: The field to set.
  • mixed $val: The value to set $field to.

Redefinition of:
DataContainerInterface::set()
The set method sets the value for a field while checking constrictions.

Redefined in descendants as:

Inherited Methods

Inherited From DataContainerInterface

DataContainerInterface::add()
DataContainerInterface::checkAll()
DataContainerInterface::get()
DataContainerInterface::init()
DataContainerInterface::set()

Documentation generated on Wed, 19 Sep 2007 10:22:29 -0400 by phpDocumentor 1.3.0RC3