Flourish PHP Unframework

fORMJSON

static class, v1.0.0b3

Adds JSON functionality to fActiveRecord and fRecordSet

Changes:
1.0.0b3Removed the $pointer parameter from toJSONRecordSet() since fRecordSet no longer has a pointer 9/28/10
1.0.0b2Updated the code to remove the $associate parameter for the record set method callback 6/2/09
1.0.0bThe initial implementation 6/25/08

Static Methods

::extend() public

Adds the method toJSON() to fActiveRecord and fRecordSet instances

Signature

void extend( )

::reflect() internal public

Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code

Adjusts the fActiveRecord::reflect() signatures of columns that have been added by this class

Signature

void reflect( string $class, array &$signatures, boolean $include_doc_comments )

Parameters

string $class The class to reflect
array &$signatures The associative array of {method name} => {signature}
boolean $include_doc_comments If doc comments should be included with the signature

::toJSON() internal public

Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code

Returns a JSON object representation of the record

Signature

string toJSON( fActiveRecord $object, array &$values, array &$old_values, array &$related_records, array &$cache, string $method_name, array $parameters )

Parameters

fActiveRecord $object The fActiveRecord instance
array &$values The current values
array &$old_values The old values
array &$related_records Any records related to this record
array &$cache The cache array for the record
string $method_name The method that was called
array $parameters The parameters passed to the method

Returns

The JSON object that represents the values of this record

::toJSONRecordSet() internal public

Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code

Returns a JSON object representation of a record set

Signature

string toJSONRecordSet( fRecordSet $record_set, string $class, array &$records )

Parameters

fRecordSet $record_set The fRecordSet instance
string $class The class of the records
array &$records The fActiveRecord objects

Returns

The JSON object that represents an array of all of the fActiveRecord objects