Returns the values for $col column in the select query for $ids ids
@param array $ids
@param string $columnName
@return mixed[]
@throws InvalidArgumentException
333325
public function selectColByIdsPreserveIds(array $ids = array(), $columnName = 'id')
    {
        if (empty($ids)) {
            return array();
        }

        $_query = $this->getSelectQueryByIds($ids);
        $_columnIndexId = $this->_getColumnIndexInSelectQuery($this->getIdentityColumn());
        $_columnIndex = $this->_getColumnIndexInSelectQuery($columnName);

        if ($_columnIndex === false || $_columnIndexId === false) {
            throw new \InvalidArgumentException(get_called_class() . '::' . __FUNCTION__ . '() Invalid column name given as second parametter. "' . $columnName . '" given');
        }

        $_stmt1 = $this->db->getAdapter()->query($_query);
        $columnIndexId = $_stmt1->fetchAll(Zend_Db::FETCH_COLUMN, $_columnIndexId);

        $_stmt2 = $this->db->getAdapter()->query($_query);
        $columnIndex = $_stmt2->fetchAll(Zend_Db::FETCH_COLUMN, $_columnIndex);
        $res = array_combine($columnIndexId, $columnIndex);
        if ($res !== false) {
            return $res;
        } else {
            throw new \RuntimeException("Not same count between ID and selected COLUMN");
        }
    }
771564
@Override
    public Object[] findIdsByColumn(String schemaName, String tableName, String pKeyName, String columnName,
            Object columnValue, Class entityClazz)
    {
        return getColumnsById(schemaName, tableName, columnName, pKeyName, columnValue, entityClazz).toArray();
    }
346304
public static function find($id, array $columns = [])
    {
        $model = static::getInstance();
        $key   = static::getModelKey($id, $model);
        $query = [
            'ConsistentRead' => true,
            'TableName'      => $model->getTable(),
            'Key'            => $key,
        ];
        if ( ! empty( $columns )) {
            $query['AttributesToGet'] = $columns;
        }
        $item = $model->client->getItem($query);
        $item = array_get($item->toArray(), 'Item');
        if (empty( $item )) {
            return null;
        }
        $item = $model->unmarshalItem($item);
        $model->fill($item);
        // Set the model id field.
        $model->setId($id);
        $model->exists = true;
        $model->syncOriginal();

        return $model;
    }
286490
public function find($id, array $columns = ['*'])
    {
        $model = $this->model;

        return $model::find($id, $columns);
    }
932995
protected function _getIds(array $ids, $primaryKey = self::PRIMARY_KEY)
    {
        $return = [];
        foreach ($ids as $id => $value) {
            if (is_array($value) && is_int($id) && (int) $value[$primaryKey] === 1) {
                $return[$id] = $id;
            }
        }

        return $return;
    }
474338
public static function getTableColumnNames(\mysqli $mysqliConn, string $tableName) : array
    {
        $sql = "SHOW COLUMNS FROM `{$tableName}`";
        $result = $mysqliConn->query($sql);
        
        $columns = array();
        
        while (($row = $result->fetch_array()) != null)
        {
            $columns[] = $row[0];
        }
        
        return $columns;
    }
1150196
public static function findOrFail($id, $columns = array('*'))
    {
        $key = (new static)->getKeyName();
        if (ctype_print($id)) {
            $idFinal = (property_exists(static::class, 'uuidOptimization') && static::$uuidOptimization)
            ? self::toOptimized($id) : hex2bin($id);

            return static::where($key, '=', $idFinal)->firstOrFail($columns);
        } else {
            return parent::where($key, '=', $id)->firstOrFail($columns);
        }
    }
463449
private function filterColumns(array $columnNames)
    {
        return array_filter($this->_columns, static function ($columnName) use ($columnNames) {
            return in_array($columnName, $columnNames, true);
        }, ARRAY_FILTER_USE_KEY);
    }
553133
public static int findRowIdColumnIndex(String[] columnNames) {
        int length = columnNames.length;
        for (int i = 0; i < length; i++) {
            if (columnNames[i].equals("_id")) {
                return i;
            }
        }
        return -1;
    }
1321108
function getIdColumns(idColumnNames, columns) {
  if (!defined(idColumnNames)) {
    return [];
  }
  return idColumnNames.map(name => getColumnWithNameIdOrIndex(name, columns));
}
951063
public function findMany($id, $columns = ['*'])
    {
        if (empty($id)) {
            return new EntityCollection();
        }

        $this->query->whereIn($this->entityMap->getKeyName(), $id);

        return $this->get($columns);
    }
204240
public static function find($ids, $columns = ['*'])
    {
        $me = new self;
        $query = $me->newQuery();

        foreach ($me->getKeyName() as $key) {
            $query->where($key, '=', $ids[$key]);
        }

        return $query->first($columns);
    }
1240233
public int[] getIndexOfColumns(Collection<String> columnNames) {
        return getIndexOfColumns(columnNames.toArray(new String[columnNames.size()]));
    }
281797
public function getBy($column, $value, array $columns = ['*'])
    {
        $result = $this->getBuilder()
                       ->select($columns)
                       ->where($column, '=', $value)
                       ->first();

        // Reset query builder
        $this->resetBuilder();

        return $result;
    }
280270
public function getByIds($entityType, array $ids, array $params = [])
    {
        $validIds = array_values(array_unique(array_filter($ids, [__CLASS__, 'isIdValid'])));

        if (count($validIds) === 0) {
            return [];
        }

        $doSortByIds = empty($params['sort']);
        $results = $this->search($entityType, ['_id' => ['$in' => $validIds]], $params);
        if (!$doSortByIds) {
            return $results;
        }

        $flipped = array_flip($validIds);
        foreach ($results as $result) {
            $flipped[$result['_id']] = $result;
        }
        return array_filter(array_values($flipped), function ($result) {
            return is_array($result) && count($result) > 0;
        });

    }
675905
protected function getKvData(array $ids)
    {
        if (empty($ids)) {
            return [];
        }
        $result = [];
        $sql = 'SELECT * FROM ' . self::KV_TABLE_NAME . '
                WHERE ' . self::KV_COLUMN_PARENT_ID . ' IN(' . join(',', array_map(function(){ return '?'; }, $ids)) . ')';
        $secondaryData = $this->getPersistence()->query($sql, $ids)->fetchAll(\PDO::FETCH_ASSOC);

        foreach ($secondaryData as $data) {
            $result[$data[self::KV_COLUMN_PARENT_ID]][$data[self::KV_COLUMN_KEY]] = $data[self::KV_COLUMN_VALUE];
        }

        return $result;
    }
1333295
public function findOrNew($id, $columns = ['*'])
	{
		if (is_null($instance = $this->find($id, $columns))) {
			$instance = $this->getRelated()->newInstance();
		}

		return $instance;
	}