returns an array of active record objects
517172
function Find($whereOrderBy,$bindarr=false,$pkeysArr=false,$extra=array())
	{
		$db = $this->DB();
		if (!$db || empty($this->_table)) {
			return false;
		}
		$arr = $db->GetActiveRecordsClass(get_class($this),$this->_table, $whereOrderBy,$bindarr,$pkeysArr,$extra);
		return $arr;
	}
179936
private ActiveRecordPlugin getActiveRecordPlugin(String ds, DruidPlugin dp){
		ActiveRecordPlugin arp = new ActiveRecordPlugin(ds, dp);
		arp.setShowSql(this.getPropertyToBoolean("db.showsql"));

		// auto mapping
		if (!this.geRuned) {
			try {
				Class<?> clazz = Class.forName(this.getModelPackage()+"."+ds.toUpperCase()+this.getMappingKitClassName());
				Method mapping = clazz.getMethod("mapping", ActiveRecordPlugin.class);
				mapping.invoke(clazz, arp);
			} catch (ClassNotFoundException | NoSuchMethodException | SecurityException | IllegalAccessException
					| IllegalArgumentException | InvocationTargetException e) {
				throw (new RuntimeException(String.valueOf(e) + ",may be your table is not contain `PrimaryKey`."));
			}
		}
		return arp;
	}
1096813
public function asArray()
    {
        $data = [];
        $columns = Manager::getInstance()->get($this)->getColumns();
        foreach(array_keys($columns) as $field) {
            $data[trim($field, '_')] = $this->$field;
        }
        $relations = Manager::getInstance()->get($this)->getRelations();
        foreach(array_keys($relations) as $field) {
            if ($this->$field instanceof Entity) {
                $data[trim($field, '_')] = $this->$field->asArray();
            } elseif ($this->$field instanceof RecordList) {
                $values = [];
                /** @var Entity $entity */
                foreach ($this->$field as $entity) {
                    $values[] = $entity->asArray();
                }
                $data[trim($field, '_')] = $values;
            } else {
                $data[trim($field, '_')] = $this->$field;
            }
        }
        return $data;

    }
374684
function get_association_keys(collection) {
  // Loop over the keys, filter irrelevant ones and fetch alias'
  return Object.keys(collection._attributes || collection.attributes)
    // We only care about attributes with model, collection or foreignKey properties.
    .filter(key =>
      collection._attributes[key].hasOwnProperty("model") ||
      collection._attributes[key].hasOwnProperty("collection") ||
      (
        collection._attributes[key].hasOwnProperty("foreignKey") &&
        collection._attributes[key].hasOwnProperty("references")
      )
    )
}
382389
public function toArray(): array
	{
		$columns = $this->columns;

		// Removes protected columns from the array

		if(!empty($this->protected))
		{
			$columns = array_diff_key($columns, array_flip($this->protected));
		}

		// Mutate column values if needed

		foreach($columns as $name => $value)
		{
			$value = $this->getColumnValue($name);

			if($value instanceof DateTimeInterface)
			{
				$value = $value->format($this->dateOutputFormat);
			}

			$columns[$name] = $value;
		}

		// Merge in related records

		foreach($this->related as $relation => $related)
		{
			if(in_array($relation, $this->protected))
			{
				continue;
			}

			$columns += [$relation => ($related === false ? $related : $related->toArray())];
		}

		// Returns array representation of the record

		return $columns;
	}
1228734
def fields_for record_name, record_object = nil, fields_options = {}, &block
      super record_name, record_object, fields_options.merge(builder: self.class), &block
    end
232828
def getRecords(rids, dbid = @dbid, fieldNames = nil)
      records = []
      if rids.length > 0
        query = ""
        rids.each{|rid| query << "{'3'.EX.'#{rid}'}OR"}
        query[-2] = "" 
        fieldNames ||= getFieldNames(dbid)
        iterateRecords(dbid,fieldNames,query){|r| records << r }
      end
      if block_given?
        records.each{|rec|yield rec}
      else
        records  
      end        
   end
408366
function(raw_records_array) {

		var i = 0,
			count = raw_records_array.length,
			records = [];

		for (; i < count; i++) {

			records.push(this._createRecordInstance(raw_records_array[i]));

		}

		this._fire('records_loaded', {records: records});

		return records;

	}
1158147
def procedures
      return [] unless databases.any? || archives.any?

      [-> { prepare! }, databases, archives,
       -> { package! }, -> { store! }, -> { clean! }]
    end
90740
def get_records(self, sequence_id, gt=None, gte=None, lt=None, lte=None, limit=None,
                    query_ascending=True, results_ascending=True):
        
198182
public function toArray()
    {
        $relations = [];
        $arrayableRelations = [];

        // include any relations exposed by default
       foreach ($this->exposedRelations as $relation) {
            // skip loading a relation if it is from a method
            if (in_array($relation, $this->relationsFromMethod)) {
                // if the relation hasnt been loaded, then load it
                if (!isset($this->$relation)) {
                    $this->$relation = $this->$relation();
                }

                $arrayableRelations[$relation] = $this->$relation;
                continue;
            }

            $this->load($relation);
        }

        // fetch the relations that can be represented as an array
        $arrayableRelations = array_merge($this->getArrayableRelations(), $arrayableRelations);

        // add the relations to the linked array
        foreach ($arrayableRelations as $relation => $value) {
            if (in_array($relation, $this->hidden)) {
                continue;
            }

            if ($value instanceof Pivot) {
                continue;
            }

            if ($value instanceof BaseModel) {
                $relations[$relation] = array('linkage' => array('id' => (string)$value->getKey(), 'type' => $value->getResourceType()));
            } elseif ($value instanceof Collection) {
                $relation = \str_plural($relation);
                $items = ['linkage' => []];
                foreach ($value as $item) {
                    $items['linkage'][] = array('id' => (string)$item->getKey(), 'type' => $item->getResourceType());
                }
                $relations[$relation] = $items;
            }

            // remove models / collections that we loaded from a method
            if (in_array($relation, $this->relationsFromMethod)) {
                unset($this->$relation);
            }
        }

        //add type parameter
        $model_attributes = $this->attributesToArray();
        unset($model_attributes[$this->primaryKey]);

        $attributes = [
            'id'         => (string)$this->getKey(),
            'type'       => $this->getResourceType(),
            'attributes' => $model_attributes
        ];

        if (! count($relations)) {
            return $attributes;
        }

        return array_merge(
            $attributes,
            [ 'links' => $relations ]
        );
    }
1162385
public function toRecords(string $recordClass): array
    {
        $array = [];
        foreach ($this->rows as $row) {
            /**
             * @var $row Row
             */
            $record = Record::instanceRecord($recordClass, $row->toArray());
            $record->setLoaded();
            $array[] = $record;
        }
        return $array;
    }
884672
def fields_for(record_name, record_object = nil, fields_options = {}, &block)
      hash  = {}
      array = []

      if nested_attributes_association?(record_name)
        hash["#{record_name}_attributes"] = fields_options[:signed_attributes_context] = array
      else
        hash[record_name] = fields_options[:signed_attributes_context] = array
      end

      add_signed_fields hash

      content = super
      array.uniq!
      content
    end
287965
public function getRecordVersions()
    {
        /** @var ActiveRecord $owner */
        $owner = $this->owner;
        return (new Query)
            ->select('action_id')
            ->from($this->auditTableName)
            ->where(['AND',
                'relation_id = (:tableName)::regclass',
                'statement_only = false',
                ['OR', 'action_type = \'INSERT\'', 'action_type = \'UPDATE\''],
                ':primaryKey' => json_encode($owner->getPrimaryKey(true)),
            ], [':tableName' => $owner->tableName()])
            ->orderBy('action_id')
            ->column($owner->getDb());
    }
1084238
def getAllValuesForFieldsAsArray( dbid, fieldNames = nil, query = nil, qid = nil, qname = nil, clist = nil, slist = nil, fmt = "structured", options = nil )
      ret = []
      valuesForFields = getAllValuesForFields(dbid, fieldNames, query, qid, qname, clist, slist,fmt,options)
      if valuesForFields
         fieldNames ||= getFieldNames(@dbid) 
         if fieldNames and fieldNames[0]
            ret = Array.new(valuesForFields[fieldNames[0]].length) 
            fieldType = {}
            fieldNames.each{|field|fieldType[field]=lookupFieldTypeByName(field)}
            valuesForFields.each{ |field,values|
               values.each_index { |i| 
                  ret[i] ||= {} 
                  ret[i][field]=formatFieldValue(values[i],fieldType[field])
               }
            }
         end
      end
      ret
   end
1086259
public static function getUsersArray(): array
    {
        return static::find()->select(['username', 'id'])->where(['status_id' => self::STATUS_ACTIVE])->indexBy('id')->orderBy(['id' => SORT_ASC])->column();
    }
1000443
def records(self):
        """"""
        return ModelList(*[r for sent in self.sentences for r in sent.records])