Пример #1
0
 /**
  * Allows us to overload parent offsetGet with getTitle(), getText(), etc.
  * This is good when using $result->toArray()
  * @see Solarium_Document_ReadOnly::offsetGet()
  */
 public function offsetGet($key)
 {
     $value = null;
     $keyParts = explode('_', $key);
     $nolangKey = reset($keyParts);
     switch ($nolangKey) {
         case 'title':
             $value = $this->getTitle();
             break;
         case 'text':
             $value = $this->getText();
             break;
         case 'videoViews':
             $value = $this->getVideoViews();
             break;
         default:
             $value = parent::offsetGet(Utilities::field($nolangKey));
             // e.g. infoboxes_txt
             if (empty($value)) {
                 $value = parent::offsetGet($key);
             }
     }
     return $value;
 }