Returns the list of available databases.
@param array $condition filter condition.
@param array $options options list.
@return array database information
495236
public function listDatabases($condition = [], $options = [])
    {
        if ($this->databaseName === null) {
            $this->databaseName = 'admin';
        }
        $this->document = $this->db->getQueryBuilder()->listDatabases($condition, $options);

        $cursor = $this->execute();
        $result = current($cursor->toArray());

        if (empty($result['databases'])) {
            return [];
        }
        return $result['databases'];
    }
990781
public function fetchAll($conditions = false)
    {
        $this->andWhere($conditions);
        $data = $this->execute();
        if ($this->indexBy) {
            $data = $this->executeIndexBy($data, $this->indexBy);
        }
        return $data;
    }
18257
public static function findAllArray($condition = [],$orderBy = []) {
        return self::find()->where($condition)->asArray()->orderBy($orderBy)->all(static::getDb());
    }
595859
public function finds($condition = NULL, $rows = 0, $start = 0, $order='', $fields = '*', $fetchMode=PDO::FETCH_ASSOC) {
		if (is_array($condition)) {
			$where = $condition[0];
			$params = $condition[1];
		} 
		else {
			$where = $condition;
			$params = null;
		}
		return $this->driver
            ->field($fields)
            ->where($where, $params)
            ->orderby($order)
            ->limit($rows, $start)
            ->fetchAll($fetchMode);
	}
703638
public function listCollections(array $options = [])
    {
        $this->setOptions($options);
        $coll = new Collection($this->client, $this->database);
        $coll->setHeaders($this->getHeaders());
        $rs = $coll->getAll();
        $this->checkResponse($rs);
        $colls = array_get($rs, 'DocumentCollections');
        $list = [];
        if (!empty($colls)) {
            foreach ($colls as $coll) {
                $list[] = array_get($coll, 'id');
            }
        }

        return $list;
    }
527556
protected function getFilteredOptions(array $options)
    {
        $default = $this->getDefaultOptions();
        $options = \array_merge($default, $options);

        $uses = \array_unique(\array_merge([
            'path', 'filename', 'extension', 'format',
        ], \array_keys($default)));

        $data = Arr::only($options, $uses);

        return $data;
    }
1235127
public function codeList($conditions = []) {
		$conditions += ['status' => 1];
		$res = $this->find('all', ['conditions' => $conditions, 'fields' => ['code', 'name']]);
		$ret = [];
		foreach ($res as $language) {
			$ret[$language['code']] = $language['name'];
		}
		return $ret;
	}
892648
public function fetchRows($condition = array())
    {
        $query = self::getInstance($this, $condition);

        return $this->getRepository()->fetch($query, AnDomain::FETCH_ROW_LIST);
    }
167645
private static function fetchByConditions( $conditions, $limit, $offset )
    {
        $db = eZDB::instance();

        $defaultConditions = array(
            'ezcobj_state.group_id=ezcobj_state_group.id',
            'ezcobj_state_language.contentobject_state_id=ezcobj_state.id',
            eZContentLanguage::languagesSQLFilter( 'ezcobj_state' ),
            eZContentLanguage::sqlFilter( 'ezcobj_state_language', 'ezcobj_state' )
        );

        $conditions = array_merge( $conditions, $defaultConditions );

        $conditionsSQL = implode( ' AND ', $conditions );

        $sql = "SELECT ezcobj_state.*, ezcobj_state_language.* " .
               "FROM ezcobj_state, ezcobj_state_group, ezcobj_state_language " .
               "WHERE $conditionsSQL " .
               "ORDER BY ezcobj_state.priority";

        $rows = $db->arrayQuery( $sql, array( 'limit' => $limit, 'offset' => $offset ) );

        $states = array();
        foreach ( $rows as $row )
        {
            $state = new eZContentObjectState( $row );
            $stateLanguage = new eZContentObjectStateLanguage( $row );
            $state->setLanguageObject( $stateLanguage );
            $states[] = $state;
        }

        return $states;
    }
112723
public function searchFilter($searchFilters, $options = [])
    {
        $_options = [];

        $options = array_merge($_options, $options);

        return ($searchFilters ? $this->Search->filterForm($searchFilters) : null);
    }
567686
public function getList(array $options = array())
    {
        $result = null;
        $this->hook->attach('sku.list.before', $options, $result, $this);

        if (isset($result)) {
            return $result;
        }

        $sql = 'SELECT ps.*, p.title, p.currency';

        if (!empty($options['count'])) {
            $sql = 'SELECT COUNT(ps.product_sku_id)';
        }

        $sql .= ' FROM product_sku ps LEFT JOIN product p ON(ps.product_id = p.product_id)';

        $conditions = array();

        if (isset($options['product_sku_id'])) {
            $sql .= ' WHERE ps.product_sku_id = ?';
            $conditions[] = $options['product_sku_id'];
        } else {
            $sql .= ' WHERE ps.product_sku_id IS NOT NULL';
        }

        if (isset($options['sku'])) {
            $sql .= ' AND ps.sku=?';
            $conditions[] = $options['sku'];
        }

        if (isset($options['store_id'])) {
            $sql .= ' AND p.store_id=?';
            $conditions[] = $options['store_id'];
        }

        if (isset($options['title_sku'])) {
            $sql .= ' AND (p.title LIKE ? OR ps.sku LIKE ?)';
            $conditions[] = "%{$options['title_sku']}%";
            $conditions[] = "%{$options['title_sku']}%";
        }

        if (isset($options['product_id'])) {
            $sql .= ' AND ps.product_id=?';
            $conditions[] = $options['product_id'];
        }

        if (isset($options['combination_id'])) {
            $sql .= ' AND ps.combination_id=?';
            $conditions[] = $options['combination_id'];
        }

        if (isset($options['status'])) {
            $sql .= ' AND ps.status=?';
            $conditions[] = (int) $options['status'];
        }

        $sql .= " ORDER BY ps.sku ASC";

        if (!empty($options['limit'])) {
            $sql .= ' LIMIT ' . implode(',', array_map('intval', $options['limit']));
        }

        if (empty($options['count'])) {
            $list = $this->db->fetchAll($sql, $conditions, array('index' => 'product_sku_id'));
            $result = $this->prepareList($list);
        } else {
            $result = (int) $this->db->fetchColumn($sql, $conditions);
        }

        $this->hook->attach('sku.list.after', $options, $result, $this);
        return $result;
    }
368122
public function getCategories($conditions = array(), $options = array())
    {
        $conditions += array(
            'status' => 1,
            'type' => 'catalog',
            'store_id' => $this->store_id
        );

        $options += array(
            'entity' => 'category',
            'imagestyle' => $this->configTheme('image_style_category_child', 3));

        $categories = $this->category->getTree($conditions);
        $this->prepareEntityItems($categories, $options);
        return $categories;
    }
1165058
public function getProducts($conditions = array(), $options = array())
    {
        $conditions += array(
            'status' => 1,
            'store_id' => $this->store_id
        );

        if (isset($conditions['product_id']) && empty($conditions['product_id'])) {
            return array();
        }

        $options += array('entity' => 'product');
        $products = (array) $this->product->getList($conditions);
        $this->prepareEntityItems($products, $options);
        return $products;
    }
1077488
public function findAll(Condition $condition = null): array
    {
        $result = [];
        $rows = $this->microDb->getCollection($this->collectionName)->fetchAll(
            $this->conditionParser->filter($condition, $limit, $offset),
            $this->conditionParser->sort($condition),
            $limit,
            $offset
        );
        foreach ($rows as $row) {
            /** @var AbstractEntity $entity */
            $entity = $this->factory->create();
            $entity->mapFromArray($row);
            $result[$entity->getId()] = $entity;
        }

        return $result;
    }
598140
public function fetchRow($condition = array())
    {
        $query = self::getInstance($this, $condition);

        return $this->getRepository()->fetch($query, AnDomain::FETCH_ROW);
    }
842321
public function link($query, $condition = array(), $options = array())
    {
        if (is_string($query)) {
            if (strpos($query, '.') === false) {
                $name = $query;

                if ($property = $this->getRepository()->getDescription()->getProperty($name)) {
                    $name = $property->getName();
                }

                AnDomainQueryHelper::addRelationship($this, $name);
                $link = $this->getLink($name);
                $config = new AnConfig($condition);
                $config->append(array(
                        'type' => $link->type,
                        'bind_type' => $link->bind_type,
                        'conditions' => array(),
                ));
                $link->offsetSet('type', $config->type)->offsetSet('bind_type', $config->bind_type);
                foreach ($config->conditions as $key => $value) {
                    if (is_string($value)) {
                        $value = AnDomainQueryBuilder::getInstance()->parseMethods($this, $value);
                    } elseif ($value instanceof AnDomainResourceColumn) {
                        $value = clone $value;
                    }
                    $link->conditions[$key] = $value;
                }

                return $this;
            } else {
                $query = AnDomain::getRepository($query)->getQuery();
            }
        } elseif ($query instanceof AnDomainRepositoryAbstract) {
            $query = $query->getQuery();
        }

        settype($condition, 'array');

        $options = new AnConfig($options);

        $options->append(array(
            'type' => 'strong',
            'resource' => $query->getRepository()->getResources()->main(),
            'as' => $query->getRepository()->getDescription()->getEntityIdentifier()->name,
        ));

        if (!isset($this->link[$options->as])) {
            $options->resource->setAlias(AnInflector::underscore($options->as));

            $destination = $query->getRepository()->getDescription()->getInheritanceColumn();

            $link = array(
                'query' => $query,
                'resource' => $options->resource,
                'resource_name' => $options->resource->getAlias(),
                'type' => $options->type,
                'conditions' => array(),
                'bind_type' => $destination ? clone $destination : null,
            );

            foreach ($condition as $key => $value) {
                $link['conditions'][$key] = $value instanceof AnDomainResourceColumn ? clone $value : $value;
            }

            $this->link[$options->as] = new AnConfig($link);

            $this->distinct = true;
        }

        return $this;
    }
579544
public function addDelete($condition, $options = [])
    {
        $this->document[] = [
            'type' => 'delete',
            'condition' => $this->db->getQueryBuilder()->buildCondition($condition),
            'options' => $options,
        ];
        return $this;
    }