public function retrieveSet(EntitySetRetrieverCriteria $criteria) { try { $containerName = $criteria->getContainerName(); $query = $this->createSetQuery($criteria, $containerName); $data = $this->retrieveSetFromQuery($query); if (empty($data)) { return null; } return array('index' => (int) $query['index'], 'amount' => (int) count($data), 'total_amount' => (int) $query['total_amount'], 'entities' => $this->addContainerToDatas($data, $containerName)); } catch (AbstractPDOException $exception) { throw new EntityRepositoryException('There was an exception while fetching Entity objects from the database using a \\PDO driver.', $exception); } }
public function retrieveSet(EntitySetRetrieverCriteria $criteria) { try { $containerName = $criteria->getContainerName(); $data = $this->entityDataRepository->retrieveSet($criteria); if (empty($data)) { return null; } $entities = $this->dataIsHumanReadable ? $this->entityAdapter->fromHumanReadableDatasToEntities($data['entities']) : $this->entityAdapter->fromDatasToEntities($data['entities']); return new ConcreteMultipleEntityOutput($entities, $data['index'], $data['amount'], $data['total_amount']); } catch (EntityException $exception) { throw new EntityRepositoryException('There was an exception while converting data to an Entity objects.', $exception); } catch (MultipleEntityOutputException $exception) { throw new EntityRepositoryException('There was an exception while creating a MultipleEntityOutput object.', $exception); } }
public function retrieveSet(EntitySetRetrieverCriteria $criteria) { $container = $criteria->getContainerName(); $index = $criteria->getIndex(); $amount = $criteria->getAmount(); $uri = '/' . $container; try { $httpRequest = $this->httpRequestAdapter->fromDataToHttpRequest(['uri' => $uri, 'method' => 'get', 'port' => $this->port, 'query_parameters' => ['index' => $index, 'amount' => $amount], 'headers' => $this->headers]); $data = $this->executeRequest($httpRequest); if (!isset($data['entities']) || empty($data['entities'])) { $data['entities'] = []; } foreach ($data['entities'] as $index => $oneData) { $data['entities'][$index]['container'] = $container; } return $data; } catch (HttpApplicationException $exception) { throw new EntityRepositoryException('There was an exception while using the HttpApplication.', $exception); } }