fORMColumnstatic classv1.0.0b8

Provides special column functionality for fActiveRecord classes

Changes:
1.0.0b8Made the validation on link columns a bit more strict 3/9/10
1.0.0b7Updated code for the new fORMDatabase and fORMSchema APIs 10/28/09
1.0.0b6Changed SQL statements to use value placeholders, identifier escaping and schema support 10/22/09
1.0.0b5Updated to use new fORM::registerInspectCallback() method 7/13/09
1.0.0b4Updated code for new fORM API 6/15/09
1.0.0b3Updated code to use new fValidationException::formatField() method 6/4/09
1.0.0b2Fixed a bug with objectifying number columns 11/24/08
1.0.0bThe initial implementation 5/27/08

Static Methods

::configureEmailColumn() public

Sets a column to be formatted as an email address

Signature

void configureEmailColumn( mixed $class, string $column )

Parameters

mixed $class The class name or instance of the class to set the column format
string $column The column to format as an email address

::configureLinkColumn() public

Sets a column to be formatted as a link

Signature

void configureLinkColumn( mixed $class, string $column )

Parameters

mixed $class The class name or instance of the class to set the column format
string $column The column to format as a link

::configureNumberColumn() public

Sets a column to be returned as an fNumber object from calls to get{ColumnName}()

Signature

void configureNumberColumn( mixed $class, string $column )

Parameters

mixed $class The class name or instance of the class to set the column format
string $column The column to return as an fNumber object

::configureRandomColumn() public

Sets a column to be a random string column - a random string will be generated when the record is saved

Signature

void configureRandomColumn( mixed $class, string $column, string $type, integer $length )

Parameters

mixed $class The class name or instance of the class
string $column The column to set as a random column
string $type The type of random string, must be one of: 'alphanumeric', 'alpha', 'numeric', 'hexadecimal'
integer $length The length of the random string

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

Encodes a number column by calling fNumber::__toString()

Signatures

string encodeNumberColumn( fActiveRecord $object, string $method_name, array $parameters )

string encodeNumberColumn( 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
string $method_name The method that was called
array $parameters The parameters passed to the method

Returns

The encoded number

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

Generates a new random value for the

Signatures

string generate( fActiveRecord $object, string $method_name, array $parameters )

string generate( 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
string $method_name The method that was called
array $parameters The parameters passed to the method

Returns

The encoded number

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

Adds metadata about features added by this class

Signatures

void inspect( string $class, string $column )

void inspect( array $metadata )

Parameters

string $class The class being inspected
string $column The column being inspected
array &$metadata The array of metadata about a column

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

Turns a numeric value into an fNumber object

Signature

mixed objectifyNumber( string $class, string $column, mixed $value )

Parameters

string $class The class this value is for
string $column The column the value is in
mixed $value The value

Returns

The fNumber object or raw value

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

Prepares a link column so that the link will work properly in an a tag

Signatures

string prepareLinkColumn( fActiveRecord $object, string $method_name, array $parameters )

string prepareLinkColumn( 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
string $method_name The method that was called
array $parameters The parameters passed to the method

Returns

The formatted link

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

Prepares a number column by calling fNumber::format()

Signatures

string prepareNumberColumn( fActiveRecord $object, string $method_name, array $parameters )

string prepareNumberColumn( 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
string $method_name The method that was called
array $parameters The parameters passed to the method

Returns

The formatted link

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

Signatures

void reflect( string $class, boolean $include_doc_comments )

void reflect( array $signatures )

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

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

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

Sets the appropriate column values to a random string if the object is new

Signatures

string setRandomStrings( fActiveRecord $object )

string setRandomStrings( 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

Returns

The formatted link

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

Validates all email columns

Signatures

void validateEmailColumns( fActiveRecord $object )

void validateEmailColumns( 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

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

Validates all link columns

Signatures

void validateLinkColumns( fActiveRecord $object )

void validateLinkColumns( 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