server/src/app/Models/Document.php
author ymh <ymh.work@gmail.com>
Mon, 12 Jun 2017 14:53:59 +0200
changeset 537 d2e6ee099125
parent 520 d6adc4047ede
permissions -rw-r--r--
upgrade ember + laravel + make everything work
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
<?php
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
namespace CorpusParole\Models;
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
use Config;
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
     5
use CorpusParole\Libraries\Utils;
18
f2a40bbc27f6 add rdf mapper + merger + basic database model
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
     6
use CorpusParole\Libraries\CocoonUtils;
3
2b3247d02769 Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents: 2
diff changeset
     7
use CorpusParole\Libraries\RdfModel\RdfModelResource;
4
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 3
diff changeset
     8
use JsonSerializable;
2
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
use Log;
4
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 3
diff changeset
    10
use EasyRdf\Literal;
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 3
diff changeset
    11
use EasyRdf\Resource;
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 3
diff changeset
    12
use EasyRdf\Graph;
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 3
diff changeset
    13
use EasyRdf\Isomorphic;
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 3
diff changeset
    14
2
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
    15
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
    16
/**
4
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 3
diff changeset
    17
 * Model class for Document. Inherit from EasyRd\Resource
3
2b3247d02769 Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents: 2
diff changeset
    18
 * SELECT DISTINCT ?g WHERE {GRAPH ?g {?s ?p ?o}}
2
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
    19
 */
260
64caee7ce38d Split document model in document and document results
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
    20
class Document extends DocumentBase {
2
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
    21
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
    22
    public function __construct($uri, $graph = null) {
169
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 168
diff changeset
    23
        //                print($graph->dump('html'));
4
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 3
diff changeset
    24
        parent::__construct($uri, $graph);
2
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
    25
    }
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
    26
19
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
    27
    private $publishers = null;
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
    28
    private $mediaArray = null;
168
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents: 163
diff changeset
    29
    private $transcript = false;
28
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
    30
    private $contributors = null;
130
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 128
diff changeset
    31
    private $subjects = null;
497
f3474aeec884 add contry code in indexation, Serialize types, prepare #0025746
ymh <ymh.work@gmail.com>
parents: 377
diff changeset
    32
    private $types = null;
498
265992e5b379 Add description to documents interface and indexation. Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 497
diff changeset
    33
    private $descriptions = null;
169
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 168
diff changeset
    34
    private $geoInfo = false;
500
4f507ba2bb4c add alternativeTitle. Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 498
diff changeset
    35
    private $alternativeTitle = false;
501
7b2dcd2b31c1 add rights, Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 500
diff changeset
    36
    private $rights = false;
19
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
    37
168
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents: 163
diff changeset
    38
    protected function clearMemoizationCache() {
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents: 163
diff changeset
    39
        parent::clearMemoizationCache();
19
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
    40
        $this->publishers = null;
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
    41
        $this->mediaArray = null;
28
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
    42
        $this->contributors = null;
130
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 128
diff changeset
    43
        $this->subjects = null;
497
f3474aeec884 add contry code in indexation, Serialize types, prepare #0025746
ymh <ymh.work@gmail.com>
parents: 377
diff changeset
    44
        $this->types = null;
498
265992e5b379 Add description to documents interface and indexation. Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 497
diff changeset
    45
        $this->descriptions = null;
168
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents: 163
diff changeset
    46
        $this->transcript = false;
169
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 168
diff changeset
    47
        $this->geoInfo = false;
501
7b2dcd2b31c1 add rights, Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 500
diff changeset
    48
        $this->rights = false;
2
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
    49
    }
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
    50
277
bd4bc1db4f40 add blank node save and geoinfo to back model
ymh <ymh.work@gmail.com>
parents: 260
diff changeset
    51
    protected function additionalDeltaLists() {
bd4bc1db4f40 add blank node save and geoinfo to back model
ymh <ymh.work@gmail.com>
parents: 260
diff changeset
    52
bd4bc1db4f40 add blank node save and geoinfo to back model
ymh <ymh.work@gmail.com>
parents: 260
diff changeset
    53
        $geoInfo = $this->getGeoInfo();
bd4bc1db4f40 add blank node save and geoinfo to back model
ymh <ymh.work@gmail.com>
parents: 260
diff changeset
    54
        $geoInfoDeltas = is_null($geoInfo)?[]:$geoInfo->getDeltaList();
bd4bc1db4f40 add blank node save and geoinfo to back model
ymh <ymh.work@gmail.com>
parents: 260
diff changeset
    55
        return empty($geoInfoDeltas)?[]:[$geoInfoDeltas,];
bd4bc1db4f40 add blank node save and geoinfo to back model
ymh <ymh.work@gmail.com>
parents: 260
diff changeset
    56
    }
bd4bc1db4f40 add blank node save and geoinfo to back model
ymh <ymh.work@gmail.com>
parents: 260
diff changeset
    57
20
a9b98b16b053 add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    58
168
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents: 163
diff changeset
    59
    private function parseWebResources() {
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents: 163
diff changeset
    60
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents: 163
diff changeset
    61
        $this->mediaArray = [];
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents: 163
diff changeset
    62
        $this->transcript = null;
19
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
    63
168
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents: 163
diff changeset
    64
        $master = $this->get('<http://www.europeana.eu/schemas/edm/isShownBy>');
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents: 163
diff changeset
    65
        $masterUrl = is_null($master)?null:$master->getUri();
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents: 163
diff changeset
    66
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents: 163
diff changeset
    67
        foreach($this->graph->allOfType("<http://www.europeana.eu/schemas/edm/WebResource>") as $webResource) {
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents: 163
diff changeset
    68
            $formatLit = $webResource->getLiteral("dc11:format");
260
64caee7ce38d Split document model in document and document results
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
    69
            $format = is_null($formatLit)?null:$formatLit->getValue();
64caee7ce38d Split document model in document and document results
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
    70
            if(is_null($format)) {
64caee7ce38d Split document model in document and document results
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
    71
                throw new ModelsException("parseWebResources: No dc:11 format on web resource");
64caee7ce38d Split document model in document and document results
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
    72
            }
20
a9b98b16b053 add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
    73
260
64caee7ce38d Split document model in document and document results
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
    74
            if(0 === strpos($format, 'audio/') ||
64caee7ce38d Split document model in document and document results
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
    75
               0 === strpos($format, 'video/') ||
64caee7ce38d Split document model in document and document results
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
    76
               0 === strpos($format, 'Sampling:') ) {
64caee7ce38d Split document model in document and document results
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
    77
                array_push(
64caee7ce38d Split document model in document and document results
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
    78
                    $this->mediaArray,
64caee7ce38d Split document model in document and document results
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
    79
                    new MediaResource(
64caee7ce38d Split document model in document and document results
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
    80
                        $webResource->getUri(),
64caee7ce38d Split document model in document and document results
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
    81
                        $this->graph,
64caee7ce38d Split document model in document and document results
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
    82
                        (($webResource->getUri() === $masterUrl)?true:false))
64caee7ce38d Split document model in document and document results
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
    83
                );
64caee7ce38d Split document model in document and document results
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
    84
            } else if(
64caee7ce38d Split document model in document and document results
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
    85
                0 === strpos($format, 'application/xml') ||
64caee7ce38d Split document model in document and document results
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
    86
                0 === strpos($format, 'application/pdf') ) {
64caee7ce38d Split document model in document and document results
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
    87
                $this->transcript = new TranscriptResource($webResource->getUri(), $this->graph);
64caee7ce38d Split document model in document and document results
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
    88
            }
64caee7ce38d Split document model in document and document results
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
    89
            else {
64caee7ce38d Split document model in document and document results
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
    90
                throw new ModelsException("parseWebResources: unknown format");
64caee7ce38d Split document model in document and document results
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
    91
            }
19
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
    92
        }
2
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
    93
28
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
    94
    }
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
    95
2
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
    96
    public function getMediaArray() {
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
    97
19
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
    98
        if(is_null($this->mediaArray)) {
168
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents: 163
diff changeset
    99
            $this->parseWebResources();
4
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 3
diff changeset
   100
        }
19
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   101
        return $this->mediaArray;
2
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   102
    }
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   103
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   104
    public function getTypes() {
497
f3474aeec884 add contry code in indexation, Serialize types, prepare #0025746
ymh <ymh.work@gmail.com>
parents: 377
diff changeset
   105
        if(is_null($this->types)) {
f3474aeec884 add contry code in indexation, Serialize types, prepare #0025746
ymh <ymh.work@gmail.com>
parents: 377
diff changeset
   106
            $this->types = $this->getProvidedCHO()->all('dc11:type');
f3474aeec884 add contry code in indexation, Serialize types, prepare #0025746
ymh <ymh.work@gmail.com>
parents: 377
diff changeset
   107
        }
f3474aeec884 add contry code in indexation, Serialize types, prepare #0025746
ymh <ymh.work@gmail.com>
parents: 377
diff changeset
   108
        return $this->types;
2
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   109
    }
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   110
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   111
    public function getDiscourseTypes() {
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   112
        return array_values(array_filter($this->getTypes(), function($v) {
377
52169c718513 make all stats view use elasticsearch. Make sure that the document discourse types are taken form the predefined list
ymh <ymh.work@gmail.com>
parents: 371
diff changeset
   113
            return $v instanceof Resource
52169c718513 make all stats view use elasticsearch. Make sure that the document discourse types are taken form the predefined list
ymh <ymh.work@gmail.com>
parents: 371
diff changeset
   114
                && preg_match(config('corpusparole.bnf_ark_url_regexp'), $v->getUri())
52169c718513 make all stats view use elasticsearch. Make sure that the document discourse types are taken form the predefined list
ymh <ymh.work@gmail.com>
parents: 371
diff changeset
   115
                && array_key_exists($v->getUri(), config('corpusparole.corpus_discourse_type'));
2
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   116
        }));
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   117
    }
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   118
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   119
    public function getOtherTypes() {
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   120
        $res = array_values(array_filter($this->getTypes(), function($v) {
377
52169c718513 make all stats view use elasticsearch. Make sure that the document discourse types are taken form the predefined list
ymh <ymh.work@gmail.com>
parents: 371
diff changeset
   121
            return !($v instanceof Resource)
52169c718513 make all stats view use elasticsearch. Make sure that the document discourse types are taken form the predefined list
ymh <ymh.work@gmail.com>
parents: 371
diff changeset
   122
                || !preg_match(config('corpusparole.bnf_ark_url_regexp'), $v->getUri())
52169c718513 make all stats view use elasticsearch. Make sure that the document discourse types are taken form the predefined list
ymh <ymh.work@gmail.com>
parents: 371
diff changeset
   123
                || !array_key_exists($v->getUri(), config('corpusparole.corpus_discourse_type'));
2
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   124
        }));
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   125
        return $res;
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   126
    }
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   127
163
59c68fc4848e Add transcript api endpoint
ymh <ymh.work@gmail.com>
parents: 145
diff changeset
   128
    public function getTranscript() {
168
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents: 163
diff changeset
   129
        if($this->transcript === false) {
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents: 163
diff changeset
   130
            $this->parseWebResources();
163
59c68fc4848e Add transcript api endpoint
ymh <ymh.work@gmail.com>
parents: 145
diff changeset
   131
        }
168
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents: 163
diff changeset
   132
        return $this->transcript;
163
59c68fc4848e Add transcript api endpoint
ymh <ymh.work@gmail.com>
parents: 145
diff changeset
   133
    }
59c68fc4848e Add transcript api endpoint
ymh <ymh.work@gmail.com>
parents: 145
diff changeset
   134
20
a9b98b16b053 add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   135
    public function getContributors() {
28
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   136
        if(is_null($this->contributors)) {
520
d6adc4047ede Add creator in participants, resolve #0026453
ymh <ymh.work@gmail.com>
parents: 501
diff changeset
   137
            $roleList = CocoonUtils::OLAC_ROLES;
d6adc4047ede Add creator in participants, resolve #0026453
ymh <ymh.work@gmail.com>
parents: 501
diff changeset
   138
            array_push($roleList, 'http://purl.org/dc/elements/1.1/creator');
28
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   139
            $this->contributors = array_reduce(
520
d6adc4047ede Add creator in participants, resolve #0026453
ymh <ymh.work@gmail.com>
parents: 501
diff changeset
   140
                $roleList,
28
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   141
                function($res, $olacRole) {
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   142
                    return array_merge(
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   143
                        $res,
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   144
                        array_map(
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   145
                            function($olacValue) use ($olacRole) {
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   146
                                return [
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   147
                                    'name' => ($olacValue instanceof Literal)?$olacValue->getValue():null,
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   148
                                    'nameLiteral' => ($olacValue instanceof Literal)?$olacValue:null,
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   149
                                    'url' => ($olacValue instanceof Resource)?$olacValue->getUri():null,
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   150
                                    'role' => $olacRole
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   151
                                ];
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   152
                            },
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   153
                            $this->getProvidedCHO()->all("<$olacRole>")
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   154
                        )
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   155
                    );
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   156
                },
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   157
                []
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   158
            );
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   159
        }
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   160
        return $this->contributors;
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   161
    }
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   162
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   163
    /**
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   164
     * change contributors list
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   165
     */
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   166
    public function setContributors($contributors) {
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   167
        $delta = $this->startDelta();
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   168
        //remove old,
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   169
        foreach ($this->getContributors() as $contribDef) {
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   170
            $value = null;
145
49b75287c30b correct backoffocie with new handle if format
ymh <ymh.work@gmail.com>
parents: 141
diff changeset
   171
            if (empty($contribDef['url'])) {
49b75287c30b correct backoffocie with new handle if format
ymh <ymh.work@gmail.com>
parents: 141
diff changeset
   172
                if(empty($contribDef['nameLiteral'])) {
28
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   173
                    $value = new Literal($contribDef['name']);
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   174
                } else {
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   175
                    $value = $contribDef['nameLiteral'];
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   176
                }
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   177
            } else {
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   178
                $value = new Resource($contribDef['url']);
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   179
            }
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   180
            $this->getProvidedCHO()->delete($contribDef['role'], $value);
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   181
            $delta->getDeletedGraph()->add($this->getProvidedCHO(), $contribDef['role'], $value);
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   182
        }
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   183
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   184
        //put new
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   185
        foreach ($contributors as $newContribDef) {
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   186
            $value = null;
145
49b75287c30b correct backoffocie with new handle if format
ymh <ymh.work@gmail.com>
parents: 141
diff changeset
   187
            if (empty($newContribDef['url'])) {
28
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   188
                $value = new Literal($newContribDef['name'], "fr", null);
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   189
            } else {
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   190
                $value = new Resource($newContribDef['url']);
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   191
            }
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   192
            $this->getProvidedCHO()->add($newContribDef['role'], $value);
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   193
            $delta->getAddedGraph()->add($this->getProvidedCHO(), $newContribDef['role'], $value);
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   194
        }
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   195
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   196
        $this->contributors = null;
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   197
20
a9b98b16b053 add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   198
    }
a9b98b16b053 add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents: 19
diff changeset
   199
19
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   200
    /**
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   201
     * change discourse type list
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   202
     */
2
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   203
    public function updateDiscourseTypes(array $discoursesTypes) {
3
2b3247d02769 Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents: 2
diff changeset
   204
2b3247d02769 Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents: 2
diff changeset
   205
        $this->startDelta();
2b3247d02769 Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents: 2
diff changeset
   206
19
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   207
        //delete
2
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   208
        foreach($this->getDiscourseTypes() as $discourseType) {
371
0365fd9977a4 Discourse types are now bnf ark resources
ymh <ymh.work@gmail.com>
parents: 277
diff changeset
   209
            $this->getProvidedCHO()->delete('dc11:type', $discourseType);
0365fd9977a4 Discourse types are now bnf ark resources
ymh <ymh.work@gmail.com>
parents: 277
diff changeset
   210
            $this->currentDelta->getDeletedGraph()->addResource($this->getProvidedCHO(), 'dc11:type', $discourseType->getUri());
2
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   211
        }
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   212
19
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   213
        // and re-add them
2
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   214
        foreach($discoursesTypes as $dType) {
371
0365fd9977a4 Discourse types are now bnf ark resources
ymh <ymh.work@gmail.com>
parents: 277
diff changeset
   215
            $this->getProvidedCHO()->addResource('dc11:type', $dType);
0365fd9977a4 Discourse types are now bnf ark resources
ymh <ymh.work@gmail.com>
parents: 277
diff changeset
   216
            $this->currentDelta->getAddedGraph()->addResource($this->getProvidedCHO(), 'dc11:type', $dType);
2
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   217
        }
19
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   218
eadaf0b8f02e Bo conception step. back to ember page
ymh <ymh.work@gmail.com>
parents: 18
diff changeset
   219
        $this->clearMemoizationCache();
2
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   220
    }
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   221
130
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 128
diff changeset
   222
    /**
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 128
diff changeset
   223
     * Get subjects list
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 128
diff changeset
   224
     */
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 128
diff changeset
   225
    public function getSubjects() {
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 128
diff changeset
   226
        if(is_null($this->subjects)) {
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 128
diff changeset
   227
            $this->subjects = $this->getProvidedCHO()->all('<http://purl.org/dc/elements/1.1/subject>');
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 128
diff changeset
   228
        }
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 128
diff changeset
   229
        return $this->subjects;
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 128
diff changeset
   230
    }
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 128
diff changeset
   231
138
3079cbf80006 add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents: 130
diff changeset
   232
    /**
277
bd4bc1db4f40 add blank node save and geoinfo to back model
ymh <ymh.work@gmail.com>
parents: 260
diff changeset
   233
     * get the GeoInfoObject
bd4bc1db4f40 add blank node save and geoinfo to back model
ymh <ymh.work@gmail.com>
parents: 260
diff changeset
   234
     * Ths returned object should be limited for read only activities.
bd4bc1db4f40 add blank node save and geoinfo to back model
ymh <ymh.work@gmail.com>
parents: 260
diff changeset
   235
     * If it needs to be edited use the addGeoInfo method.
169
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 168
diff changeset
   236
     */
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 168
diff changeset
   237
    public function getGeoInfo() {
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 168
diff changeset
   238
        if($this->geoInfo === false) {
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 168
diff changeset
   239
            $places = $this->getProvidedCHO()->all('<http://purl.org/dc/terms/spatial>');
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 168
diff changeset
   240
            $this->geoInfo = null;
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 168
diff changeset
   241
            if($places) {
277
bd4bc1db4f40 add blank node save and geoinfo to back model
ymh <ymh.work@gmail.com>
parents: 260
diff changeset
   242
                $this->geoInfo = new GeoResource($places[0]->getUri(), $this->graph, $this->getProvidedCHO());
169
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 168
diff changeset
   243
            }
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 168
diff changeset
   244
        }
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 168
diff changeset
   245
        return $this->geoInfo;
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 168
diff changeset
   246
    }
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 168
diff changeset
   247
277
bd4bc1db4f40 add blank node save and geoinfo to back model
ymh <ymh.work@gmail.com>
parents: 260
diff changeset
   248
    public function addGeoInfo() {
bd4bc1db4f40 add blank node save and geoinfo to back model
ymh <ymh.work@gmail.com>
parents: 260
diff changeset
   249
        $geoInfo = $this->getGeoInfo();
bd4bc1db4f40 add blank node save and geoinfo to back model
ymh <ymh.work@gmail.com>
parents: 260
diff changeset
   250
        if(!is_null($geoInfo)) {
bd4bc1db4f40 add blank node save and geoinfo to back model
ymh <ymh.work@gmail.com>
parents: 260
diff changeset
   251
            // if there already is a geo info, just return it.
bd4bc1db4f40 add blank node save and geoinfo to back model
ymh <ymh.work@gmail.com>
parents: 260
diff changeset
   252
            $geoInfo->setReadOnly(false);
bd4bc1db4f40 add blank node save and geoinfo to back model
ymh <ymh.work@gmail.com>
parents: 260
diff changeset
   253
            $geoInfo->setNeedDelete(true);
bd4bc1db4f40 add blank node save and geoinfo to back model
ymh <ymh.work@gmail.com>
parents: 260
diff changeset
   254
            return $geoInfo;
bd4bc1db4f40 add blank node save and geoinfo to back model
ymh <ymh.work@gmail.com>
parents: 260
diff changeset
   255
         }
bd4bc1db4f40 add blank node save and geoinfo to back model
ymh <ymh.work@gmail.com>
parents: 260
diff changeset
   256
bd4bc1db4f40 add blank node save and geoinfo to back model
ymh <ymh.work@gmail.com>
parents: 260
diff changeset
   257
        $this->geoInfo = false;
bd4bc1db4f40 add blank node save and geoinfo to back model
ymh <ymh.work@gmail.com>
parents: 260
diff changeset
   258
bd4bc1db4f40 add blank node save and geoinfo to back model
ymh <ymh.work@gmail.com>
parents: 260
diff changeset
   259
        $geoinfoNode = $this->getGraph()->newBNode("http://www.europeana.eu/schemas/edm/Place");
bd4bc1db4f40 add blank node save and geoinfo to back model
ymh <ymh.work@gmail.com>
parents: 260
diff changeset
   260
        $this->getProvidedCHO()->addResource("http://purl.org/dc/terms/spatial", $geoinfoNode);
bd4bc1db4f40 add blank node save and geoinfo to back model
ymh <ymh.work@gmail.com>
parents: 260
diff changeset
   261
bd4bc1db4f40 add blank node save and geoinfo to back model
ymh <ymh.work@gmail.com>
parents: 260
diff changeset
   262
        $this->geoInfo = new GeoResource($geoinfoNode->getUri(), $this->graph, $this->getProvidedCHO());
bd4bc1db4f40 add blank node save and geoinfo to back model
ymh <ymh.work@gmail.com>
parents: 260
diff changeset
   263
        $this->geoInfo->setReadOnly(false);
bd4bc1db4f40 add blank node save and geoinfo to back model
ymh <ymh.work@gmail.com>
parents: 260
diff changeset
   264
        $this->geoInfo->setNeedDelete(false);
bd4bc1db4f40 add blank node save and geoinfo to back model
ymh <ymh.work@gmail.com>
parents: 260
diff changeset
   265
bd4bc1db4f40 add blank node save and geoinfo to back model
ymh <ymh.work@gmail.com>
parents: 260
diff changeset
   266
        return $this->geoInfo;
bd4bc1db4f40 add blank node save and geoinfo to back model
ymh <ymh.work@gmail.com>
parents: 260
diff changeset
   267
    }
bd4bc1db4f40 add blank node save and geoinfo to back model
ymh <ymh.work@gmail.com>
parents: 260
diff changeset
   268
169
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 168
diff changeset
   269
    /**
138
3079cbf80006 add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents: 130
diff changeset
   270
     * change subjecs list
3079cbf80006 add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents: 130
diff changeset
   271
     */
3079cbf80006 add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents: 130
diff changeset
   272
    public function setSubjects($subjects) {
3079cbf80006 add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents: 130
diff changeset
   273
        $delta = $this->startDelta();
3079cbf80006 add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents: 130
diff changeset
   274
        //remove old,
3079cbf80006 add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents: 130
diff changeset
   275
        foreach ($this->getSubjects() as $subject) {
3079cbf80006 add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents: 130
diff changeset
   276
            $this->getProvidedCHO()->delete('<http://purl.org/dc/elements/1.1/subject>', $subject);
3079cbf80006 add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents: 130
diff changeset
   277
            $delta->getDeletedGraph()->add($this->getProvidedCHO(), 'http://purl.org/dc/elements/1.1/subject', $subject);
3079cbf80006 add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents: 130
diff changeset
   278
        }
3079cbf80006 add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents: 130
diff changeset
   279
3079cbf80006 add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents: 130
diff changeset
   280
        //put new
3079cbf80006 add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents: 130
diff changeset
   281
        foreach ($subjects as $newSubject) {
3079cbf80006 add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents: 130
diff changeset
   282
            $value = null;
141
c0e8626a271c literal are now objects if one of lang or datatype is not null
ymh <ymh.work@gmail.com>
parents: 138
diff changeset
   283
            if(is_string($newSubject) && filter_var($newSubject, FILTER_VALIDATE_URL)) {
138
3079cbf80006 add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents: 130
diff changeset
   284
                $value = new Resource($newSubject);
3079cbf80006 add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents: 130
diff changeset
   285
            }
141
c0e8626a271c literal are now objects if one of lang or datatype is not null
ymh <ymh.work@gmail.com>
parents: 138
diff changeset
   286
            elseif (is_string($newSubject)) {
c0e8626a271c literal are now objects if one of lang or datatype is not null
ymh <ymh.work@gmail.com>
parents: 138
diff changeset
   287
                $value = new Literal($newSubject, null, null);
c0e8626a271c literal are now objects if one of lang or datatype is not null
ymh <ymh.work@gmail.com>
parents: 138
diff changeset
   288
            } elseif(is_array($newSubject)) {
c0e8626a271c literal are now objects if one of lang or datatype is not null
ymh <ymh.work@gmail.com>
parents: 138
diff changeset
   289
                $value = new Literal(isset($newSubject['value'])?$newSubject['value']:null, isset($newSubject['lang'])?$newSubject['lang']:null, isset($newSubject['datatype'])?$newSubject['value']:null);
138
3079cbf80006 add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents: 130
diff changeset
   290
            }
3079cbf80006 add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents: 130
diff changeset
   291
3079cbf80006 add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents: 130
diff changeset
   292
            $this->getProvidedCHO()->add('http://purl.org/dc/elements/1.1/subject', $value);
3079cbf80006 add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents: 130
diff changeset
   293
            $delta->getAddedGraph()->add($this->getProvidedCHO(), 'http://purl.org/dc/elements/1.1/subject', $value);
3079cbf80006 add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents: 130
diff changeset
   294
        }
3079cbf80006 add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents: 130
diff changeset
   295
3079cbf80006 add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents: 130
diff changeset
   296
        $this->subjects = null;
3079cbf80006 add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents: 130
diff changeset
   297
3079cbf80006 add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents: 130
diff changeset
   298
    }
3079cbf80006 add subjects save + set modified date when saing document in rest api
ymh <ymh.work@gmail.com>
parents: 130
diff changeset
   299
260
64caee7ce38d Split document model in document and document results
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   300
    public function getPublishers() {
64caee7ce38d Split document model in document and document results
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   301
        if(is_null($this->publishers)) {
64caee7ce38d Split document model in document and document results
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   302
            try {
64caee7ce38d Split document model in document and document results
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   303
                $this->publishers = $this->getProvidedCHO()->all('dc11:publisher');
64caee7ce38d Split document model in document and document results
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   304
            } catch(\Exception $e) {
64caee7ce38d Split document model in document and document results
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   305
               $this->publishers = [];
64caee7ce38d Split document model in document and document results
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   306
            }
64caee7ce38d Split document model in document and document results
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   307
        }
64caee7ce38d Split document model in document and document results
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   308
        return $this->publishers;
64caee7ce38d Split document model in document and document results
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   309
    }
64caee7ce38d Split document model in document and document results
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   310
64caee7ce38d Split document model in document and document results
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   311
    public function getPublishersValues() {
64caee7ce38d Split document model in document and document results
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   312
        $publishers = $this->getPublishers();
64caee7ce38d Split document model in document and document results
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   313
        return array_map(
64caee7ce38d Split document model in document and document results
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   314
            function($v) { return Utils::processLiteralResourceOrString($v); },
64caee7ce38d Split document model in document and document results
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   315
            $this->getPublishers()
64caee7ce38d Split document model in document and document results
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   316
        );
64caee7ce38d Split document model in document and document results
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   317
    }
64caee7ce38d Split document model in document and document results
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   318
64caee7ce38d Split document model in document and document results
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   319
498
265992e5b379 Add description to documents interface and indexation. Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 497
diff changeset
   320
    /**
500
4f507ba2bb4c add alternativeTitle. Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 498
diff changeset
   321
     * Get descriptions
498
265992e5b379 Add description to documents interface and indexation. Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 497
diff changeset
   322
     */
265992e5b379 Add description to documents interface and indexation. Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 497
diff changeset
   323
    public function getDescriptions() {
265992e5b379 Add description to documents interface and indexation. Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 497
diff changeset
   324
        if(is_null($this->descriptions)) {
265992e5b379 Add description to documents interface and indexation. Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 497
diff changeset
   325
            $this->descriptions = [];
265992e5b379 Add description to documents interface and indexation. Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 497
diff changeset
   326
            $this->descriptions = array_merge($this->descriptions, $this->getProvidedCHO()->all('<http://purl.org/dc/elements/1.1/description>'));
265992e5b379 Add description to documents interface and indexation. Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 497
diff changeset
   327
            $this->descriptions = array_merge($this->descriptions, $this->getProvidedCHO()->all('<http://purl.org/dc/terms/abstract>'));
265992e5b379 Add description to documents interface and indexation. Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 497
diff changeset
   328
            $this->descriptions = array_merge($this->descriptions, $this->getProvidedCHO()->all('<http://purl.org/dc/terms/tableOfContents>'));
265992e5b379 Add description to documents interface and indexation. Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 497
diff changeset
   329
        }
265992e5b379 Add description to documents interface and indexation. Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 497
diff changeset
   330
        return $this->descriptions;
265992e5b379 Add description to documents interface and indexation. Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 497
diff changeset
   331
    }
265992e5b379 Add description to documents interface and indexation. Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 497
diff changeset
   332
500
4f507ba2bb4c add alternativeTitle. Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 498
diff changeset
   333
    /**
4f507ba2bb4c add alternativeTitle. Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 498
diff changeset
   334
     * Get Alternative Title
4f507ba2bb4c add alternativeTitle. Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 498
diff changeset
   335
     */
4f507ba2bb4c add alternativeTitle. Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 498
diff changeset
   336
    public function getAlternativeTitle() {
4f507ba2bb4c add alternativeTitle. Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 498
diff changeset
   337
        if($this->alternativeTitle === false) {
4f507ba2bb4c add alternativeTitle. Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 498
diff changeset
   338
            try {
4f507ba2bb4c add alternativeTitle. Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 498
diff changeset
   339
                $this->alternativeTitle = $this->getProvidedCHO()->getLiteral('<http://purl.org/dc/terms/alternative>');
4f507ba2bb4c add alternativeTitle. Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 498
diff changeset
   340
            } catch(\Exception $e) {
4f507ba2bb4c add alternativeTitle. Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 498
diff changeset
   341
                $this->alternativeTitle = null;
4f507ba2bb4c add alternativeTitle. Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 498
diff changeset
   342
            }
4f507ba2bb4c add alternativeTitle. Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 498
diff changeset
   343
        }
4f507ba2bb4c add alternativeTitle. Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 498
diff changeset
   344
        return $this->alternativeTitle;
4f507ba2bb4c add alternativeTitle. Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 498
diff changeset
   345
    }
4f507ba2bb4c add alternativeTitle. Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 498
diff changeset
   346
4f507ba2bb4c add alternativeTitle. Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 498
diff changeset
   347
    public function getAlternativeTitleValue() {
4f507ba2bb4c add alternativeTitle. Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 498
diff changeset
   348
        $alternativeTitle = $this->getAlternativeTitle();
4f507ba2bb4c add alternativeTitle. Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 498
diff changeset
   349
        return is_null($alternativeTitle)?null:$alternativeTitle->getValue();
4f507ba2bb4c add alternativeTitle. Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 498
diff changeset
   350
    }
260
64caee7ce38d Split document model in document and document results
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   351
501
7b2dcd2b31c1 add rights, Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 500
diff changeset
   352
7b2dcd2b31c1 add rights, Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 500
diff changeset
   353
    /**
7b2dcd2b31c1 add rights, Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 500
diff changeset
   354
     * Get Rights
7b2dcd2b31c1 add rights, Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 500
diff changeset
   355
     */
7b2dcd2b31c1 add rights, Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 500
diff changeset
   356
    public function getRights() {
7b2dcd2b31c1 add rights, Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 500
diff changeset
   357
        if($this->rights === false) {
7b2dcd2b31c1 add rights, Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 500
diff changeset
   358
            try {
7b2dcd2b31c1 add rights, Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 500
diff changeset
   359
                $this->rights = $this->getResource('<http://www.europeana.eu/schemas/edm/rights>');
7b2dcd2b31c1 add rights, Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 500
diff changeset
   360
            } catch(\Exception $e) {
7b2dcd2b31c1 add rights, Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 500
diff changeset
   361
                $this->rights = null;
7b2dcd2b31c1 add rights, Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 500
diff changeset
   362
            }
7b2dcd2b31c1 add rights, Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 500
diff changeset
   363
        }
7b2dcd2b31c1 add rights, Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 500
diff changeset
   364
        return $this->rights;
7b2dcd2b31c1 add rights, Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 500
diff changeset
   365
    }
7b2dcd2b31c1 add rights, Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 500
diff changeset
   366
7b2dcd2b31c1 add rights, Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 500
diff changeset
   367
    public function getRightsValue() {
7b2dcd2b31c1 add rights, Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 500
diff changeset
   368
        $rights = $this->getRights();
7b2dcd2b31c1 add rights, Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 500
diff changeset
   369
        return is_null($rights)?null:$rights->getUri();
7b2dcd2b31c1 add rights, Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 500
diff changeset
   370
    }
7b2dcd2b31c1 add rights, Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 500
diff changeset
   371
2
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   372
    public function isIsomorphic($doc) {
4
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 3
diff changeset
   373
        return Isomorphic::isomorphic($this->graph, $doc->graph);
2
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   374
    }
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   375
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   376
    /*
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   377
     * Clone document.
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   378
     * clone also the innerDocumenent
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   379
     */
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   380
    public function __clone() {
168
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents: 163
diff changeset
   381
        if(!is_null($this->graph)) {
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents: 163
diff changeset
   382
            $this->graph = new Graph($this->graph->getUri(), $this->graph->toRdfPhp());
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents: 163
diff changeset
   383
        }
4
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 3
diff changeset
   384
    }
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 3
diff changeset
   385
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 3
diff changeset
   386
    public function jsonSerialize() {
168
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents: 163
diff changeset
   387
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents: 163
diff changeset
   388
        $res = parent::jsonSerialize();
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents: 163
diff changeset
   389
        if($this->graph) {
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents: 163
diff changeset
   390
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents: 163
diff changeset
   391
            $mediaArray =  is_null($this->getMediaArray())?
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents: 163
diff changeset
   392
                        null:
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents: 163
diff changeset
   393
                        array_combine(
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents: 163
diff changeset
   394
                            array_map(function($m) { return $m->getUrl(); }, $this->getMediaArray()),
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents: 163
diff changeset
   395
                            array_map(
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents: 163
diff changeset
   396
                                function($m) {
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents: 163
diff changeset
   397
                                    return $m->jsonSerialize();},
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents: 163
diff changeset
   398
                                $this->getMediaArray()
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents: 163
diff changeset
   399
                            )
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents: 163
diff changeset
   400
                        );
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents: 163
diff changeset
   401
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents: 163
diff changeset
   402
            $transcript = is_null($this->getTranscript())?null:$this->getTranscript()->jsonSerialize();
169
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 168
diff changeset
   403
            $geoInfo = is_null($this->getGeoInfo())?null:$this->getGeoInfo()->jsonSerialize();
4
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 3
diff changeset
   404
260
64caee7ce38d Split document model in document and document results
ymh <ymh.work@gmail.com>
parents: 169
diff changeset
   405
            $publishers = $this->getPublishersValues();
4
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 3
diff changeset
   406
28
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   407
            $contributors = array_map(
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   408
                function($c) { unset($c['nameLiteral']); return $c; },
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   409
                $this->getContributors()
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   410
            );
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   411
130
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 128
diff changeset
   412
            $subjects = array_map(
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 128
diff changeset
   413
                function($s) { return Utils::processLiteralResourceOrString($s); },
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 128
diff changeset
   414
                $this->getSubjects()
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 128
diff changeset
   415
            );
497
f3474aeec884 add contry code in indexation, Serialize types, prepare #0025746
ymh <ymh.work@gmail.com>
parents: 377
diff changeset
   416
            $types = array_map(
f3474aeec884 add contry code in indexation, Serialize types, prepare #0025746
ymh <ymh.work@gmail.com>
parents: 377
diff changeset
   417
                function($s) { return Utils::processLiteralResourceOrString($s); },
f3474aeec884 add contry code in indexation, Serialize types, prepare #0025746
ymh <ymh.work@gmail.com>
parents: 377
diff changeset
   418
                $this->getTypes()
f3474aeec884 add contry code in indexation, Serialize types, prepare #0025746
ymh <ymh.work@gmail.com>
parents: 377
diff changeset
   419
            );
498
265992e5b379 Add description to documents interface and indexation. Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 497
diff changeset
   420
            $descriptions = array_map(
265992e5b379 Add description to documents interface and indexation. Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 497
diff changeset
   421
                function($s) { return Utils::processLiteralResourceOrString($s); },
265992e5b379 Add description to documents interface and indexation. Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 497
diff changeset
   422
                $this->getDescriptions()
265992e5b379 Add description to documents interface and indexation. Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 497
diff changeset
   423
            );
130
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 128
diff changeset
   424
168
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents: 163
diff changeset
   425
            $res = array_merge($res, [
4
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 3
diff changeset
   426
                'publishers' => $publishers,
28
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
   427
                'contributors' => $contributors,
130
fac22d8c2df8 add subjects to model + simple display on bo + add command to downloads documents to fixtures for test
ymh <ymh.work@gmail.com>
parents: 128
diff changeset
   428
                'subjects' => $subjects,
497
f3474aeec884 add contry code in indexation, Serialize types, prepare #0025746
ymh <ymh.work@gmail.com>
parents: 377
diff changeset
   429
                'types' => $types,
168
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents: 163
diff changeset
   430
                'transcript' => $transcript,
169
8fddc113095e Correct proble on geo info merging + add geo resource
ymh <ymh.work@gmail.com>
parents: 168
diff changeset
   431
                'mediaArray'=> $mediaArray,
498
265992e5b379 Add description to documents interface and indexation. Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 497
diff changeset
   432
                'geoInfo' => $geoInfo,
500
4f507ba2bb4c add alternativeTitle. Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 498
diff changeset
   433
                'descriptions' => $descriptions,
4f507ba2bb4c add alternativeTitle. Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 498
diff changeset
   434
                'alternativeTitle' => $this->getAlternativeTitleValue(),
501
7b2dcd2b31c1 add rights, Prepare #0025746
ymh <ymh.work@gmail.com>
parents: 500
diff changeset
   435
                'rights' => $this->getRightsValue()
168
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents: 163
diff changeset
   436
            ]);
128
bc18286e55b2 remove resolve lexvo on server in the api
ymh <ymh.work@gmail.com>
parents: 125
diff changeset
   437
168
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents: 163
diff changeset
   438
        }
17f10b56c079 improve document model and propagate changes. This include the change of document fixtures to better reflect what the api is effectively returning
ymh <ymh.work@gmail.com>
parents: 163
diff changeset
   439
        return $res;
128
bc18286e55b2 remove resolve lexvo on server in the api
ymh <ymh.work@gmail.com>
parents: 125
diff changeset
   440
2
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   441
    }
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   442
00e2916104fe Migrate to php 5.6 + Laravel 5.1 + add phpunit test
ymh <ymh.work@gmail.com>
parents:
diff changeset
   443
}