/** * Load Group from CMbObject * * @param CMbObject $object CMbObject * * @return CGroups */ function loadRefGroup($object) { switch ($object->_class) { case 'CCompteRendu': /** @var CCompteRendu $object */ $object->completeField("author_id"); $object->loadRefAuthor(); $group = $object->_ref_author->loadRefFunction()->loadRefGroup(); break; case 'CConsultAnesth': case 'COperation': /** @var CConsultAnesth $object */ $object->loadRefChir(); $group = $object->_ref_chir->loadRefFunction()->loadRefGroup(); break; case 'CConsultation': case 'CPrescriptionLineMedicament': case 'CPrescriptionLineMix': case 'CPrescriptionLineElement': $object->loadRefPraticien(); $group = $object->_ref_praticien->loadRefFunction()->loadRefGroup(); break; case 'CObservationMedicale': case 'CTransmissionMedicale': $object->completeField("user_id"); $object->loadRefUser(); $group = $object->_ref_user->loadRefFunction()->loadRefGroup(); break; case 'CFile': /** @var CFile $object */ $object->completeField("author_id"); $object->loadRefAuthor(); $group = $object->_ref_author->loadRefFunction()->loadRefGroup(); break; default: if ($object->_class instanceof CExObject) { $group = $object->loadRefGroup(); } else { return new CGroups(); } } return $group; }