Permalink
Browse files

BackwardsCompatibilityBreak - renamed fRecordSet::buildFromRecords() …

…to fRecordSet::buildFromArray(). Added fRecordSet::buildFromCall(), fRecordSet::buildFromMap() and `fRecordSet::build{RelatedRecords}()`.
  • Loading branch information...
wbond committed Sep 18, 2009
1 parent 725be14 commit b2915f6a5102cf1423c84e4aa798c6bc9f5cd3e2
Showing with 185 additions and 99 deletions.
  1. +3 −2 classes/fActiveRecord.php
  2. +8 −7 classes/fORMRelated.php
  3. +174 −90 classes/fRecordSet.php
@@ -15,7 +15,8 @@
* @package Flourish
* @link http://flourishlib.com/fActiveRecord
*
* @version 1.0.0b42
* @version 1.0.0b43
* @changes 1.0.0b43 Updated code for new fRecordSet API [wb, 2009-09-16]
* @changes 1.0.0b42 Corrected a grammar bug in ::hash() [wb, 2009-09-09]
* @changes 1.0.0b41 Fixed a bug in the last version that would cause issues with classes containing a custom class to table mapping [wb, 2009-09-01]
* @changes 1.0.0b40 Added a check to the configuration part of ::__construct() to ensure modelled tables have primary keys [wb, 2009-08-26]
@@ -2116,7 +2117,7 @@ public function replicate($related_class=NULL)
} else {
$records = $record_set->call('replicate');
}
$record_set = fRecordSet::buildFromRecords($related_class, $records);
$record_set = fRecordSet::buildFromArray($related_class, $records);
$record_set->call(
'set' . fGrammar::camelize($route, TRUE),
NULL
@@ -12,7 +12,8 @@
* @package Flourish
* @link http://flourishlib.com/fORMRelated
*
* @version 1.0.0b16
* @version 1.0.0b17
* @changes 1.0.0b17 Updated code for new fRecordSet API [wb, 2009-09-16]
* @changes 1.0.0b16 Fixed a bug with ::createRecord() not creating non-existent record when the related value is NULL [wb, 2009-08-25]
* @changes 1.0.0b15 Fixed a bug with ::createRecord() where foreign keys with a different column and related column name would not load properly [wb, 2009-08-17]
* @changes 1.0.0b14 Fixed a bug with ::createRecord() when a foreign key constraint is on a column other than the primary key [wb, 2009-08-10]
@@ -99,7 +100,7 @@ static public function associateRecord($class, &$related_records, $related_class
$record = new $related_class($record);
}
$records = fRecordSet::buildFromRecords($related_class, array($record));
$records = fRecordSet::buildFromArray($related_class, array($record));
$route = fORMSchema::getRouteName($table, $related_table, $route, 'one-to-one');
self::setRecordSet($class, $related_records, $related_class, $records, $route);
@@ -130,10 +131,10 @@ static public function associateRecords($class, &$related_records, $related_clas
$records = clone $records_to_associate;
} elseif (!sizeof($records_to_associate)) {
$records = fRecordSet::buildFromRecords($related_class, array());
$records = fRecordSet::buildFromArray($related_class, array());
} elseif ($records_to_associate[0] instanceof fActiveRecord) {
$records = fRecordSet::buildFromRecords($related_class, $records_to_associate);
$records = fRecordSet::buildFromArray($related_class, $records_to_associate);
// This indicates we are working with just primary keys, so we have to call a different method
} else {
@@ -179,7 +180,7 @@ static public function buildRecords($class, &$values, &$related_records, $relate
// Determine how we are going to build the sequence
if ($values[$relationship['column']] === NULL) {
$record_set = fRecordSet::buildFromRecords($related_class, array());
$record_set = fRecordSet::buildFromArray($related_class, array());
} else {
// When joining to the same table, we have to use a different column
@@ -334,7 +335,7 @@ static public function createRecord($class, $values, &$related_records, $related
} else {
$records = array();
}
$record_set = fRecordSet::buildFromRecords($related_class, $records);
$record_set = fRecordSet::buildFromArray($related_class, $records);
self::setRecordSet($class, $related_records, $related_class, $record_set, $route);
if ($record_set->count()) {
@@ -760,7 +761,7 @@ static public function populateRecords($class, &$related_records, $related_class
fRequest::unfilter();
}
$record_set = fRecordSet::buildFromRecords($related_class, $records);
$record_set = fRecordSet::buildFromArray($related_class, $records);
self::setRecordSet($class, $related_records, $related_class, $record_set, $route);
self::flagForAssociation($class, $related_records, $related_class, $route);
}
Oops, something went wrong.

0 comments on commit b2915f6

Please sign in to comment.