Flourish PHP Unframework

fORMOrdering

static class, v1.0.0b19

Allows a column in an fActiveRecord class to be a relative sort order column

Changes:
1.0.0b19Updated code to work with the new fORM API 8/6/10
1.0.0b18Changed configureOrderingColumn() to ensure the column specified can store negative values 7/21/10
1.0.0b17Changed validation messages array to use column name keys 5/26/10
1.0.0b16Updated the class to allow for multiple ordering columns per class 5/10/10
1.0.0b15Fixed a bug with ordering columns that are part of a multi-column unique constraint 11/13/09
1.0.0b14Fixed a bug affecting where conditions with columns that are not null but have a default value 11/3/09
1.0.0b13Updated code for the new fORMDatabase and fORMSchema APIs 10/28/09
1.0.0b12Changed SQL statements to use value placeholders, identifier escaping and schema support 10/22/09
1.0.0b11Fixed another bug with deleting records in the middle of a set, added support for reordering multiple records at once 7/17/09
1.0.0b10Fixed a bug with deleting multiple in-memory records in the same set 7/15/09
1.0.0b9Fixed a bug with using fORM::registerInspectCallback() 7/15/09
1.0.0b8Updated to use new fORM::registerInspectCallback() method 7/13/09
1.0.0b7Fixed validate() so it properly ignores ordering columns in multi-column unique constraints 6/17/09
1.0.0b6Updated code for new fORM API 6/15/09
1.0.0b5Updated class to automatically correct ordering values that are too high 6/14/09
1.0.0b4Updated code to use new fValidationException::formatField() method 6/4/09
1.0.0b3Fixed a bug with setting a new record to anywhere but the end of a set 3/18/09
1.0.0b2Fixed a bug with inspect(), 'max_ordering_value' was being returned as 'max_ordering_index' 3/2/09
1.0.0bThe initial implementation 6/25/08

Static Methods

::configureOrderingColumn() public

Sets a column to be an ordering column

There can only be one ordering column per class/table and it must be part of a single or multi-column UNIQUE constraint.

Signature

void configureOrderingColumn( mixed $class, string $column )

Parameters

mixed $class The class name or instance of the class
string $column The column to set as an ordering column

::delete() 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

Re-orders other records in the set when the record specified is deleted

Signature

void delete( fActiveRecord $object, array &$values, array &$old_values, array &$related_records, array &$cache )

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

::inspect() 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 the metadata about a column including features added by this class

Signature

mixed inspect( 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 metadata array or element specified

::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 configured in 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

::reorder() 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

Re-orders the object based on it's current state and new position

Signature

void reorder( fActiveRecord $object, array &$values, array &$old_values, array &$related_records, array &$cache )

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

::reset() 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

Resets the configuration of the class

Signature

void reset( )

::validate() 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

Makes sure the ordering value is sane, removes error messages about missing values

Signature

void validate( fActiveRecord $object, array &$values, array &$old_values, array &$related_records, array &$cache, array &$validation_messages )

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
array &$validation_messages An array of ordered validation messages