remove resolve lexvo on server in the api
authorymh <ymh.work@gmail.com>
Tue, 23 Feb 2016 17:57:46 +0100
changeset 128 bc18286e55b2
parent 127 5cd8c3065c38
child 129 4fca650b9b8a
remove resolve lexvo on server in the api
server/src/app/Http/Controllers/Api/DocumentController.php
server/src/app/Models/Document.php
--- a/server/src/app/Http/Controllers/Api/DocumentController.php	Tue Feb 23 17:47:57 2016 +0100
+++ b/server/src/app/Http/Controllers/Api/DocumentController.php	Tue Feb 23 17:57:46 2016 +0100
@@ -30,7 +30,7 @@
         if(array_key_exists('data', $res)) {
             $documents = $res['data'];
             unset($res['data']);
-            $res['documents'] = $this->documentRepository->resolveLexvo($documents);
+            //$res['documents'] = $this->documentRepository->resolveLexvo($documents);
         }
         return response()->json($res);
     }
@@ -65,10 +65,10 @@
     public function show($id)
     {
         $doc = $this->documentRepository->get($id);
-        $this->documentRepository->resolveLexvo([$doc,]);
         if(is_null($doc)) {
             abort(404);
         }
+        //$this->documentRepository->resolveLexvo([$doc,]);
         return response()->json(["document" => $doc]);
     }
 
--- a/server/src/app/Models/Document.php	Tue Feb 23 17:47:57 2016 +0100
+++ b/server/src/app/Models/Document.php	Tue Feb 23 17:57:46 2016 +0100
@@ -354,17 +354,22 @@
                 $this->getContributors()
             );
 
-            return [
+            $res = [
                 'id' => $this->getId(),
                 'uri' => $this->getUri(),
                 'title' => $this->getTitleValue(),
                 'language' => $this->getLanguageValue(),
-                'language_resolved' => $this->getLanguageResolved(),
                 'modified' => $this->getModifiedValue(),
                 'publishers' => $publishers,
                 'contributors' => $contributors,
                 'mediaArray'=> $mediaArray
             ];
+
+            if($this->language_resolved) {
+                $res['language_resolved'] = $this->getLanguageResolved();
+            }
+
+            return $res;
         }
     }