GraphAware\Neo4j\OGM\Repository\BaseRepository::nativeQuery PHP Method

nativeQuery() protected method

protected nativeQuery ( $query, $parameters, QueryResultMapping $resultMapping )
$resultMapping GraphAware\Neo4j\OGM\Query\QueryResultMapping
    protected function nativeQuery($query, $parameters, QueryResultMapping $resultMapping)
    {
        $parameters = null !== $parameters ? (array) $parameters : [];
        $result = $this->entityManager->getDatabaseDriver()->run($query, $parameters);
        if ($result->size() < 1) {
            return;
        }
        if ($result->size() > 1 && $resultMapping->getQueryResultType() !== QueryResultMapping::RESULT_MULTIPLE) {
            throw new \RuntimeException(sprintf('Expected a single record, got %d', $result->size()));
        }
        $results = [];
        $mappingMetadata = $this->entityManager->getResultMappingMetadata($resultMapping->getQueryResultClass());
        foreach ($result->records() as $record) {
            $results[] = $this->hydrateQueryRecord($mappingMetadata, $record);
        }
        return $resultMapping->getQueryResultType() === QueryResultMapping::RESULT_SINGLE ? $results[0] : $results;
    }