fix: Fixed some galaxy cluster inconsistencies

pull/2883/head
iglocska 2018-01-26 19:49:54 +01:00
parent bfcb85f56f
commit 3c6e2e0335
2 changed files with 10 additions and 2 deletions

View File

@ -48,8 +48,7 @@ class GalaxiesController extends AppController {
if (empty($galaxy)) {
throw new NotFoundException('Galaxy not found.');
}
$this->set('Galaxy', $galaxy);
$this->set('_serialize', array('Galaxy'));
return $this->RestResponse->viewData($galaxy, $this->response->type());
} else {
$galaxy = $this->Galaxy->find('first', array(
'recursive' => -1,

View File

@ -38,6 +38,15 @@ class GalaxyCluster extends AppModel{
return true;
}
public function afterFind($results, $primary = false) {
foreach ($results as $k => $result) {
if (isset($results[$k]['GalaxyCluster']['authors'])) {
$results[$k]['GalaxyCluster']['authors'] = json_decode($results[$k]['GalaxyCluster']['authors'], true);
}
}
return $results;
}
public function beforeDelete($cascade = true) {
$this->GalaxyElement->deleteAll(array('GalaxyElement.galaxy_cluster_id' => $this->id));
}