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
Takes a tag object and activates the appropriate versions of values based on the tag mappings.
bool
activateTag
(ref $tag)
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.
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.
Deletes the record entirely from the database upon calling commit().
void
delete
()
De-activates the value under $label[$index].
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.
Returns the indices (indexes) of each value for the given field. Can then be retrieved with any getValue-type function.
array
getActiveIndices
(string $label)
Returns the DateAndTime object specifying when this Record was created.
ref
getCreationDate
()
INTERNAL USE ONLY: Returns an array of field IDs that have already been fetched & populated.
array
getFetchedFieldIDs
()
INTERNAL USE ONLY: Returns our current fetch mode.
int
getFetchMode
()
Returns this Record's ID.
int
getID
()
Returns the indices (indexes) of each value for the given field. Can then be retrieved with any getValue-type function.
array
getIndices
(string $label, [optional $includeInactive = false])
-
string
$label
-
optional
$includeInactive: boolean $includeInactive Includes the inactive values for 'label'. Default: false
Returns the RecordFieldValue associated with a field by id.
ref
getRecordFieldValue
(string $id, optional $index)
-
string
$id: The field's unique ID
-
optional
$index: integer $index
Returns all the RecordFieldValues objects associated with a field by id.
ref
getRecordFieldValues
(string $id)
-
string
$id: The field's unique ID
Returns this Record's Schema
ref
getSchema
()
Returns the Schema ID associated with this Record.
string
getSchemaID
()
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.
Returns an array of all the string values for the passed label.
array
getStringValues
(string $label)
Returns the active SObject value object for $index under $label.
ref
getValue
(string $label, optional $index)
-
string
$label
-
optional
$index: int $index default=0.
Returns the active value for a label/index by calling $function on the SObject that is returned.
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
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.
array
getValuesArray
()
Returns an array of RecordFieldData objects corresponding to the different versions available for a given $label/$index - useful for version-controlled Records.
ref
getVersions
(string $label, optional $index)
-
string
$label
-
optional
$index: integer $index
Returns if this Record is about to be deleted or not.
bool
isActive
()
Returns true if the given value has been deleted.
bool
isValueDeleted
(string $label, optional $index)
-
string
$label: the field label to check.
-
optional
$index: int $index The index (defaults to 0) to check.
Returns TRUE if this DataSet was created with Version Control.
bool
isVersionControlled
()
INTERNAL USE ONLY: Makes sure that our representation of the data includes all current values.
void
makeCurrent
()
INTERNAL USE ONLY: makes sure that our representation of the data includes ALL values, active and inactive.
void
makeFull
()
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.
INTERNAL USE ONLY: Creates a number of RecordFieldValue objects based on an array of database rows.
bool
populate
(ref $arrayOfRows)
-
ref
$arrayOfRows: array $arrayOfRows
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)
Re-indexes all the values in a multi-valued field so that they increment by 1 started at 0.
void
reIndex
(string $label)
-
string
$label: The field's label.
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.
ref
replicate
()
Changes this Records active flag.
void
setActiveFlag
(boolean $bool)
-
boolean
$bool: The new value.
INTERNAL USE ONLY: Sets the fetch mode.
void
setFetchMode
(mixed $mode)
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
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.
INTERNAL USE ONLY: Takes one row from a database and populates our objects with it.
void
takeRow
(ref $row)
Re-activates the value under $label[$index].
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.
void
_checkLabel
(mixed $label)
Returns the full ID of a field, given a label.
string
_getFieldID
(string $label)
Returns a field's label given its ID.
string
_getFieldLabel
(string $id)