protected function loadQuery(string $sql, array $parameters = []) : array
    {
        $sql   = $this->replaceQueryPlaceholders($sql);
        $query = $this->connection->prepare($sql, $parameters);
        $rows  = $query->execute()->getResults();

        if (empty($rows)) {
            return [];
        }

        $this->validateHasRequiredColumns($sql, reset($rows));

        $rowSet = $this->connection->getPlatform()->mapResultSetToPhpForm($this->mapper->getSelect()->getResultSetTableStructure(), $rows);

        return $this->mapper->loadAll($this->loadingContext, $rowSet->getRows());
    }