Project

General

Profile

« Previous | Next » 

Revision d7d89e58

Added by Andreas Kohlbecker over 3 years ago

ref #8850 cdm_compose_annotations_uri() handling cases withiut fieldUnit

View differences:

modules/cdm_dataportal/cdm_api/cdm_api.module
899 899
  $cdm_entity_type = $cdm_entity->class;
900 900

  
901 901
  if($cdm_entity_type == 'DerivedUnitFacade'){
902
    // TODO we may want to implement a derivedUnitFacade/{uuid}/annotations service and use that instead
903
    $cdm_entity_type = $cdm_entity->fieldUnitEntityReference->type;
904
    $cdm_entity_uuid = $cdm_entity->fieldUnitEntityReference->uuid;
902
    if(isset($cdm_entity->fieldUnitEntityReference)){
903
      // TODO we may want to implement a derivedUnitFacade/{uuid}/annotations service and use that instead
904
      $cdm_entity_type = $cdm_entity->fieldUnitEntityReference->type;
905
      $cdm_entity_uuid = $cdm_entity->fieldUnitEntityReference->uuid;
906
    } elseif(isset($cdm_entity->baseUnitEntityReference)){
907
      $cdm_entity_type = $cdm_entity->baseUnitEntityReference->type;
908
      $cdm_entity_uuid = $cdm_entity->baseUnitEntityReference->uuid;
909
    }
905 910
  } elseif ($cdm_entity_type == 'TypedEntityReference'){
906 911
    $cdm_entity_type = $cdm_entity->type;
907 912
    $cdm_entity_uuid = $cdm_entity->uuid;
......
911 916
    }
912 917
  }
913 918

  
914
  if(!$cdm_entity_uuid){
919
  if(!isset($cdm_entity_uuid) || !isset($cdm_entity_type) || !$cdm_entity_type ){
915 920
    // silently give up
916 921
    return;
917 922
  }

Also available in: Unified diff