Browse files

BackwardsCompatibilityBreak - Restructured individual record access, …

…the iterator interface and callback parameters for fRecordSet.

Removed the method fRecordSet::fetchRecord() - functionality can be replicated via the new method fRecordSet::getRecord().

Manual iteration via fRecordSet::current(), fRecordSet::key(), fRecordSet::next(), fRecordSet::rewind() and fRecordSet::valid() (the Iterator interface) was removed and should be replaced by retrieving an ArrayIterator from the new method fRecordSet::getIterator(). Manual iteration can be performed on the ArrayIterator object.

The `$pointer` parameter was replaced with `$method_name` for callbacks registered via fORM::registerRecordSetMethod().

Added the methods fRecordSet::getLimit(), fRecordSet::getPage(), fRecordSet::getPages() for easier pagination.

Added the ArrayAccess interface to fRecordSet, allowing for array-style dereferencing such as `$record_set[0]`. The methods fRecordSet::offsetExists(), fRecordSet::offsetGet(), fRecordSet::offsetSet() and fRecordSet::offsetUnset() we added to support this interface.
  • Loading branch information...
wbond committed Sep 28, 2010
1 parent b1aa793 commit 28548208a83c9874d4f1698dc3930b88223d3e0d
Showing with 192 additions and 122 deletions.
  1. +3 −2 classes/fORM.php
  2. +3 −3 classes/fORMJSON.php
  3. +186 −117 classes/fRecordSet.php
@@ -9,7 +9,8 @@
* @package Flourish
* @link
* @version 1.0.0b23
* @version 1.0.0b24
* @changes 1.0.0b24 Backwards Compatibility Break - Callbacks registered via ::registerRecordSetMethod() should now accept the `$method_name` in the position where the `$pointer` parameter used to be passed [wb, 2010-09-28]
* @changes 1.0.0b23 Added the `'pre::replicate()'`, `'post::replicate()'` and `'cloned::replicate()'` hooks [wb, 2010-09-07]
* @changes 1.0.0b22 Internal Backwards Compatibility Break - changed ::parseMethod() to not underscorize the subject of the method [wb, 2010-08-06]
* @changes 1.0.0b21 Fixed some documentation to reflect the API changes from v1.0.0b9 [wb, 2010-07-14]
@@ -945,7 +946,7 @@ static public function registerObjectifyCallback($class, $column, $callback)
* - **`$object`**: The actual record set
* - **`$class`**: The class of each record
* - **`&$records`**: The ordered array of fActiveRecord objects
* - **`&$pointer`**: The current array pointer for the records array
* - **`$method_name`**: The method name that was called
* - **`$parameters`**: Any parameters passed to the method
* @param string $method The method to hook for
@@ -9,7 +9,8 @@
* @package Flourish
* @link
* @version 1.0.0b2
* @version 1.0.0b3
* @changes 1.0.0b3 Removed the `$pointer` parameter from ::toJSONRecordSet() since fRecordSet no longer has a pointer [wb, 2010-09-28]
* @changes 1.0.0b2 Updated the code to remove the `$associate` parameter for the record set method callback [wb, 2009-06-02]
* @changes 1.0.0b The initial implementation [wb, 2008-06-25]
@@ -111,10 +112,9 @@ static public function toJSON($object, &$values, &$old_values, &$related_records
* @param fRecordSet $record_set The fRecordSet instance
* @param string $class The class of the records
* @param array &$records The fActiveRecord objects
* @param integer &$pointer The current iteration pointer
* @return string The JSON object that represents an array of all of the fActiveRecord objects
static public function toJSONRecordSet($record_set, $class, &$records, &$pointer)
static public function toJSONRecordSet($record_set, $class, &$records)
return '[' . join(',', $record_set->call('toJSON')) . ']';
Oops, something went wrong.

0 comments on commit 2854820

Please sign in to comment.