Skip to content

Commit

Permalink
Merge pull request #30 from ulion/master
Browse files Browse the repository at this point in the history
Unset the flash field in data correctly even when dataWrapper set and metaWrapper not set.
  • Loading branch information
entomb committed Nov 12, 2015
2 parents 9958434 + e99e3f6 commit f5db6d1
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions jsonAPI/JsonApiView.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,19 +107,17 @@ public function render($status=200, $data = NULL) {
//add flash messages
if (isset($this->data->flash) && is_object($this->data->flash)) {
$flash = $this->data->flash->getMessages();
if ($this->dataWraper) {
unset($response[$this->dataWraper]['flash']);
} else {
unset($response['flash']);
}
if (count($flash)) {
if ($this->metaWrapper) {
unset($response[$this->dataWraper]['flash']);
$response[$this->metaWrapper]['flash'] = $flash;
} else {
$response['flash'] = $flash;
}
} else {
if ($this->metaWrapper) {
unset($response[$this->dataWraper]['flash']);
} else {
unset($response['flash']);
}
}
}

Expand Down

0 comments on commit f5db6d1

Please sign in to comment.