# Docs For Class FileMaker_Record

## Class FileMaker_Record

Description

Default Record class that represents each record of a result set.

From a Record object, you can get field data, edit and delete the record, get its parent record, get its related record set, and create related records.

Instead of this class, you can specify a different class to use for Record objects. To specify the record class to use, open the FileMaker/conf/filemaker-api.php configuration file where the API is installed. Then set $__FM_CONFIG['recordClass'] to the name of the record class to use. The class you specify should be a subclass of the FileMaker_Record base class or encapsulate its functionality. In PHP 5, this class would implement an interface that alternate classes would be required to implement as well.

Located in /FileMaker/Record.php (line 40)

Method Summary
FileMaker_Record FileMaker_Record (FileMaker_Layout|FileMaker_RelatedSet &$layout)
boolean|FileMaker_Error commit ()
FileMaker_Result delete ()
string getField (string $field, [integer $repetition = 0])
integer getFieldAsTimestamp (string $field, [integer $repetition = 0])
array getFields ()
string getFieldUnencoded (string $field, [integer $repetition = 0])
FileMaker_Layout &getLayout ()
integer getModificationId ()
FileMaker_Record &getParent ()
string getRecordId ()
array &getRelatedSet (string $relatedSet)
FileMaker_Record &newRelatedRecord (string $relatedSet)
void setField (string $field, string $value, [integer $repetition = 0])
void setFieldFromTimestamp (string $field, string $timestamp, [integer $repetition = 0])
boolean|FileMaker_Error_Validation validate ([string $fieldName = null])
Methods
Constructor FileMaker_Record (line 57)

Record object constructor.

FileMaker_Record FileMaker_Record (FileMaker_Layout|FileMaker_RelatedSet &$layout)

- FileMaker_Layout|FileMaker_RelatedSet &$layout: Specify either the Layout object associated with this record or the Related Set object that this record is a member of.

commit (line 269)

Saves any changes to this record in the database on the Database Server.

- return: TRUE, if successful. Otherwise, an Error object.

boolean|FileMaker_Error commit ()
delete (line 279)

Deletes this record from the database on the Database Server.

- return: Response object.

FileMaker_Result delete ()
getField (line 99)

Returns the HTML-encoded value of the specified field.

This method converts some special characters in the field value to HTML entities. For example, '&', '"', '<', and '>' are converted to '&amp;', '&quot;', '&lt;', and '&gt;', respectively.

- return: Encoded field value.

string getField (string $field, [integer $repetition = 0])

- string $field: Name of field.
- integer $repetition: Field repetition number to get. Defaults to the first repetition.

getFieldAsTimestamp (line 139)

Returns the value of the specified field as a UNIX timestamp.

If the field is a date field, the timestamp is for the field date at midnight. It the field is a time field, the timestamp is for that time on January 1, 1970. Timestamp (date and time) fields map directly to the UNIX timestamp. If the specified field is not a date or time field, or if the timestamp generated would be out of range, then this method returns a FileMaker_Error object instead.

- return: Timestamp value.

integer getFieldAsTimestamp (string $field, [integer $repetition = 0])

- string $field: Name of the field.
- integer $repetition: Field repetition number to get. Defaults to the first repetition.

getFields (line 81)

Returns a list of the names of all fields in the record.

Only the field names are returned. If you need additional information, examine the Layout object provided by the parent object's FileMaker_Result::getLayout() method.

- return: List of field names as strings.

array getFields ()
getFieldUnencoded (line 116)

Returns the unencoded value of the specified field.

This method does not convert special characters in the field value to HTML entities.

- return: Unencoded field value.

string getFieldUnencoded (string $field, [integer $repetition = 0])

- string $field: Name of field.
- integer $repetition: Field repetition number to get. Defaults to the first repetition.

getLayout (line 67)

Returns the layout this record is associated with.

- return: This record's layout.

FileMaker_Layout &getLayout ()
getModificationId (line 197)

Returns the modification ID of this record.

The modification ID is an incremental counter that specifies the current version of a record. See the FileMaker_Command_Edit::setModificationId() method.

- return: Modification ID.

integer getModificationId ()
getParent (line 231)

Returns the parent record, if this record is a child record in a portal.

- return: Parent record.

FileMaker_Record &getParent ()
getRecordId (line 183)

Returns the record ID of this object.

- return: Record ID.

string getRecordId ()
getRelatedSet (line 209)

Returns any Record objects in the specified portal.

- return: Array of FileMaker_Record objects from $relatedSet.

array &getRelatedSet (string $relatedSet)

- string $relatedSet: Name of the portal to return records from.

newRelatedRecord (line 221)

Creates a new record in the specified portal.

- return: A new, blank record.

FileMaker_Record &newRelatedRecord (string $relatedSet)

- string $relatedSet: Name of the portal to create a new record in.

setField (line 152)

Sets the value of $field.

void setField (string $field, string $value, [integer $repetition = 0])

- string $field: Name of the field.
- string $value: New value of the field.
- integer $repetition: Field repetition number to set. Defaults to the first repetition.

setFieldFromTimestamp (line 173)

Sets the new value for a date, time, or timestamp field from a UNIX timestamp value.

If the field is not a date or time field, then returns an error. Otherwise, returns TRUE.

If layout data for the target of this command has not already been loaded, calling this method loads layout data so that the type of the field can be checked.

void setFieldFromTimestamp (string $field, string $timestamp, [integer $repetition = 0])

- string $field: Name of the field to set.
- string $timestamp: Timestamp value.
- integer $repetition: Field repetition number to set. Defaults to the first repetition.

validate (line 258)

Pre-validates either a single field or the entire record.

This method uses the pre-validation rules that are enforceable by the PHP engine -- for example, type rules, ranges, and four-digit dates. Rules such as "unique" or "existing," or validation by calculation field, cannot be pre-validated.

If you pass the optional $fieldName argument, only that field is pre-validated. Otherwise, the record is pre-validated as if commit() were called with "Enable record data pre-validation" selected in FileMaker Server Admin Console. If pre-validation passes, validate() returns TRUE. If pre-validation fails, then validate() returns a FileMaker_Error_Validation object containing details about what failed to pre-validate.

- return: TRUE, if pre-validation passes for $value. Otherwise, an Error Validation object.

boolean|FileMaker_Error_Validation validate ([string $fieldName = null])

- string $fieldName: Name of field to pre-validate. If empty, pre-validates the entire record.

Documentation generated on Mon, 28 Jul 2008 14:47:45 -0700 by phpDocumentor 1.4.0