improved handling when no public entities are available
This commit is contained in:
parent
549c3a8cef
commit
3551c924bd
2 changed files with 7 additions and 6 deletions
|
@ -61,11 +61,8 @@ class EntityController extends Controller {
|
|||
throw new \Exception('No entity found with UUID: ' . $uuid, 404);
|
||||
}
|
||||
}
|
||||
elseif ($publicEntities = $this->filter(array('public' => TRUE))) { // public entities
|
||||
return array('entities' => $publicEntities);
|
||||
}
|
||||
else { // no public entities available
|
||||
return array('entities' => array());
|
||||
else { // public entities
|
||||
return array('entities' => $this->filter(array('public' => TRUE)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -121,7 +118,7 @@ class EntityController extends Controller {
|
|||
});
|
||||
|
||||
// send new cookie to browser
|
||||
setcookie('vz_uuids', implode(';', array_unique($uuids)), 0, '/'); // TODO correct path
|
||||
setcookie('vz_uuids', implode(';', array_unique($uuids)), 0, '/'); // TODO correct path
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -240,6 +240,10 @@ class JSON extends View {
|
|||
*
|
||||
*/
|
||||
protected function addArray($data, &$refNode) {
|
||||
if (is_null($refNode)) {
|
||||
$refNode = array();
|
||||
}
|
||||
|
||||
foreach ($data as $index => $value) {
|
||||
if ($value instanceof Util\JSON || is_array($value)) {
|
||||
$this->addArray($value, $refNode[$index]);
|
||||
|
|
Loading…
Add table
Reference in a new issue