Do not get cocoonId from identifier but from graph url
authorymh <ymh.work@gmail.com>
Wed, 08 Feb 2017 16:38:09 +0100
changeset 503 bd2701bd8142
parent 502 74fba571487e
child 504 4ab820b387da
Do not get cocoonId from identifier but from graph url
server/src/app/Models/DocumentBase.php
--- a/server/src/app/Models/DocumentBase.php	Wed Feb 08 15:25:24 2017 +0100
+++ b/server/src/app/Models/DocumentBase.php	Wed Feb 08 16:38:09 2017 +0100
@@ -68,15 +68,15 @@
 
     public function getCocoonId() {
         if(is_null($this->cocoonId)) {
-            $ids = $this->getProvidedCHO()->all('<http://purl.org/dc/elements/1.1/identifier>');
-            foreach ($ids as $id) {
-                if($id instanceof Literal && strpos($id->getValue(), config('corpusparole.cocoon_doc_id_base')) === 0) {
-                    $this->cocoonId = substr($id->getValue(), strlen(config('corpusparole.cocoon_doc_id_base')));
+            $this->cocoonId = CocoonUtils::getCocoonIdFromCorpusUri($this->uri);
+            if(is_null($this->cocoonId)) {
+                $ids = $this->getProvidedCHO()->all('<http://purl.org/dc/elements/1.1/identifier>');
+                foreach ($ids as $id) {
+                    if($id instanceof Literal && strpos($id->getValue(), config('corpusparole.cocoon_doc_id_base')) === 0) {
+                        $this->cocoonId = substr($id->getValue(), strlen(config('corpusparole.cocoon_doc_id_base')));
+                    }
                 }
             }
-            if(is_null($this->cocoonId)) {
-                $this->id = CocoonUtils::getCocoonIdFromCorpusUri($this->uri);
-            }
         }
         return $this->cocoonId;
     }