server/src/app/Models/Document.php
changeset 125 e550b10fe3ca
parent 122 b37fde30dd4a
child 128 bc18286e55b2
equal deleted inserted replaced
124:93234b0b12f3 125:e550b10fe3ca
    28 
    28 
    29     // memoization
    29     // memoization
    30     private $providedCHO = null;
    30     private $providedCHO = null;
    31     private $title = false;
    31     private $title = false;
    32     private $lang = null;
    32     private $lang = null;
       
    33     private $langResolved = null;
    33     private $publishers = null;
    34     private $publishers = null;
    34     private $mediaArray = null;
    35     private $mediaArray = null;
    35     private $issued = null;
    36     private $issued = null;
    36     private $modified = null;
    37     private $modified = null;
    37     private $contributors = null;
    38     private $contributors = null;
    45 
    46 
    46     private function clearMemoizationCache() {
    47     private function clearMemoizationCache() {
    47         $this->providedCHO = null;
    48         $this->providedCHO = null;
    48         $this->title = false;
    49         $this->title = false;
    49         $this->lang = null;
    50         $this->lang = null;
       
    51         $this->langResolved = null;
    50         $this->publishers = null;
    52         $this->publishers = null;
    51         $this->mediaArray = null;
    53         $this->mediaArray = null;
    52         $this->issued = null;
    54         $this->issued = null;
    53         $this->modified = null;
    55         $this->modified = null;
    54         $this->contributors = null;
    56         $this->contributors = null;
    90         } else if($lan instanceof Literal) {
    92         } else if($lan instanceof Literal) {
    91             return $lang->getValue();
    93             return $lang->getValue();
    92         }
    94         }
    93         return null;
    95         return null;
    94     }
    96     }
       
    97 
       
    98     public function getLanguageResolved() {
       
    99         return $this->langResolved;
       
   100     }
       
   101     public function setLanguageResolved($languageResolved) {
       
   102         $this->langResolved = $languageResolved;
       
   103     }
       
   104 
    95 
   105 
    96     public function getTitle() {
   106     public function getTitle() {
    97         if($this->title === false) {
   107         if($this->title === false) {
    98             try {
   108             try {
    99                 $this->title = $this->getProvidedCHO()->getLiteral('<http://purl.org/dc/elements/1.1/title>');
   109                 $this->title = $this->getProvidedCHO()->getLiteral('<http://purl.org/dc/elements/1.1/title>');
   347             return [
   357             return [
   348                 'id' => $this->getId(),
   358                 'id' => $this->getId(),
   349                 'uri' => $this->getUri(),
   359                 'uri' => $this->getUri(),
   350                 'title' => $this->getTitleValue(),
   360                 'title' => $this->getTitleValue(),
   351                 'language' => $this->getLanguageValue(),
   361                 'language' => $this->getLanguageValue(),
       
   362                 'language_resolved' => $this->getLanguageResolved(),
   352                 'modified' => $this->getModifiedValue(),
   363                 'modified' => $this->getModifiedValue(),
   353                 'publishers' => $publishers,
   364                 'publishers' => $publishers,
   354                 'contributors' => $contributors,
   365                 'contributors' => $contributors,
   355                 'mediaArray'=> $mediaArray
   366                 'mediaArray'=> $mediaArray
   356             ];
   367             ];