转换为数组.
@param array $columns 要得到的属性.
@param int|callable $filter 过滤.
[FILTER_NOT_NULL|FILTER_NOT_EMPTY|CALLABLE].
@return array
194624
public function toArray(
        array $columns = [],
        $filter = null
    ): array {
        $data = [];
        foreach ($this as $key => $item) {
            $data[$key] = $item;
        }
        unset($data['_keyMap']);
        if (!empty($this->_keyMap)) {
            foreach ($this->_keyMap as $beanKey => $dataKey) {
                if (array_key_exists($beanKey, $data)) {
                    $data[$dataKey] = $data[$beanKey];
                    unset($data[$beanKey]);
                }
            }
        }

        empty($columns) || $data = array_intersect_key(
            $data,
            array_flip($columns)
        );
        if ($filter === static::FILTER_NOT_NULL) {
            return array_filter($data, function ($val) {
                return !is_null($val);
            });
        } else if ($filter === static::FILTER_NOT_EMPTY) {
            return array_filter($data, function ($val) {
                if ($val === 0 || $val === '0') {
                    return true;
                } else {
                    return !empty($val);
                }
            });
        } else if (is_callable($filter)) {
            return array_filter($data, $filter);
        }
        return $data;
    }
1152166
public function andWhereNotIn($column, $in, $filter = false)
    {
        return $this->createWhereIn('AND', $column, $in, true, $filter);
    }
1160723
public function andWhereNotBetween($column, $a, $b, $filter = false)
    {
        return $this->between($column, $a, $b, null, true, 'AND', $filter);
    }
11249
public function getDataForExport($filter, $columns = array())
	{
        $select = $this->tableGateway->getSql()->select();
        $select->columns(array('*'));
        
        $w = new Where();
        $filters = array();
        $likes = array();
        
        foreach($columns as $columnKeys) 
        {
            $likes[] = new Like($columnKeys, '%'.$filter.'%');
        }
        
        $filters = array(new PredicateSet($likes, PredicateSet::COMBINED_BY_OR));
        
        $select->where($filters);
        
        $resultSet = $this->tableGateway->selectWith($select);
        
        return $resultSet;
        
	}
1160046
public function whereNotIn($column, $in, $filter = false)
    {
        return $this->createWhereIn('WHERE', $column, $in, true, $filter);
    }
273437
public static function all( $columns = ['*'] )
	{
		$columns = is_array( $columns ) ? $columns : func_get_args();

		$instance = new static;

		return $instance->newQuery()->get( $columns );
	}
548368
private function between($method, $column, $a, $b, $filter)
    {
        if (!$this->queryBuilder->isFilterable($filter, array($a, $b))) {
            return $this;
        }

        if ($a instanceof RawSqlFragmentInterface) {
            $x = $a->getFragment();
        }

        if ($b instanceof RawSqlFragmentInterface) {
            $y = $b->getFragment();
        }

        // When doing betweens, unique placeholders come in handy
        if (!isset($x)) {
            $x = $this->getUniqPlaceholder();
        }

        if (!isset($y)) {
            $y = $this->getUniqPlaceholder();
        }

        // Prepare query string
        call_user_func(array($this->queryBuilder, $method), $column, $x, $y, $filter);

        // And finally bind values
        if (!($a instanceof RawSqlFragmentInterface)) {
            $this->bind($x, $a);
        }

        if (!($b instanceof RawSqlFragmentInterface)) {
            $this->bind($y, $b);
        }

        return $this;
    }
787804
public function setColumns(array $columns)
    {
        foreach ($columns as $id => $params) {
            if (!is_string($id) || strlen($id) < 1)
                throw new \Exception("Column ID should be a non-empty string");
            if (!isset($params['title']))
                throw new \Exception("No 'title' param for ID $id");
            if (!isset($params['type']))
                throw new \Exception("No 'type' param for ID $id");
            if (!in_array($params['type'], self::getAvailableTypes()))
                throw new \Exception("Unknown type '" . $params['type'] . "' for ID $id");
            if (!isset($params['filters']))
                throw new \Exception("No 'filters' param for ID $id");
            if (!isset($params['sortable']))
                throw new \Exception("No 'sortable' param for ID $id");
            if (!isset($params['visible']))
                throw new \Exception("No 'visible' param for ID $id");

            foreach ($params['filters'] as $filter) {
                if (!in_array($filter, self::getAvailableFilters()))
                    throw new \Exception("Unknown filter: $filter");
            }
        }

        $this->columns = $columns;
        return $this;
    }
340797
public function allFiltered($columns = [], array $with = [])
    {
        $params = request()->all();
        $data = $this->with($with)->select($columns);

        $orderBy = $params['orderBy'] ?? null;
        $query = $params['query'] ?? null;
        $limit = $params['limit'] ?? null;
        $page = $params['page'] ?? 1;
        $ascending = $params['ascending'] ?? 1;
        $byColumn = $params['byColumn'] ?? 0;

        if ($query !== null) {
            $data = $byColumn == 1 ? $this->filterByColumn($data, $query) :
                                     $this->filter($data, $query, $columns);
        }

        $count = $data->count();

        if ($limit !== null) {
            $data->limit($limit)->skip($limit * ($page - 1));
        }
        if ($orderBy !== null) {
            $orderBy .= $this->translatableOperator($orderBy);
            $direction = $ascending == 1 ? 'ASC' : 'DESC';
            $data->orderBy($orderBy, $direction);
        }

        $results = $data->get()
            ->translate(config('typicms.content_locale'));

        return [
            'data' => $results,
            'count' => $count,
        ];
    }
64634
public function get($columns = ['*'])
    {
        $original = $this->columns;

        if (is_null($original)) {
            $this->columns = $columns;
        }

        $results = $this->processor->processSelect($this, $this->runSelect());

        $this->columns = $original;

        return collect($results);
    }
119161
public function get($filter, $cols = null) {
		$query = $this->newSelect();
		if (is_array($cols)) {
			$query->addColumns(...$cols);
		}
		if (!is_array($filter)) {
			$query->where(field($this->_primary_key)->eq($filter));
		} else {
			foreach ($filter as $k => $v) {
				$query->andWhere(field($k)->eq($v));
			}
		}
		$query->limit(1);
		$result = $this->execute($query);
		return count($result) > 0 ? current($result) : null;
	}
1055581
public function select(string $column, string ...$columns)
    {
        $instance = $this->selectQueryInstance();

        $instance->selectQuery()->columns($column, ...$columns);

        return $instance;
    }
86991
public static function parseColumns($query, $columns)
    {
        if ($columns instanceof AnDomainResourceColumn) {
            return array($columns);
        }

        settype($columns, 'array');
        $array = array();
        foreach ($columns as $key => $column) {
            $result = strpos($column, ' ') !== false ? null : self::parseColumn($query, $column);
            $cols = $result['columns'];
            if (!isset($result['property'])) {
                $array[$key] = $column;
            } elseif (!is_array($cols)) {
                $array[$key] = $cols;
            } else {
                $key = 10000;
                foreach ($cols as $col) {
                    $array[$key++] = $col;
                }
            }
        }

        return $array;
    }
911984
public function orWhereBetween($column, $a, $b, $filter = false)
    {
        return $this->between(__FUNCTION__, $column, $a, $b, $filter);
    }
1052485
public function filter(array $filters)
	{
		foreach ($filters as $filter) {
			if ($filter->isValueSet()) {
				if ($filter->hasConditionCallback()) {
					Callback::invokeArgs(
						$filter->getConditionCallback(),
						[$this->data_source, $filter->getValue()]
					);
				} else {
					if ($filter instanceof Filter\FilterText) {
						$this->applyFilterText($filter);
					} elseif ($filter instanceof Filter\FilterMultiSelect) {
						$this->applyFilterMultiSelect($filter);
					} elseif ($filter instanceof Filter\FilterSelect) {
						$this->applyFilterSelect($filter);
					} elseif ($filter instanceof Filter\FilterDate) {
						$this->applyFilterDate($filter);
					} elseif ($filter instanceof Filter\FilterDateRange) {
						$this->applyFilterDateRange($filter);
					} elseif ($filter instanceof Filter\FilterRange) {
						$this->applyFilterRange($filter);
					}
				}
			}
		}

		return $this;
	}
495551
public static function convertFilter($filter)
    {
        if (!$filter) {
            return array();
        }
        if (is_array($filter)) {
            return $filter;
        }

        $filter_array = array();
        $rules        = explode('|', $filter);
        foreach ($rules as $rule) {
            list($name, $arg) = self::get_name_and_arg($rule);
            $filter_array[$name] = $arg;
        }

        return $filter_array;
    }
595622
public function findBy($column, $value, array $columns = ['*'])
    {
        return $this->where([$column => $value], '=', null, 'and', $columns)->first();
    }