Permalink
Browse files

BackwardsCompatibilityBreak - fActiveRecord hooks and method calls no…

…w have a &$cache parameter after the &$related_records parameter, but before any other parameters. Any method registered to a hook will need to have the method signature updated.
  • Loading branch information...
wbond committed Nov 9, 2008
1 parent 4d98871 commit 6f388cad90162297f367367efd000e5d93c2181a
Showing with 165 additions and 105 deletions.
  1. +37 −17 classes/fActiveRecord.php
  2. +10 −8 classes/fORM.php
  3. +26 −18 classes/fORMColumn.php
  4. +20 −13 classes/fORMDate.php
  5. +34 −23 classes/fORMFile.php
  6. +4 −3 classes/fORMJSON.php
  7. +24 −17 classes/fORMMoney.php
  8. +10 −6 classes/fORMOrdering.php
View
@@ -213,6 +213,7 @@ public function __call($method_name, $parameters)
&$this->values,
&$this->old_values,
&$this->related_records,
&$this->cache,
$method_name,
$parameters
)
@@ -419,7 +420,8 @@ public function __construct($primary_key=NULL)
'post::__construct()',
$this->values,
$this->old_values,
$this->related_records
$this->related_records,
$this->cache
);
}
@@ -545,7 +547,8 @@ public function delete()
$this, 'pre::delete()',
$this->values,
$this->old_values,
$this->related_records
$this->related_records,
$this->cache
);
$table = fORM::tablize($this);
@@ -563,7 +566,8 @@ public function delete()
'post-begin::delete()',
$this->values,
$this->old_values,
$this->related_records
$this->related_records,
$this->cache
);
// Check to ensure no foreign dependencies prevent deletion
@@ -639,7 +643,8 @@ public function delete()
'pre-commit::delete()',
$this->values,
$this->old_values,
$this->related_records
$this->related_records,
$this->cache
);
if (!$inside_db_transaction) {
@@ -651,7 +656,8 @@ public function delete()
'post-commit::delete()',
$this->values,
$this->old_values,
$this->related_records
$this->related_records,
$this->cache
);
// If we just deleted an object that has an auto-incrementing primary key,
@@ -673,7 +679,8 @@ public function delete()
'post-rollback::delete()',
$this->values,
$this->old_values,
$this->related_records
$this->related_records,
$this->cache
);
// Check to see if the validation exception came from a related record, and fix the message
@@ -708,7 +715,8 @@ public function delete()
'post::delete()',
$this->values,
$this->old_values,
$this->related_records
$this->related_records,
$this->cache
);
}
@@ -1005,7 +1013,8 @@ protected function loadFromResult($result)
'post::loadFromResult()',
$this->values,
$this->old_values,
$this->related_records
$this->related_records,
$this->cache
);
}
@@ -1063,7 +1072,8 @@ public function populate()
'pre::populate()',
$this->values,
$this->old_values,
$this->related_records
$this->related_records,
$this->cache
);
$table = fORM::tablize($this);
@@ -1081,7 +1091,8 @@ public function populate()
'post::populate()',
$this->values,
$this->old_values,
$this->related_records
$this->related_records,
$this->cache
);
}
@@ -1496,7 +1507,8 @@ public function store()
'pre::store()',
$this->values,
$this->old_values,
$this->related_records
$this->related_records,
$this->cache
);
try {
@@ -1525,7 +1537,8 @@ public function store()
'post-begin::store()',
$this->values,
$this->old_values,
$this->related_records
$this->related_records,
$this->cache
);
$this->validate();
@@ -1535,7 +1548,8 @@ public function store()
'post-validate::store()',
$this->values,
$this->old_values,
$this->related_records
$this->related_records,
$this->cache
);
// Storing main table
@@ -1591,7 +1605,8 @@ public function store()
'pre-commit::store()',
$this->values,
$this->old_values,
$this->related_records
$this->related_records,
$this->cache
);
if (!$inside_db_transaction) {
@@ -1603,7 +1618,8 @@ public function store()
'post-commit::store()',
$this->values,
$this->old_values,
$this->related_records
$this->related_records,
$this->cache
);
} catch (fPrintableException $e) {
@@ -1617,7 +1633,8 @@ public function store()
'post-rollback::store()',
$this->values,
$this->old_values,
$this->related_records
$this->related_records,
$this->cache
);
if ($new_autoincrementing_record && self::hasOld($this->old_values, $pk_column)) {
@@ -1633,7 +1650,8 @@ public function store()
'post::store()',
$this->values,
$this->old_values,
$this->related_records
$this->related_records,
$this->cache
);
// If we got here we succefully stored, so update old values to make exists() work
@@ -1665,6 +1683,7 @@ public function validate($return_messages=FALSE)
$this->values,
$this->old_values,
$this->related_records,
$this->cache,
$validation_messages
);
@@ -1682,6 +1701,7 @@ public function validate($return_messages=FALSE)
$this->values,
$this->old_values,
$this->related_records,
$this->cache,
$validation_messages
);
View
@@ -128,15 +128,16 @@ static public function addCustomTableClassMapping($table, $class)
*
* @internal
*
* @param fActiveRecord $object The instance of the class to call the hook for
* @param string $hook The hook to call
* @param array &$values The current values of the record
* @param array &$old_values The old values of the record
* @param array &$related_records Records related to the current record
* @param mixed &$first_parameter The first parameter to send the callback
* @param fActiveRecord $object The instance of the class to call the hook for
* @param string $hook The hook to call
* @param array &$values The current values of the record
* @param array &$old_values The old values of the record
* @param array &$related_records Records related to the current record
* @param array &$cache The cache array of the record
* @param mixed &$parameter The parameter to send the callback
* @return void
*/
static public function callHookCallbacks($object, $hook, &$values, &$old_values, &$related_records, &$first_parameter=NULL)
static public function callHookCallbacks($object, $hook, &$values, &$old_values, &$related_records, &$cache, &$parameter=NULL)
{
$class = self::getClass($object);
@@ -164,7 +165,8 @@ static public function callHookCallbacks($object, $hook, &$values, &$old_values,
&$values,
&$old_values,
&$related_records,
&$first_parameter
&$cache,
&$parameter
)
);
}
View
@@ -314,11 +314,12 @@ static public function configureRandomColumn($class, $column, $type, $length)
* @param array &$values The current values
* @param array &$old_values The old values
* @param array &$related_records Any records related to this record
* @param string &$method_name The method that was called
* @param array &$parameters The parameters passed to the method
* @param array &$cache The cache array for the record
* @param string $method_name The method that was called
* @param array $parameters The parameters passed to the method
* @return string The encoded number
*/
static public function encodeNumberColumn($object, &$values, &$old_values, &$related_records, &$method_name, &$parameters)
static public function encodeNumberColumn($object, &$values, &$old_values, &$related_records, &$cache, $method_name, $parameters)
{
list ($action, $column) = fORM::parseMethod($method_name);
@@ -347,11 +348,12 @@ static public function encodeNumberColumn($object, &$values, &$old_values, &$rel
* @param array &$values The current values
* @param array &$old_values The old values
* @param array &$related_records Any records related to this record
* @param string $method_name The method that was called
* @param array $parameters The parameters passed to the method
* @param array &$cache The cache array for the record
* @param string $method_name The method that was called
* @param array $parameters The parameters passed to the method
* @return string The encoded number
*/
static public function generate($object, &$values, &$old_values, &$related_records, $method_name, $parameters)
static public function generate($object, &$values, &$old_values, &$related_records, &$cache, $method_name, $parameters)
{
list ($action, $column) = fORM::parseMethod($method_name);
@@ -394,11 +396,12 @@ static public function generate($object, &$values, &$old_values, &$related_recor
* @param array &$values The current values
* @param array &$old_values The old values
* @param array &$related_records Any records related to this record
* @param string &$method_name The method that was called
* @param array &$parameters The parameters passed to the method
* @param array &$cache The cache array for the record
* @param string $method_name The method that was called
* @param array $parameters The parameters passed to the method
* @return mixed The metadata array or element specified
*/
static public function inspect($object, &$values, &$old_values, &$related_records, &$method_name, &$parameters)
static public function inspect($object, &$values, &$old_values, &$related_records, &$cache, $method_name, $parameters)
{
list ($action, $column) = fORM::parseMethod($method_name);
@@ -488,11 +491,12 @@ static public function objectifyNumber($class, $column, $value)
* @param array &$values The current values
* @param array &$old_values The old values
* @param array &$related_records Any records related to this record
* @param string &$method_name The method that was called
* @param array &$parameters The parameters passed to the method
* @param array &$cache The cache array for the record
* @param string $method_name The method that was called
* @param array $parameters The parameters passed to the method
* @return string The formatted link
*/
static public function prepareLinkColumn($object, &$values, &$old_values, &$related_records, &$method_name, &$parameters)
static public function prepareLinkColumn($object, &$values, &$old_values, &$related_records, &$cache, $method_name, $parameters)
{
list ($action, $column) = fORM::parseMethod($method_name);
@@ -522,11 +526,12 @@ static public function prepareLinkColumn($object, &$values, &$old_values, &$rela
* @param array &$values The current values
* @param array &$old_values The old values
* @param array &$related_records Any records related to this record
* @param string &$method_name The method that was called
* @param array &$parameters The parameters passed to the method
* @param array &$cache The cache array for the record
* @param string $method_name The method that was called
* @param array $parameters The parameters passed to the method
* @return string The formatted link
*/
static public function prepareNumberColumn($object, &$values, &$old_values, &$related_records, &$method_name, &$parameters)
static public function prepareNumberColumn($object, &$values, &$old_values, &$related_records, &$cache, $method_name, $parameters)
{
list ($action, $column) = fORM::parseMethod($method_name);
@@ -703,9 +708,10 @@ static public function reset()
* @param array &$values The current values
* @param array &$old_values The old values
* @param array &$related_records Any records related to this record
* @param array &$cache The cache array for the record
* @return string The formatted link
*/
static public function setRandomStrings($object, &$values, &$old_values, &$related_records)
static public function setRandomStrings($object, &$values, &$old_values, &$related_records, &$cache)
{
if ($object->exists()) {
return;
@@ -739,10 +745,11 @@ static public function setRandomStrings($object, &$values, &$old_values, &$relat
* @param array &$values The current values
* @param array &$old_values The old values
* @param array &$related_records Any records related to this record
* @param array &$cache The cache array for the record
* @param array &$validation_messages An array of ordered validation messages
* @return void
*/
static public function validateEmailColumns($object, &$values, &$old_values, &$related_records, &$validation_messages)
static public function validateEmailColumns($object, &$values, &$old_values, &$related_records, &$cache, &$validation_messages)
{
$class = get_class($object);
@@ -773,10 +780,11 @@ static public function validateEmailColumns($object, &$values, &$old_values, &$r
* @param array &$values The current values
* @param array &$old_values The old values
* @param array &$related_records Any records related to this record
* @param array &$cache The cache array for the record
* @param array &$validation_messages An array of ordered validation messages
* @return void
*/
static public function validateLinkColumns($object, &$values, &$old_values, &$related_records, &$validation_messages)
static public function validateLinkColumns($object, &$values, &$old_values, &$related_records, &$cache, &$validation_messages)
{
$class = get_class($object);
Oops, something went wrong.

0 comments on commit 6f388ca

Please sign in to comment.