protected function mapInformationObject($parameters) { // NB: any value for publication status means set to published if (!empty($parameters['publicationStatus'])) { $parameters['publicationStatus'] = QubitTerm::PUBLICATION_STATUS_PUBLISHED_ID; } if (!empty($parameters['repository'])) { $repo = QubitRepository::getByAuthorizedFormOfName($parameters['repository']); // if the repository does not exist, create it if (empty($repo)) { $repo = new QubitRepository(); $repo->authorizedFormOfName = $parameters['repository']; $repo->save(); } $parameters['repository'] = $this->context->routing->generate(null, array($repo, 'module' => 'repository')); } // subject access points if (!isset($this->subjects)) { foreach (QubitTerm::getSubjects() as $term) { $this->subjects[$term->__toString()] = $term; } } $n = 0; foreach (explode('|', $parameters['subjectAccessPoints']) as $new_subjectAccessPoint) { if (0 == strlen(trim($new_subjectAccessPoint))) { continue; } // if the subject does not exist, create it if (!in_array($new_subjectAccessPoint, $this->subjects) && !empty($new_subjectAccessPoint)) { $subject = new QubitTerm(); $subject->taxonomyId = QubitTaxonomy::SUBJECT_ID; $subject->name = $new_subjectAccessPoint; $subject->save(); $this->subjects[$subject->__toString()] = $subject; } $new_subjectAccessPoints['new' . $n] = $this->context->routing->generate(null, array($this->subjects[$new_subjectAccessPoint], 'module' => 'term')); $n++; } $parameters['subjectAccessPoints'] = $new_subjectAccessPoints; // place access points if (!isset($this->places)) { foreach (QubitTerm::getPlaces() as $term) { $this->places[$term->__toString()] = $term; } } $n = 0; foreach (explode('|', $parameters['placeAccessPoints']) as $new_placeAccessPoint) { if (0 == strlen(trim($new_placeAccessPoint))) { continue; } // if the place does not exist, create it if (!in_array($new_placeAccessPoint, $this->places) && !empty($new_placeAccessPoint)) { $place = new QubitTerm(); $place->taxonomyId = QubitTaxonomy::PLACE_ID; $place->name = $new_placeAccessPoint; $place->save(); $this->places[$place->__toString()] = $place; } $new_placeAccessPoints['new' . $n] = $this->context->routing->generate(null, array($this->places[$new_placeAccessPoint], 'module' => 'term')); $n++; } $parameters['placeAccessPoints'] = $new_placeAccessPoints; // name access points $n = 0; $this->getActors(); foreach (explode('|', $parameters['nameAccessPoints']) as $new_nameAccessPoint) { if (0 == strlen(trim($new_nameAccessPoint))) { continue; } // if the name does not exist, create it if (!isset($this->actors[$new_nameAccessPoint])) { $name = new QubitActor(); $name->authorizedFormOfName = $new_nameAccessPoint; $name->save(); $this->actors[$name->__toString()] = $name; } $new_nameAccessPoints['new' . $n] = $this->context->routing->generate(null, array($this->actors[$new_nameAccessPoint], 'module' => 'actor')); $n++; } $parameters['nameAccessPoints'] = $new_nameAccessPoints; return $parameters; }