Get all custom fields of the given object

@param  array  $fields
@return Phalcon\Mvc\Model
771491
public function getAllCustomFields(array $fields = [])
    {
        if (!$models = Modules::findFirstByName($this->getSource())) {
            return;
        }

        $conditions = [];
        $fieldsIn = null;

        if (!empty($fields)) {
            $fieldsIn = " and name in ('" . implode("','", $fields) . ')';
        }

        $conditions = 'modules_id = ? ' . $fieldsIn;

        $bind = [$this->getId(), $models->getId()];

        $customFieldsValueTable = $this->getSource() . '_custom_fields';

        $result = $this->getReadConnection()->prepare("SELECT l.{$this->getSource()}_id,
                                               c.id as field_id,
                                               c.name,
                                               l.value ,
                                               c.users_id,
                                               l.created_at,
                                               l.updated_at
                                        FROM {$customFieldsValueTable} l,
                                             custom_fields c
                                        WHERE c.id = l.custom_fields_id
                                          AND l.leads_id = ?
                                          AND c.modules_id = ? ");

        $result->execute($bind);

        // $listOfCustomFields = $result->fetchAll();
        $listOfCustomFields = [];

        while ($row = $result->fetch(\PDO::FETCH_OBJ)) {
            $listOfCustomFields[$row->name] = $row->value;
        }

        return $listOfCustomFields;
    }
525960
public function addFields($fields)
    {
        foreach ($fields as $field) {
            if (is_array($field)) {
                $this->addField(...$field);
            } else {
                $this->addField($field);
            }
        }

        return $this;
    }
612802
public function only($fields)
    {
        $fields = (array) $fields;

        return $this->map(
            static function (Data $data) use ($fields) {
                return $data->only($fields);
            }
        );
    }
830546
public function fields(array $fields = null)
    {
        if ($fields === null) {
            return $this->container;
        }

        $output = [];

        foreach ($fields as $name) {
            if (isset($this->container[$name]) || array_key_exists($name, $this->container)) {
                $output[$name] = $this->container[$name];
            } else {
                throw new \InvalidArgumentException(
                    sprintf(
                        "No such field '%s'. Existing fields are {%s}",
                        $name,
                        join(', ', array_keys($this->container))
                    )
                );
            }
        }

        return $output;
    }
1119444
public function load(array $fields)
    {
        $this->quote->setStoreId($this->storeManager->getStore()->getId());

        foreach ($fields as $rawFields) {
            $method = 'set' . SimpleDataObjectConverter::snakeCaseToUpperCamelCase($rawFields);
            $this->log->debug('Starting method ' . $method);
            $this->{$method}();
            $this->log->debug('Finished method ' . $method);
        }

        return $this->quote;
    }
484049
public function fields($fields)
    {
        if (is_array($fields) || $fields === null) {
            $this->fields = $fields;
        } else {
            $this->fields = func_get_args();
        }
        return $this;
    }
241477
protected function _getFieldsFromConfig($fields = null) {
		$result = [];
		if (empty($fields)) {
			return $result;
		}

		if (!is_array($fields)) {
			$result = [$fields];
		} else {
			$result = array_keys($fields);
		}

		return $result;
	}
1178456
protected function objectifyFields($fields) {
        $new = array();
        foreach($fields as $name => $field) {
            if (is_object($field)) {
                $new[] = $field;
            } else {
                if (array_key_exists('fileName', $field)) {
                    $new[] = new File($field['contentType'], $field['fileName'], $field['upload'], $field['language']);
                } else {
                    $new[] = new AssetField($name, $field);
                }
            }
        }
        return $new;
    }
408550
protected function filterFields(array $fields)
    {
        if ($requested = $this->getOwnFields()) {
            $fields = array_intersect_key($fields, array_flip($requested));
        }

        return $fields;
    }
282638
public function FieldHolder($properties = array())
    {
        $context = $this;

        if (count($properties)) {
            $context = $this->customise($properties);
        }

        return $context->renderWith($this->getFieldHolderTemplates());
    }
177535
final public function toArrayFor($fields){
		$array = array();
		$all = $this->toArray();
		foreach($fields as $field){
			if( array_key_exists($field, $all) ){
				$array[$field] = $all[$field];
			}
		}
		return $array;
	}
1027765
public function getCustomFields($object)
    {
        $customFields = [];
        foreach ($object->getCustomFields() as $field) {
            $customFields[$field->getInternalFieldName()] = $field->getValue();
        }

        return $customFields;
    }
1333071
public function returnedFields($fields) {
		if(empty($this->data['returnedFields'])) {
			$this->data['returnedFields'] = array();
		}
		$this->data['returnedFields'] = array_unique(array_merge($this->data['returnedFields'], (array)$fields));
		return $this;
	}
657893
protected function getPrimaryField(array $fields)
    {
        foreach ($fields as $field) {
            if ($this->isField($field) && ($field->isPrimary || $field->isAutoIncrement)) {
                return $field;
            }
        }

        return null;
    }
117500
protected function objectifyFields($fields) {
        $new = array();
        foreach($fields as $name => $field) {
            if (is_object($field)) {
                $new[] = $field;
            } else {
                $new[] = new EntryField($name, $field);
            }
        }
        return $new;
    }
1079380
public function getTitleFields(array $fields)
    {
        $fields = array_map(function ($field) {
            if (str_contains($field, '.')) {
                return object_get($this, $field); // this acts as a delimiter, which we can replace with /
            } else {
                return $this->{$field};
            }
        }, $fields);

        return $fields;
    }
556301
private function getFieldLayoutFieldsDefinition(array $fields): array
    {
        $fieldDefinitions = [];

        foreach ($fields as $field) {
            $fieldDefinitions[$field->handle] = $field->required;
        }

        return $fieldDefinitions;
    }