diff --git a/app/src/Controller/ApiV2Controller.php b/app/src/Controller/ApiV2Controller.php index 3553dca69..78c5fb7c8 100644 --- a/app/src/Controller/ApiV2Controller.php +++ b/app/src/Controller/ApiV2Controller.php @@ -280,7 +280,20 @@ public function index() { if(!empty($link->attr) && !empty($link->value)) { $query = $query->where([$this->$modelsName->getAlias().'.'.$link->attr => $link->value]); } - + + // This will produce a nested object which is very useful for vue integration + if($this->request->getQuery('extended') !== null) { + $modelContain = []; + $associations = $this->$modelsName->associations(); + foreach($associations->getByType(['BelongsTo']) as $a) { + $modelContain[] = $a->getClassName(); + } + + if(!empty($modelContain)) { + $query = $query->contain($modelContain); + } + } + if($modelsName == 'AuthenticationEvents') { // Special case for filtering on authenticated identifier. There is a // similar filter in AuthenticationEventsController::beforeFilter. diff --git a/app/webroot/js/comanage/components/mvea/mvea-item.js b/app/webroot/js/comanage/components/mvea/mvea-item.js index 5c4d8ee6d..134060ffe 100644 --- a/app/webroot/js/comanage/components/mvea/mvea-item.js +++ b/app/webroot/js/comanage/components/mvea/mvea-item.js @@ -50,7 +50,7 @@ export default {