PHP Method Schema::getUri, someline-starter Code Examples

This page contains top rated real world PHP examples of method Schema::getUri from package someline-starter extracted from open source projects. You can rate examples to help us improve the quality of examples
Example #1
Show file File: ExportVocab.php Project: jonphipps/Metadata-Registry
0
    public function retrievePrefixes()
    {
        $prefixes = $this->schema->getPrefixes();
        if ('schema' === $this->type) {
            $namespaces = \SchemaPropertyElementPeer::getNamespaceList($this->schema->getId());
        } else {
            $namespaces = \VocabularyPeer::getNamespaceList($this->schema->getId());
        }
        //check the retrieved namespaces for a match to existing prefixes
        foreach ($namespaces as $uri) {
            //if we find the uri in existing schema prefixes, move on
            if ($prefixes and array_search($uri, $prefixes) !== false) {
                continue;
            }
            //look for it in Prefixes table
            $namespacePrefix = \PrefixPeer::findByUri($uri);
            if ($namespacePrefix) {
                //add it to the prefix array
                $prefixes[ $namespacePrefix->getPrefix() ] = $uri;
            } //check it against the schema token
            elseif (trim($uri, "/#") == trim($this->schema->getUri(), "#/")) {
                $prefixes[ $this->schema->getToken() ] = $uri;
            } else {
                $prefixes[ ] = $uri;
            }
        }
        if (empty($prefixes)) {
            $prefixes = $this->getDefaultPrefix();
        }

        return $prefixes;
    }
Example #2
Show file File: ImportVocab.php Project: jonphipps/Metadata-Registry
0
    public function saveResults($batchId = '')
    {
        $batchLog = new \BatchPeer();
        if ($batchId) {
            $criteria = new \Criteria();
            $criteria->add(\BatchPeer::ID, $batchId);
            /** @var $batch \Batch */
            $batch = $batchLog::doSelectOne($criteria);
        }

        if (empty( $batch )) {
            $batch = $batchLog->createBatchRecord(time(),
                                                  "manual import from file",
                                                  "schema",
                                                  "manual import (testing)",
                                                  "import",
                                                  $this->vocabId,
                                                  $this->vocabulary->getUri());
        }
        //there's a bunch more stuff we should save here
        $import = new \FileImportHistory();
        $import->setFileName($this->file);
        $import->setFileType($this->type);
        //todo $this->mapping isn't correct
        //$import->setMap($this->mapping);
        $import->setResults($this->results);
        $import->setUserId($this->userId);
        $import->setSchemaId($this->vocabId);
        $import->setBatch($batch);

        //$import->setBatch($batch);
        $import->save();

        return $batch->getId();
    }