Get objects by sql query

@param string $query  Sql query
@param string $object Object name

@return array|bool
767168
public function getObjects($query, $object)
    {
        $this->statement = $this->db->query($query);
        if ($this->statement) {
            $this->statement->setFetchMode(\PDO::FETCH_CLASS, $object);
            $objects =  $this->statement->fetchAll();
            if ($objects) {
                return $objects;
            }
        }
        return false;
    }
383077
public function getResultsAsObjects($sql, $params = null)
    {
        $stmt = $this->execute($sql, $params);

        return $stmt->fetchAll(PDO::FETCH_OBJ);
    }
967416
protected function getRecordByQuery($query)
    {
        return \OxidEsales\Eshop\Core\DatabaseProvider::getDb(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC)->select($query);
    }
508113
protected function prepareQuery($query)
    {
        $query = $query->with($this->withs);

        if ($this->withCounts) {
            $query = $query->withCount($this->withCounts);
        }

        if ($this->orderBy) {
            $query = $query->orderBy($this->orderBy, $this->orderByDirection);
        }

        if ( ! empty($this->has)) {
            foreach ($this->has as $has) {
                $query = $query->has($has['relation'], $has['operator'], $has['value']);
            }
        }

        if ( ! empty($this->whereHas)) {
            foreach ($this->whereHas as $has) {
                $query = $query->whereHas($has[0], isset($has[1]) ? $has[1] : null);
            }
        }

        return $query;
    }
705270
public function search($query)
    {
        $classes = $this->getClassMetadata();
        return $this->_sm->getUnitOfWork()->loadCollection($classes, $query);
    }
1340562
public function findByQuery($query)
    {
        $qb = $this->createQueryBuilder();
        $parts  = explode(' ', trim($query));
        
        foreach ($parts as $q) {
            $regex = new \MongoRegex('/^' . $query . '/i');
            $qb->addOr($qb->expr()->field('info.firstName')->equals($regex));
            $qb->addOr($qb->expr()->field('info.lastName')->equals($regex));
            $qb->addOr($qb->expr()->field('info.email')->equals($regex));
        }
        $qb->sort(array('info.lastName' => 1))
           ->sort(array('info.email' => 1));
        
        return $qb->getQuery()->execute();
    }
1090401
public static function executeRows(string $query): array
  {
    self::logQuery($query);

    return self::$dl->executeRows($query);
  }
918264
public function getValue($query)
    {
        $this->statement = $this->db->query($query);
        if ($this->statement) {
            $value = $this->statement->fetch(\PDO::FETCH_BOTH);
            if (!empty($value[0])) {
                return $value[0];
            }
        }
        return false;
    }
504493
final public function option($query)
    {
        try {
            $option = $this->options->find($query);
            $value  = $option->getValue();

        } catch (ObjectDoesNotExistException $e) {
            $value = false;
        }

        return $value;
    }
576453
public function search($query)
    {
        if($query instanceof Query) {
            return $this->obj_gateway->search($query);
        }
        return $this->obj_gateway->search(new Query((string)$query));
    }
935907
public function parse($query)
    {
        $queries = array();
        parse_str($query, $queries);

        return new Query($this->parseHttpQueryComponents($queries), $this->getPersister());
    }
367165
public final function getAll(string $query, array $queryParams = null, string $fetchClass = null): array
    {
        return $this->query($query, $queryParams, null, $fetchClass)->getData();
    }
580378
public function query($query) {
    $dataConnection = $this->app->getDataConnection($this->connection);
    $foundObjects = $dataConnection->query($this->table, $query);
    $foundModels = array();
    foreach ($foundObjects as $foundObject) {
      /**
       * @var $model \MABI\Model
       */
      $model = call_user_func($this->modelClass . '::init', $this->app);
      $model->load($foundObject);
      $foundModels[] = $model;
    }
    return $foundModels;
  }
1276803
public function GetCustomQuery($objectclass, $criteria)
	{
		$this->IncludeModel($objectclass);
		$sql = call_user_func( array($objectclass,"GetCustomQuery"),$criteria );
		return $sql;
	}
1170364
public function searchByQuery($query) {
		$results = $this->ldap->search($this->basedn, $query);
		return $results;
	}
303418
public function query($entity, $query)
	{
		$retValue = array();

		if (! is_null($this->_db)){
			try{
				$mongo = $this->_db->selectCollection($entity);

				// Find by query
				$cursor = $mongo->find($query);

				if (is_null($cursor))
					$retValue = array();
				else
					$retValue = iterator_to_array($cursor);
			}
			catch(Exception $e) {
				$this->_log->addError($e->getMessage());
			}	
		}

		return $retValue;
	}
940666
protected function execute($query)
    {
        $query->execute($this->bindings);
        
        $this->bindings = [];
        $this->wheres   = [];

        return $query;
    }