Get the instance as an array.

@param  boolean $includeMetaData

@return array
13544
public function toArray($includeMetaData = false, $nestedInclude = true, $callback = null)
	{
		$data = $this->transformToArray($this->data, $nestedInclude, [], $callback);
		
		if( ! $includeMetaData )
		{
			return $data;
		}

		$result = [];
		$result['data'] = $data;
		
		if( ! empty($this->included) && ! $nestedInclude && $includeMetaData)
		{
			$result['included'] = $this->transformToArray($this->getIncludes(), false, [], $callback);
		}

		if( $includeMetaData && ! empty($this->meta) )
		{
			$result['meta'] = $this->meta;
		}

		

		return $result;
	}
64763
private function getProperties(ClassMetadata $metadata)
    {
        return array_merge(
            $metadata->getFieldNames(),
            array_map(function (array $mapping) {
                return $mapping['fieldName'];
            }, $metadata->getEmbeddedFieldsMappings())
        );
    }
115424
public function toArray(): array
    {
        $data = array_filter([
            'id'     => $this->id,
            'status' => $this->status,
            'code'   => $this->code,
            'title'  => $this->title,
            'detail' => $this->detail
        ]);

        if ($this->hasLinks()) {
            $data['links'] = $this->linksToArray();
        }

        if ($this->hasMetadata()) {
            $data['meta'] = $this->getMetadata();
        }

        return $data;
    }
933637
public function getCountCommonObjects($aData = [])
    {
        if (!empty($aData['keywords'])) {
            if (empty($aData['or_like'])) {
                $aData['or_like'] = [];
            }
            $aData['or_like'][] = [
                'column' => 'o.filename_display',
                'value'  => $aData['keywords'],
            ];
        }

        $this->getCountCommon($aData);
    }
113894
public function getAcceptedFileTypes($includeDot = false)
    {
        $types = $this->fileTypes;

        if ($types === false) {
            $isImage = starts_with($this->getDisplayMode(), 'image');
            $types = implode(',', FileDefinitions::get($isImage ? 'imageExtensions' : 'defaultExtensions'));
        }

        if (!$types || $types == '*') {
            return null;
        }

        if (!is_array($types)) {
            $types = explode(',', $types);
        }

        $types = array_map(function ($value) use ($includeDot) {
            $value = trim($value);

            if (substr($value, 0, 1) == '.') {
                $value = substr($value, 1);
            }

            if ($includeDot) {
                $value = '.'.$value;
            }

            return $value;
        }, $types);

        return implode(',', $types);
    }
1218154
public function getGroupByString($includeText = true)
    {
        $statement = "";

        foreach ($this->groupBy as $groupBy) {
            $statement .= $groupBy['column'];

            if ($groupBy['order']) {
                $statement .= " " . $groupBy['order'];
            }

            $statement .= ", ";
        }

        $statement = substr($statement, 0, -2);

        if ($includeText && $statement) {
            $statement = "GROUP BY " . $statement;
        }

        return $statement;
    }
80308
protected function serialize($input, ClassMetadata $metadata)
    {
        $output = [];
        foreach ($metadata->getFieldMappings() as $field) {
            $fieldObj = $this->em->getFieldManager()->get($field['fieldtype'], $field);
            $type = $fieldObj->getStorageType();
            $key = $field['fieldname'];

            // Hack … remove soon
            if (!isset($input[$key])) {
                continue;
            }
            if (Json::test($input[$key])) {
                $input[$key] = Json::parse($input[$key]);
            }
            $output[$key] = $type->convertToDatabaseValue($input[$key], $this->getPlatform());
        }

        return $output;
    }
1057069
private function getMetaAndAliases()
    {
        $arr = explode('.', $this->field);
        $meta = $this->getClassMetadata();
        $metaAnterior = [];
        $parent = '';
        $alias = '';

        for ($i = 0; $i <= $this->position; $i++) {
            $metaAnterior = $meta;

            if ($meta->hasAssociation($arr[$i])) {
                $class = $meta->getAssociationTargetClass($arr[$i]);
            } elseif (count($meta->subClasses) > 0) {
                $temp = $this->getSubClassFields($meta, $arr[$i]);
                if (!empty($temp['meta'])) {
                    $class = $temp['table'];
                }
            }

            $meta = $this->em->getClassMetadata($class);

            if ($i < $this->position) {
                $parent .= $parent != '' ? '_' : '';
                $parent .= $arr[$i];
            }
            if ($i == $this->position) {
                $alias .= $parent;
                $alias .= $parent != '' ? '_' : '';
                $alias .= $arr[$i];
            }
        }

        if ($parent == '' && $alias != '') {
            $parent = self::DEFAULT_TABLE_ALIAS;
        }
        if ($alias == '') {
            $alias = self::DEFAULT_TABLE_ALIAS;
        }

        return [
            'meta'        => $meta,
            'parentMeta'  => $metaAnterior,
            'alias'       => $alias,
            'parentAlias' => $parent,
        ];
    }
595241
protected function getRawIncludeMap(): array
    {
        $map = [];

        foreach ($this->includes as $includeKey => $definition) {
            if (\is_int($includeKey)) {
                $includeKey = $definition;
                $definition = null;
            }

            $settings = [];
            if (!empty($definition)) {
                $parts = preg_split('/\s*\|\s*/', $definition);
                foreach ($parts as $part) {
                    if (!preg_match('/^([^:]+)(:(.+))?$/', $part, $match)) {
                        throw new ParseDefinitionException("Unable to parse field definition for '{$includeKey}''");
                    }
                    // If only list() was viable ...
                    $directive = $match[1];
                    $val = $match[3] ?? null;
                    switch ($directive) {
                        case 'default':
                            $settings['default'] = true;
                            break;
                        case 'relation':
                            $settings['relation'] = !empty($val) ?
                                preg_split('/s*,\s*/', $val) : [$includeKey];
                            break;
                        case 'method':
                            if (!empty($val)) {
                                $settings['method'] = $val;
                            }
                            break;
                        case 'item':
                            $settings['resource_type'] = 'item';
                            break;
                        case 'collection':
                            $settings['resource_type'] = 'collection';
                            break;
                        default:
                            throw new ParseDefinitionException("Invalid key '{$directive}' for {$includeKey}");
                    }
                }
            }

            if (!isset($settings['relation'])) {
                $settings['relation'] = [];
            }
            if (!isset($settings['method'])) {
                $settings['method'] = 'include'.StrHelper::studlyCase($includeKey);
            }
            if (!isset($settings['default'])) {
                $settings['default'] = false;
            }
            if (!isset($settings['resource_type'])) {
                $settings['resource_type'] = null;
            }

            $map[$includeKey] = $settings;
        }

        return $map;
    }
102556
public function getConstants(bool $includeDefault = false): array
    {
        $constants = (new \ReflectionClass($this))->getConstants();

        if (!$includeDefault) {
            unset($constants['__default']);
        }

        return $constants;
    }
459859
public function getFieldsFromMetadata(ClassMetadata $metadata)
    {
        /* @var \Doctrine\ORM\Mapping\ClassMetadataInfo|\Doctrine\ODM\MongoDB\Mapping\ClassMetadataInfo $metadata */
        $fields = (array) $metadata->getFieldNames();

        $exclude = array(
            'createdAt', 'created_at', 'createdBy', 'created_by',
            'updatedAt', 'updated_at', 'updatedBy', 'updated_by',
        );

        // Remove the primary key field if it's not managed manually
        $fields = array_diff($fields, $metadata->getIdentifier());

        foreach ($metadata->associationMappings as $fieldName => $relation) {
            if ($relation['type'] !== 4) {
                $fields[] = $fieldName;
            }
        }

        return array_values(array_diff($fields, $exclude));
    }
1082572
public function getIndexes( $includeParents = true )
    {

        // lazy load indexes
        if( !isset( $this->indexes ) ) {

            $this->indexes = $this->catalog->pgIndexes->findByIndrelid( $this->oid );

            // are we inheriting off another table
            if( $parent = $this->getParent() ) {

                foreach( $parent->getIndexes() as $parentIndex ) {

                    $data = $parentIndex->all();
                    $data['inherited'] = true;
                    $data['columns'] = [];

                    foreach( $parentIndex->indkey as $indkey ) {
                        $columns[] = sprintf( "%s.%s", $this->oid, $indkey );
                    }

                    $this->indexes->add(
                        new PgIndex( $this->catalog, $data )
                    );

                }

            }

        }

        // include parent indexes
        if( $includeParents ) {
            return $this->indexes->copy();
        } else {
            return $this->indexes->copy()->removeByInherited( true );
        }

    }
1240198
public function getListEmployees($includeBlock = true) {
		$fields = [
			$this->alias . '.id',
			$this->alias . '.' . $this->displayField,
		];
		$conditions = [];
		$blockExists = $this->hasField('block');
		if (!$includeBlock && $blockExists) {
			$conditions[$this->alias . '.block'] = false;
		}
		$order = $this->getOrderFiled();
		$this->recursive = -1;

		return $this->find('list', compact('fields', 'conditions', 'order'));
	}
157164
public function collect($rawData)
    {
        $result = array();

        foreach ($this->collectors as $name => $collectorInstance)
        {
            $result[$name] = $collectorInstance->collect($rawData);
        }

        return $result;
    }
1130989
public function getHeaderArray(bool $legacy = true): array
    {
        if ($this->needsCompile) {
            $this->compile();
        }
        $return = [];
        foreach ($this->getHeaderKeys($legacy) as $key) {
            $return[(string) $key] = $this->compiled;
        }
        return $return;
    }
1098722
private function columnSchemas(array $include = []): array
    {
        $columns = $this->driver->query(
            "PRAGMA TABLE_INFO(" . $this->driver->quote($this->getName()) . ")"
        );

        $result = [];

        foreach ($columns as $column) {
            $result[] = $column + $include;
        }

        return $result;
    }
1178694
public function toArray(): array
    {
        $data = [
            'meta'     => $this->getMetadata(),
            'links'    => $this->linksToArray(),
            'errors'   => $this->errorsToArray(),
            'included' => $this->includedResourcesToArray()
        ];

        $data = array_filter($data, 'count');

        if ($this->jsonApi !== null) {
            $data['jsonapi'] = $this->jsonApi->toArray();
        }

        return $data;
    }