Exemple #1
0
 /**
  * Aktualisiert Enrichment Modell mit Werten im Formular.
  * @param Opus_Enrichment $enrichment
  */
 public function updateModel($enrichment)
 {
     $enrichment->setKeyName($this->getElementValue(self::ELEMENT_KEY_NAME));
     $enrichment->setValue($this->getElementValue(self::ELEMENT_VALUE));
 }
 public function testGetModelBadId()
 {
     $form = new Admin_Form_Document_Enrichment();
     $enrichment = new Opus_Enrichment();
     $keyNames = $enrichment->getField('KeyName')->getDefault();
     $keyName = $keyNames[1]->getName();
     // Geht davon aus, dass mindestens 2 Enrichment Keys existieren
     $form->getElement('Id')->setValue('bad');
     $form->getElement('KeyName')->setValue($keyName);
     $form->getElement('Value')->setValue('Test Enrichment Value');
     $model = $form->getModel();
     $this->assertNull($model->getId());
     $this->assertEquals($keyName, $model->getKeyName());
     $this->assertEquals('Test Enrichment Value', $model->getValue());
 }
 public function testTranslationOfOpusEnrichmentFields()
 {
     $model = new Opus_Enrichment();
     $fieldNames = $model->describe();
     foreach ($fieldNames as $name) {
         $key = $this->helper->getKeyForField('Opus_Enrichment', $name);
         $this->assertTrue($this->translate->isTranslated($key), 'Translation key \'' . $key . '\' is missing.');
     }
 }
Exemple #4
0
 private function storeEnrichmentObject($dataKey, $dataValue)
 {
     $counter = $this->getCounter($dataKey);
     if ($counter != 0) {
         //remove possible counter
         $dataKey = str_replace('_' . $counter, '', $dataKey);
     }
     $this->_log->debug("try to store " . $dataKey . " with id: " . $dataValue);
     $keyName = str_replace('Enrichment', '', $dataKey);
     $enrichment = new Opus_Enrichment();
     $enrichment->setValue($dataValue);
     $enrichment->setKeyName($keyName);
     try {
         $this->_document->addEnrichment($enrichment);
     } catch (Opus_Model_Exception $e) {
         $this->_log->err("could not add enrichment key {$keyName} with value {$dataValue} to document " . $this->_docId . " : " . $e->getMessage());
         throw new Publish_Model_Exception();
     }
 }