private function hydrateRowContainer($rowContainer) { if (is_array($this->currentFilter->getPairs())) { return $rowContainer; } if ($this->currentFilter->isFind()) { $rows = []; foreach ($rowContainer as $row) { $rows[] = $this->hydrateRow($row); } return $rows; } if ($this->currentFilter->isGet()) { return $this->hydrateRow($rowContainer); } throw new StorageException('Can\'not determine hydratation mode.'); }
public function find(IFileFilter $filter) { $this->currentFilter = $filter; $filterType = $filter->getFilterType(); $filterValue = $filter->getFilterValue(); $pairs = $filter->getPairs(); if (is_array($pairs)) { $this->as_pairs = true; $this->pairs = $pairs; } switch ($filterType) { case FileFilter::FILTER_FIND_ALL: return $this->findAll(); case FileFilter::FILTER_FIND_BY_NAME: return $this->findByName($filterValue); case FileFilter::FILTER_FIND_CONTENT_TYPE: return $this->findByContentType($filterValue); case FileFilter::FILTER_FIND_IMAGES: return $this->findImages(); case FileFilter::FILTER_FIND_NOT_IMAGES: return $this->findNotImages(); case FileFilter::FILTER_FIND_NAMESPACE: return $this->findByNamespace($filterValue); case FileFilter::FILTER_GET_ID: return $this->getById($filterValue); case FileFilter::FILTER_GET_NAME: return $this->getByName($filterValue); case FileFilter::FILTER_GET_NAMESPACE: return $this->getByNamespace($filterValue); case FileFilter::FILTER_CUSTOM_WHERE: return $this->findByCustomWhere($filterValue); case FileFilter::FILTER_ORDER_DESC: return $this->findByOrderDESC(); default: throw new DatabaseStorageException('Unsupported filter type: ' . $filterType); } }