chg: [galaxyClusterRelation] Make sure sourceCluster is always contained

pull/6120/head
mokaddem 2020-09-25 12:16:54 +02:00
parent d608cb835c
commit 1cc35df4f0
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
4 changed files with 6 additions and 4 deletions

View File

@ -85,7 +85,7 @@ class GalaxyClusterRelationsController extends AppController
$conditions = array('GalaxyClusterRelation.id' => $id);
$relation = $this->GalaxyClusterRelation->fetchRelations($this->Auth->user(), array(
'conditions' => $conditions,
'contain' => array('SharingGroup', 'SourceCluster', 'TargetCluster', 'GalaxyClusterRelationTag' => array('Tag'))
'contain' => array('SharingGroup', 'TargetCluster', 'GalaxyClusterRelationTag' => array('Tag'))
));
if (empty($relation)) {
throw new NotFoundException(__('Invalid cluster relation'));
@ -182,7 +182,7 @@ class GalaxyClusterRelationsController extends AppController
public function edit($id)
{
$conditions = array('conditions' => array('GalaxyClusterRelation.id' => $id), 'contain' => array('GalaxyClusterRelationTag' => 'Tag', 'SourceCluster'));
$conditions = array('conditions' => array('GalaxyClusterRelation.id' => $id), 'contain' => array('GalaxyClusterRelationTag' => 'Tag'));
$existingRelation = $this->GalaxyClusterRelation->fetchRelations($this->Auth->user(), $conditions);
if (empty($existingRelation)) {
throw new NotFoundException(__('Invalid cluster relation'));

View File

@ -987,7 +987,7 @@ class GalaxyClustersController extends AppController
'conditions' => array(
'GalaxyClusterRelation.galaxy_cluster_uuid' => $cluster['GalaxyCluster']['uuid']
),
'contain' => array('SharingGroup', 'SourceCluster', 'TargetCluster', 'GalaxyClusterRelationTag' => array('Tag'))
'contain' => array('SharingGroup', 'TargetCluster', 'GalaxyClusterRelationTag' => array('Tag'))
));
$this->set('relations', $relations);
$this->set('tree', $tree);

View File

@ -987,7 +987,6 @@ class GalaxyCluster extends AppModel
'contain' => array(
'GalaxyClusterRelationTag' => array('Tag'),
'SharingGroup',
'SourceCluster',
),
'conditions' => array(
'TargetingClusterRelation.referenced_galaxy_cluster_id' => $cluster['GalaxyCluster']['id']

View File

@ -120,6 +120,9 @@ class GalaxyClusterRelation extends AppModel
} elseif ($full) {
$params['contain'] = array('SharingGroup', 'SourceCluster', 'TargetCluster');
}
if (!in_array('SourceCluster', $params['contain'])) {
$params['contain'][] = 'SourceCluster';
}
if (isset($options['fields'])) {
$params['fields'] = $options['fields'];
}