Class Record

Description

A Record is a set of data matching a certain Schema. The Record can be fetched from the database in a number of ways, which can be changed at runtime. See the RECORD_* constants.

  • version: $Id: Record.class.php,v 1.39 2007/09/04 20:25:31 adamfranco Exp $
  • license: GNU General Public License (GPL)
  • copyright: Copyright © 2005, Middlebury College

Located in /harmoni/core/dataManager/record/Record.class.php (line 38)


	
			
Variable Summary
Method Summary
Record Record (mixed $schema, [optional $verControl = false], [optional $fetchMode = RECORD_FULL])
bool activateTag (ref $tag)
bool commit ([boolean $ignoreMandatory = false])
void commitAndTag ([optional $date = null])
void delete ()
void deleteValue (string $label, optional $index)
array getActiveIndices (string $label)
int getFetchMode ()
int getID ()
array getIndices (string $label, [optional $includeInactive = false])
ref getRecordFieldValue (string $id, optional $index)
ref getRecordFieldValues (string $id)
ref getSchema ()
string getSchemaID ()
void getStringValue (string $label, optional $index)
array getStringValues (string $label)
ref getValue (string $label, optional $index)
ref getValueByFunction (string $function, string $label, optional $index)
array getValuesArray ()
ref getVersions (string $label, optional $index)
bool isActive ()
bool isValueDeleted (string $label, optional $index)
void makeCurrent ()
void makeFull ()
int numValues (string $label, [optional $includeInactive = false])
bool populate (ref $arrayOfRows)
void prune (ref $versionConstraint)
void reIndex (string $label)
ref replicate ()
void setActiveFlag (boolean $bool)
void setFetchMode (mixed $mode)
bool setValue (string $label, ref $obj, optional $index)
void tag ([optional $date = null])
void takeRow (ref $row)
void undeleteValue (string $label, optional $index)
void _checkLabel (mixed $label)
string _getFieldID (string $label)
string _getFieldLabel (string $id)
Variables
mixed $_creationDate (line 46)
mixed $_dateFromDB = false (line 47)
mixed $_delete (line 42)
mixed $_fetchedValueIDs (line 49)
mixed $_fetchMode (line 48)
mixed $_fields (line 45)
mixed $_myID (line 40)
mixed $_prune (line 51)
mixed $_pruneConstraint (line 52)
mixed $_schema (line 43)
mixed $_versionControlled (line 44)
Methods
Constructor Record (line 60)

Constructor

Record Record (mixed $schema, [optional $verControl = false], [optional $fetchMode = RECORD_FULL])
  • mixed $schema: Either a Schema object or a string ID of the schema to use.
  • optional $verControl: boolean $verControl If set to TRUE this Record will use version-control.
  • optional $fetchMode: int $fetchMode USED INTERNALLY
activateTag (line 683)

Takes a tag object and activates the appropriate versions of values based on the tag mappings.

bool activateTag (ref $tag)
commit (line 484)

Commits (either inserts or updates) the data for this Record into the database.

bool commit ([boolean $ignoreMandatory = false])
  • boolean $ignoreMandatory: optional $ignoreMandatory If true, doesn't fail if mandatory fields don't have values.
commitAndTag (line 613)

Calls both commit() and tag().

void commitAndTag ([optional $date = null])
  • optional $date: object $date An optional DateAndTime object for tagging. If specified, it will use $date instead of the current date and time.
delete (line 804)

Deletes the record entirely from the database upon calling commit().

  • access: public
void delete ()
deleteValue (line 423)

De-activates the value under $label[$index].

  • access: public
void deleteValue (string $label, optional $index)
  • string $label: The field label to delete.
  • optional $index: int $index The index (for multi-value fields) to delete.
getActiveIndices (line 124)

Returns the indices (indexes) of each value for the given field. Can then be retrieved with any getValue-type function.

  • return: An array of integers
  • deprecated: use getIndices().
  • access: public
array getActiveIndices (string $label)
  • string $label
getCreationDate (line 379)

Returns the DateAndTime object specifying when this Record was created.

  • return: object
  • access: public
ref getCreationDate ()
getFetchedFieldIDs (line 592)

INTERNAL USE ONLY: Returns an array of field IDs that have already been fetched & populated.

  • access: public
array getFetchedFieldIDs ()
getFetchMode (line 623)

INTERNAL USE ONLY: Returns our current fetch mode.

  • access: public
int getFetchMode ()
getID (line 151)

Returns this Record's ID.

int getID ()
getIndices (line 110)

Returns the indices (indexes) of each value for the given field. Can then be retrieved with any getValue-type function.

  • return: An array of integers
  • access: public
array getIndices (string $label, [optional $includeInactive = false])
  • string $label
  • optional $includeInactive: boolean $includeInactive Includes the inactive values for 'label'. Default: false
getRecordFieldValue (line 311)

Returns the RecordFieldValue associated with a field by id.

  • return: object
  • access: public
ref getRecordFieldValue (string $id, optional $index)
  • string $id: The field's unique ID
  • optional $index: integer $index
getRecordFieldValues (line 295)

Returns all the RecordFieldValues objects associated with a field by id.

  • return: array
  • access: public
ref getRecordFieldValues (string $id)
  • string $id: The field's unique ID
getSchema (line 99)

Returns this Record's Schema

  • return: object
ref getSchema ()
getSchemaID (line 143)

Returns the Schema ID associated with this Record.

string getSchemaID ()
getStringValue (line 245)

Returns a string value for $index under $label. What is returned depends on the DataType.

void getStringValue (string $label, optional $index)
  • string $label
  • optional $index: int $index default=0.
getStringValues (line 259)

Returns an array of all the string values for the passed label.

  • access: public
array getStringValues (string $label)
  • string $label
getValue (line 211)

Returns the active SObject value object for $index under $label.

  • return: object
ref getValue (string $label, optional $index)
  • string $label
  • optional $index: int $index default=0.
getValueByFunction (line 234)

Returns the active value for a label/index by calling $function on the SObject that is returned.

  • return: mixed
  • access: public
ref getValueByFunction (string $function, string $label, optional $index)
  • string $function: The function to call.
  • string $label: The label.
  • optional $index: int $index defaults to 0
getValuesArray (line 733)

Returns an array of hashed values for all of our fields. If a field allows multiple values, we return an array of those values instead of just the string value.

  • return: format: array = ("single"=>value, "multiple"=>array(value1,value2,...));
  • access: public
array getValuesArray ()
getVersions (line 275)

Returns an array of RecordFieldData objects corresponding to the different versions available for a given $label/$index - useful for version-controlled Records.

  • return: array An array keyed by version ID.
  • access: public
ref getVersions (string $label, optional $index)
  • string $label
  • optional $index: integer $index
isActive (line 412)

Returns if this Record is about to be deleted or not.

  • access: public
bool isActive ()
isValueDeleted (line 451)

Returns true if the given value has been deleted.

  • access: public
bool isValueDeleted (string $label, optional $index)
  • string $label: the field label to check.
  • optional $index: int $index The index (defaults to 0) to check.
isVersionControlled (line 403)

Returns TRUE if this DataSet was created with Version Control.

bool isVersionControlled ()
makeCurrent (line 785)

INTERNAL USE ONLY: Makes sure that our representation of the data includes all current values.

  • access: public
void makeCurrent ()
makeFull (line 765)

INTERNAL USE ONLY: makes sure that our representation of the data includes ALL values, active and inactive.

  • access: public
void makeFull ()
numValues (line 390)

Returns the number of values we have set for $label.

int numValues (string $label, [optional $includeInactive = false])
  • string $label
  • optional $includeInactive: boolean $includeInactive If TRUE will include inactive values as well.
populate (line 321)

INTERNAL USE ONLY: Creates a number of RecordFieldValue objects based on an array of database rows.

bool populate (ref $arrayOfRows)
  • ref $arrayOfRows: array $arrayOfRows
prune (line 655)

Goes through all the old versions of values and actually DELETES them from the database.

void prune (ref $versionConstraint)
  • ref $versionConstraint: object $versionConstraint A VersionConstraint)
reIndex (line 178)

Re-indexes all the values in a multi-valued field so that they increment by 1 started at 0.

  • access: public
void reIndex (string $label)
  • string $label: The field's label.
replicate (line 633)

Creates an exact (specific to the data) copy of the Record, that can then be inserted into the DB as a new set with the same data.

  • return: object A new Record object.
ref replicate ()
setActiveFlag (line 674)

Changes this Records active flag.

  • deprecated: does nothing
void setActiveFlag (boolean $bool)
  • boolean $bool: The new value.
setFetchMode (line 134)

INTERNAL USE ONLY: Sets the fetch mode.

  • access: public
void setFetchMode (mixed $mode)
setValue (line 465)

Sets the value of $index under $label to $obj where $obj is an SObject.

bool setValue (string $label, ref $obj, optional $index)
  • string $label
  • ref $obj: object $obj
  • optional $index: int $index default=0
tag (line 602)

Uses the RecordTagManager service to add a tag of the current state (in the DB) of this Record.

void tag ([optional $date = null])
  • optional $date: object $date An optional DateAndTime to specify the date that should be attached to the tag instead of the current date/time.
takeRow (line 338)

INTERNAL USE ONLY: Takes one row from a database and populates our objects with it.

void takeRow (ref $row)
  • ref $row: array $row
undeleteValue (line 437)

Re-activates the value under $label[$index].

  • access: public
void undeleteValue (string $label, optional $index)
  • string $label: The field label to un-delete.
  • optional $index: int $index The index (for multi-value fields) to un-delete.
_checkLabel (line 155)
void _checkLabel (mixed $label)
_getFieldID (line 191)

Returns the full ID of a field, given a label.

  • access: private
string _getFieldID (string $label)
  • string $label
_getFieldLabel (line 201)

Returns a field's label given its ID.

  • access: private
string _getFieldLabel (string $id)
  • string $id

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