server/src/app/Models/DocumentBase.php
changeset 503 bd2701bd8142
parent 502 74fba571487e
equal deleted inserted replaced
502:74fba571487e 503:bd2701bd8142
    66         return $this->id;
    66         return $this->id;
    67     }
    67     }
    68 
    68 
    69     public function getCocoonId() {
    69     public function getCocoonId() {
    70         if(is_null($this->cocoonId)) {
    70         if(is_null($this->cocoonId)) {
    71             $ids = $this->getProvidedCHO()->all('<http://purl.org/dc/elements/1.1/identifier>');
    71             $this->cocoonId = CocoonUtils::getCocoonIdFromCorpusUri($this->uri);
    72             foreach ($ids as $id) {
    72             if(is_null($this->cocoonId)) {
    73                 if($id instanceof Literal && strpos($id->getValue(), config('corpusparole.cocoon_doc_id_base')) === 0) {
    73                 $ids = $this->getProvidedCHO()->all('<http://purl.org/dc/elements/1.1/identifier>');
    74                     $this->cocoonId = substr($id->getValue(), strlen(config('corpusparole.cocoon_doc_id_base')));
    74                 foreach ($ids as $id) {
       
    75                     if($id instanceof Literal && strpos($id->getValue(), config('corpusparole.cocoon_doc_id_base')) === 0) {
       
    76                         $this->cocoonId = substr($id->getValue(), strlen(config('corpusparole.cocoon_doc_id_base')));
       
    77                     }
    75                 }
    78                 }
    76             }
       
    77             if(is_null($this->cocoonId)) {
       
    78                 $this->id = CocoonUtils::getCocoonIdFromCorpusUri($this->uri);
       
    79             }
    79             }
    80         }
    80         }
    81         return $this->cocoonId;
    81         return $this->cocoonId;
    82     }
    82     }
    83 
    83