You are here

public function ExportData::merge in Loft Data Grids 6.2

Same name and namespace in other branches
  1. 7.2 vendor/aklump/loft_data_grids/src/AKlump/LoftDataGrids/ExportData.php \AKlump\LoftDataGrids\ExportData::merge()

Merge another ExportData object into this one

  • Rows will be merged by key
  • All rows will be expanded to have all columns

Parameters

ExportData $data:

mixed $empty_value:

Return value

$this

Overrides ExportDataInterface::merge

See also

ExportData::normalize()

File

vendor/aklump/loft_data_grids/src/AKlump/LoftDataGrids/ExportData.php, line 365

Class

ExportData

Namespace

AKlump\LoftDataGrids

Code

public function merge(ExportDataInterface $data, $empty_value) {

  // Normalize columns on incoming
  $this
    ->normalize($empty_value);
  $data
    ->normalize($empty_value);
  foreach (array_keys($this->data) as $page_id) {
    foreach ($this->data[$page_id] as $key => $row) {
      $this->data[$page_id][$key] += $row;
    }
  }

  // Normalize result
  $this
    ->normalize($empty_value);
  return $this;
}