/** * Loads a list of entries for the specicifies parameters, returns an array of Search\Backend\Data * * @return array */ public function load() { $entries = array(); $data = $this->db->fetchAll("SELECT * FROM search_backend_data" . $this->getCondition() . $this->getGroupBy() . $this->getOrder() . $this->getOffsetLimit(), $this->model->getConditionVariables()); foreach ($data as $entryData) { if ($entryData['maintype'] == 'document') { $element = Document::getById($entryData['id']); } else { if ($entryData['maintype'] == 'asset') { $element = Asset::getById($entryData['id']); } else { if ($entryData['maintype'] == 'object') { $element = Object::getById($entryData['id']); } else { \Logger::err("unknown maintype "); } } } if ($element) { $entry = new Search\Backend\Data(); $entry->setId(new Search\Backend\Data\Id($element)); $entry->setFullPath($entryData['fullpath']); $entry->setType($entryData['type']); $entry->setSubtype($entryData['subtype']); $entry->setUserOwner($entryData['userowner']); $entry->setUserModification($entryData['usermodification']); $entry->setCreationDate($entryData['creationdate']); $entry->setModificationDate($entryData['modificationdate']); $entry->setPublished($entryData['published'] === 0 ? false : true); $entries[] = $entry; } } $this->model->setEntries($entries); return $entries; }