From 83b5f5f8989fd552bc335de1e8ec6166b4002c25 Mon Sep 17 00:00:00 2001 From: LouisGac Date: Fri, 21 Jul 2017 12:12:59 +0200 Subject: [PATCH] Dev: added "getParentTitle" method, to check if group has a parent before calling the relation --- application/models/SurveysGroups.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/application/models/SurveysGroups.php b/application/models/SurveysGroups.php index 891734b1a7d..7891cccf913 100644 --- a/application/models/SurveysGroups.php +++ b/application/models/SurveysGroups.php @@ -110,6 +110,16 @@ public function search() )); } + public function getParentTitle() + { + // "(gsid: ".$data->parent_id.")"." ".$data->parentgroup->title, + if (empty($this->parent_id)){ + return ""; + }else{ + return $this->parentgroup->title; + } + } + /** * Returns the static model of the specified AR class. * Please note that you should have this exact method in all your CActiveRecord descendants!