/** * Returns a new fRecordSet containing only unique records in the record set * * @param boolean $remember_original_count If the number of records in the current set should be saved as the non-limited count for the new set - the page will be reset to `1` either way * @return fRecordSet The new record set with only unique records */ public function unique($remember_original_count = FALSE) { $records = array(); foreach ($this->records as $record) { $class = get_class($record); $hash = fActiveRecord::hash($record); if (isset($records[$class . '::' . $hash])) { continue; } $records[$class . '::' . $hash] = $record; } $set = new fRecordSet($this->class, array_values($records)); if ($remember_original_count) { $set->non_limited_count = $this->count(); } return $set; }