
Provides money functionality for fActiveRecord classes
1.0.0b11 | Fixed the generation of validation messages when a non-monetary value is supplied 5/17/11 |
---|---|
1.0.0b10 | Updated code to work with the new fORM API 8/6/10 |
1.0.0b9 | Added the $remove_zero_fraction parameter to prepare methods 6/9/10 |
1.0.0b8 | Changed validation messages array to use column name keys 5/26/10 |
1.0.0b7 | Fixed the set methods to return the record object in order to be consistent with all other set methods 3/15/10 |
1.0.0b6 | Fixed duplicate validation messages and fProgrammerException object being thrown when NULL is set 3/3/10 |
1.0.0b5 | Updated code for the new fORMDatabase and fORMSchema APIs 10/28/09 |
1.0.0b4 | Updated to use new fORM::registerInspectCallback() method 7/13/09 |
1.0.0b3 | Updated code to use new fValidationException::formatField() method 6/4/09 |
1.0.0b2 | Fixed bugs with objectifying money columns 11/24/08 |
1.0.0b | The initial implementation 9/5/08 |
Sets a column to be formatted as an fMoney object
void configureMoneyColumn( mixed $class, string $column, string $currency_column=NULL )
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 money column by calling fMoney::__toString()
string encodeMoneyColumn( fActiveRecord $object, array &$values, array &$old_values, array &$related_records, array &$cache, string $method_name, array $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 |
The encoded monetary value
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
void inspect( string $class, string $column, array &$metadata )
string | $class | The class being inspected |
string | $column | The column being inspected |
array | &$metadata | The array of metadata about a column |
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 fMoney objects for all money columns in the object that also have a currency column
void makeMoneyObjects( fActiveRecord $object, array &$values, array &$old_values, array &$related_records, array &$cache )
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 |
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 monetary value into an fMoney object
mixed objectifyMoney( string $class, string $column, mixed $value )
string | $class | The class this value is for |
string | $column | The column the value is in |
mixed | $value | The value |
The fMoney object or raw value
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 monetary value into an fMoney object with a currency specified by another column
void objectifyMoneyWithCurrency( array &$values, array &$old_values, string $value_column, string $currency_column )
array | &$values | The current values |
array | &$old_values | The old values |
string | $value_column | The column holding the value |
string | $currency_column | The column holding the currency code |
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 money column by calling fMoney::format()
string prepareMoneyColumn( fActiveRecord $object, array &$values, array &$old_values, array &$related_records, array &$cache, string $method_name, array $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 |
The formatted monetary value
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
void reflect( string $class, array &$signatures, boolean $include_doc_comments )
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 |
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
void reset( )
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 currency column and then tries to objectify the related money column
fActiveRecord setCurrencyColumn( fActiveRecord $object, array &$values, array &$old_values, array &$related_records, array &$cache, string $method_name, array $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 |
The record object, to allow for method chaining
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 money column and then tries to objectify it with an related currency column
fActiveRecord setMoneyColumn( fActiveRecord $object, array &$values, array &$old_values, array &$related_records, array &$cache, string $method_name, array $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 |
The record object, to allow for method chaining
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 money columns
void validateMoneyColumns( fActiveRecord $object, array &$values, array &$old_values, array &$related_records, array &$cache, array &$validation_messages )
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 |