/** * Check if a document in a specific xml version is already cached or not. * * @param mixed $documentId * @param mixed $xmlVersion * @param mixed $serverDateModified * @return bool Returns true on cached hit else false. */ public function hasValidEntry($documentId, $xmlVersion, $serverDateModified) { $select = $this->_table->select()->from($this->_table); $select->where('document_id = ?', $documentId)->where('xml_version = ?', $xmlVersion)->where('server_date_modified = ?', $serverDateModified); $row = $this->_table->fetchRow($select); if (null === $row) { $result = false; } else { $result = true; } return $result; }
/** * Returns a list of documents from cache. * @param $resultIds ids of documents for export * @return array Map of docId to Document XML */ private function getDocumentsFromCache($documentIds) { $documents = array(); $documentCacheTable = new Opus_Db_DocumentXmlCache(); $docXmlCache = $documentCacheTable->fetchAll($documentCacheTable->select()->where('document_id IN (?)', $documentIds)); //->find($this->document->getId(), '1')->current()->xml_data; foreach ($docXmlCache as $row) { $fragment = new DomDocument(); $fragment->loadXML($row->xml_data); $node = $fragment->getElementsByTagName('Opus_Document')->item(0); $documents[$row->document_id] = $node; } return $documents; }