Method to simplify select_ methods

@param string $field
@param string|bool $as
@return string
518965
protected function _select(string $field, $as = FALSE): string
	{
		// Escape the identifiers
		$field = $this->driver->quoteIdent($field);

		if ( ! \is_string($as))
		{
			return $field;
		}

		$as = $this->driver->quoteIdent($as);
		return "({$field}) AS {$as} ";
	}
551034
public function selectJsonMore($field, string $as, string $type = 'object'): self
    {
        return $this->selectJson($field, $as, $type, false);
    }
810666
public static function transform_to_object( &$field ) {
		if ( 1 !== count( $field['value'] ) ) {
			return $field['value'];
		}

		$as_array = ! ( 1 === $field['min'] && 1 === $field['max'] );
		$as_array = apply_filters( Filter::REPEATER_AS_ARRAY, $as_array, $field );

		$field['value'] = $as_array ? $field['value'] : $field['value'][0];
	}
345253
public function attributes($field)
    {
        $parts = explode('.', $field);
        $table = $this->_getTable($parts);
        $column = (array)$table->getSchema()->getColumn(array_pop($parts));
        $whitelist = ['length' => null, 'precision' => null];

        return array_intersect_key($column, $whitelist);
    }
2946
public static function cleanField($field) {
        if ('*' == $field) {
            return $field;
        }
        $strings = explode('.', $field);
        $fields  = [];
        foreach ($strings as $str) {
            $strs = preg_split('#\bas\b#i', $str);
            $fs   = [];
            foreach ($strs as $s) {
                if ($s == '*') {
                    $fs [] = '*';
                } else {
                    $fs [] = '`' . trim(trim(trim($s), '`')) . '`';
                }
            }
            $fields [] = implode(' AS ', $fs);
        }

        return implode('.', $fields);
    }
662809
public function type($field)
    {
        if (!is_array($this->_context['schema'])) {
            return null;
        }

        $schema = Hash::get($this->_context['schema'], $field);
        if ($schema === null) {
            $schema = Hash::get($this->_context['schema'], $this->stripNesting($field));
        }

        return isset($schema['type']) ? $schema['type'] : null;
    }
693207
public function method($field, $methodName = null)
    {
        if (!$methodName) {
            $methodName = $field;
        }

        if (!is_string($field)) {
            throw new GenericException('Must be a string!');
        }
        if (!is_string($methodName)) {
            throw new GenericException('Must be a string!');
        }

        $this->fields[ $field ] = [
            'type'   => self::TYPE_METHOD,
            'method' => $methodName
        ];

        return $this;
    }
1011056
protected function getSelectColumnAssociationSQL($field, AssociationMetadata $association, ClassMetadata $class, $alias = 'r')
    {
        if (! ($association->isOwningSide() && $association instanceof ToOneAssociationMetadata)) {
            return '';
        }

        $columnList    = [];
        $targetClass   = $this->em->getClassMetadata($association->getTargetEntity());
        $sqlTableAlias = $this->getSQLTableAlias($class->getTableName(), ($alias === 'r' ? '' : $alias));

        foreach ($association->getJoinColumns() as $joinColumn) {
            /** @var JoinColumnMetadata $joinColumn */
            $columnName           = $joinColumn->getColumnName();
            $quotedColumnName     = $this->platform->quoteIdentifier($columnName);
            $referencedColumnName = $joinColumn->getReferencedColumnName();
            $resultColumnName     = $this->getSQLColumnAlias();

            if (! $joinColumn->getType()) {
                $joinColumn->setType(PersisterHelper::getTypeOfColumn($referencedColumnName, $targetClass, $this->em));
            }

            $this->currentPersisterContext->rsm->addMetaResult(
                $alias,
                $resultColumnName,
                $columnName,
                $association->isPrimaryKey(),
                $joinColumn->getType()
            );

            $columnList[] = sprintf('%s.%s AS %s', $sqlTableAlias, $quotedColumnName, $resultColumnName);
        }

        return implode(', ', $columnList);
    }
823780
public function field($field, $alias = null) {
        if (is_string($field)) {
            $fields = explode(',', trim($field));
            foreach ($fields as $field) {
                $this->fields [] = Condition::cleanField($field . ($alias ? ' AS ' . $alias : ''));
            }
        } else if ($field instanceof Query) {
            if ($alias) {
                $field->alias($alias);
            }
            $this->fields [] = $field;
        } else if ($field instanceof ImmutableValue) {
            if ($alias) {
                $field->alias($alias);
            }
            $this->fields [] = $field;
        }

        return $this;
    }
812167
public function fields( $field = null, $option = null ) {

		$field_data = null;

		if ( empty( $this->fields ) ) {
			// No fields found.
			$field_data = array();
		} elseif ( empty( $field ) ) {
			// Return all fields.
			$field_data = (array) $this->fields;
		} elseif ( ! isset( $this->fields[ $field ] ) && ! isset( $this->pod_data['object_fields'][ $field ] ) ) {
			// Field not found.
			$field_data = array();
		} elseif ( empty( $option ) ) {
			// Return all field data.
			if ( isset( $this->fields[ $field ] ) ) {
				$field_data = $this->fields[ $field ];
			} elseif ( isset( $this->pod_data['object_fields'] ) ) {
				$field_data = $this->pod_data['object_fields'][ $field ];
			}
		} else {
			$options = array();

			// Merge options.
			if ( isset( $this->fields[ $field ] ) ) {
				$options = array_merge( $this->fields[ $field ], $this->fields[ $field ]['options'] );
			} elseif ( isset( $this->pod_data['object_fields'] ) ) {
				$options = array_merge( $this->pod_data['object_fields'][ $field ], $this->pod_data['object_fields'][ $field ]['options'] );
			}

			if ( 'data' === $option && in_array( pods_v( 'type', $options ), PodsForm::tableless_field_types(), true ) ) {
				// Get a list of available items from a relationship field.
				$field_data = PodsForm::field_method( 'pick', 'get_field_data', $options );
			} elseif ( isset( $options[ $option ] ) ) {
				// Return option.
				$field_data = $options[ $option ];
			}
		}//end if

		/**
		 * Modify the field data before returning
		 *
		 * @since unknown
		 *
		 * @param array       $field_data The data for the field.
		 * @param string|null $field      The specific field that data is being return for, if set when method is called or null.
		 * @param string|null $option     Value of option param when method was called. Can be used to get a list of available items from a relationship field.
		 * @param Pods|object $this       The current Pods class instance.
		 */
		return apply_filters( 'pods_pods_fields', $field_data, $field, $option, $this );

	}
986503
public function formatSelectFields(array $fields, $alias = null) {
        $columns = [];
        $quotedAlias = $alias ? $this->quote($alias) . '.' : '';
        $virtualJoins = $this->getConfig('virtualJoins');

        if (empty($fields)) {
            $columns[] = $quotedAlias . '*';

        } else {
            foreach ($fields as $field) {
                if ($field instanceof Func) {
                    $columns[] = $this->formatFunction($field);

                } else if ($field instanceof Expr) {
                    $columns[] = $this->formatExpression($field);

                } else if ($field instanceof RawExpr) {
                    $columns[] = $field->getValue(); // must come after other expressions

                } else if ($field instanceof SubQuery) {
                    $columns[] = $this->formatSubQuery($field);

                } else if (preg_match('/^(.*?)\s+AS\s+(.*?)$/i', $field, $matches)) {
                    $columns[] = sprintf($this->getClause(self::AS_ALIAS), $quotedAlias . $this->quote($matches[1]), $this->quote($matches[2]));

                // Alias the field for drivers that don't support PDO::getColumnMeta()
                } else if ($virtualJoins && $alias) {
                    $columns[] = sprintf($this->getClause(self::AS_ALIAS), $quotedAlias . $this->quote($field), $alias . '__' . $field);

                } else {
                    $columns[] = $quotedAlias . $this->quote($field);
                }
            }
        }

        return $columns;
    }
763041
public function selectMore($field, string $as = null): self
    {
        return $this->select($field, $as, false);
    }
780034
public ASTField getField(Field field) {
        ASTAccessModifier modifier = ASTAccessModifier.getModifier(field.getModifiers());

        return new ASTClassField(field, getType(field.getType(), field.getGenericType()), modifier, getAnnotations(field));
    }
150977
private function normalizeField($field, $actions)
    {
        $getter = 'get' . ucfirst($field);
        if (!method_exists($this->object, $getter)) {
            $this->logger->warn(
                "[NormalizeListener] Method « $getter » does not exist for Entity",
                ['class' => get_class($this->object)]
            );

            return;
        }

        $data = $this->object->$getter();
        $normalized = false;
        foreach ($actions as $action) {
            switch ($action) {
                case 'uppercase':
                case 'upper':
                    $data = mb_strtoupper($data);
                    $normalized = true;
                    break;
                case 'titlecase':
                case 'title':
                    $data = mb_convert_case($data, MB_CASE_TITLE);
                    $normalized = true;
                    break;
                default:
                    $this->logger->warn(
                        "[NormalizeListener] Action « $action » is not in defined normalizers list",
                        ['class' => get_class($this->object)]
                    );
            }
        }
        if (!$normalized) {
            return;
        }

        $setter = 'set' . ucfirst($field);
        if (!method_exists($this->object, $setter)) {
            $this->logger->warn(
                "[NormalizeListener] Method « $setter » does not exist for Entity",
                ['class' => get_class($this->object)]
            );

            return;
        }

        $this->object->$setter($data);
        $this->logger->debug(
            "[NormalizeListener] Normalized field « $field » for Entity",
            ['class' => get_class($this->object), 'field' => $field, 'actions' => implode(', ', $actions)]
        );

        return $data;
    }
1112619
private function getSelectAs(DoctrineFieldDescriptorInterface $field, $hidden = false)
    {
        $select = $field->getSelect() . ' AS ';

        if ($hidden) {
            $select .= 'HIDDEN ';
        }

        return $select . $field->getName();
    }
1366958
public function castingHelper($field)
    {
        $copy = $this->CopyContentFrom();
        if ($copy && $copy->exists() && ($helper = $copy->castingHelper($field))) {
            return $helper;
        }
        return parent::castingHelper($field);
    }
113255
public function type($field)
    {
        $parts = explode('.', $field);
        $table = $this->_getTable($parts);

        return $table->getSchema()->baseColumnType(array_pop($parts));
    }