Skip to content

Commit

Permalink
Fix rawColumns not working on relationships.
Browse files Browse the repository at this point in the history
Fix #1151.
  • Loading branch information
yajra committed May 22, 2017
1 parent 5b5eff0 commit f1e79f3
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/Processors/DataProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,10 @@ protected function escapeColumns(array $output)
return array_map(function ($row) {
if ($this->escapeColumns == '*') {
$row = $this->escapeRow($row);
} else {
foreach ($this->escapeColumns as $key) {
if (array_get($row, $key) && ! in_array($key, $this->rawColumns)) {
array_set($row, $key, e(array_get($row, $key)));
}
} elseif (is_array($this->escapeColumns)) {
$columns = array_diff_key($this->escapeColumns, $this->rawColumns);
foreach ($columns as $key) {
array_set($row, $key, e(array_get($row, $key)));
}
}

Expand All @@ -236,16 +235,17 @@ protected function escapeColumns(array $output)
*/
protected function escapeRow(array $row)
{
foreach ($row as $key => $value) {
if (is_array($value)) {
$row[$key] = $this->escapeRow($value);
} else {
if (! in_array($key, $this->rawColumns)) {
$row[$key] = e($value);
}
$arrayDot = array_dot($row);
foreach ($arrayDot as $key => $value) {
if (! in_array($key, $this->rawColumns)) {
$arrayDot[$key] = e($value);
}
}

foreach ($arrayDot as $key => $value) {
array_set($row, $key, $value);
}

return $row;
}
}

0 comments on commit f1e79f3

Please sign in to comment.