@param string $columnName

@return Type

@throws RuntimeException
494929
public static function getTypeOfColumn($columnName, ClassMetadata $class, EntityManagerInterface $em)
    {
        if (isset($class->fieldNames[$columnName])) {
            $fieldName = $class->fieldNames[$columnName];
            $property  = $class->getProperty($fieldName);

            switch (true) {
                case $property instanceof FieldMetadata:
                    return $property->getType();

                // Optimization: Do not loop through all properties later since we can recognize to-one owning scenario
                case $property instanceof ToOneAssociationMetadata:
                    // We know this is the owning side of a to-one because we found columns in the class (join columns)
                    foreach ($property->getJoinColumns() as $joinColumn) {
                        if ($joinColumn->getColumnName() !== $columnName) {
                            continue;
                        }

                        $targetClass = $em->getClassMetadata($property->getTargetEntity());

                        return self::getTypeOfColumn($joinColumn->getReferencedColumnName(), $targetClass, $em);
                    }

                    break;
            }
        }

        // iterate over association mappings
        foreach ($class->getDeclaredPropertiesIterator() as $association) {
            if (! ($association instanceof AssociationMetadata)) {
                continue;
            }

            // resolve join columns over to-one or to-many
            $targetClass = $em->getClassMetadata($association->getTargetEntity());

            if (! $association->isOwningSide()) {
                $association = $targetClass->getProperty($association->getMappedBy());
                $targetClass = $em->getClassMetadata($association->getTargetEntity());
            }

            $joinColumns = $association instanceof ManyToManyAssociationMetadata
                ? $association->getJoinTable()->getInverseJoinColumns()
                : $association->getJoinColumns();

            foreach ($joinColumns as $joinColumn) {
                if ($joinColumn->getColumnName() !== $columnName) {
                    continue;
                }

                return self::getTypeOfColumn($joinColumn->getReferencedColumnName(), $targetClass, $em);
            }
        }

        throw new RuntimeException(sprintf(
            'Could not resolve type of column "%s" of class "%s"',
            $columnName,
            $class->getClassName()
        ));
    }
1366618
public function get($className = null)
    {
        $this->parseDefer();
        if(!$this->isSuccess)
        {
            throw new \RuntimeException('Result is not success!');
        }
        $result = $this->statement->fetch();
        if(false === $result)
        {
            return null;
        }

        if(null === $className)
        {
            $className = $this->modelClass;
        }
        if(null === $className)
        {
            return $result;
        }
        else
        {
            if(is_subclass_of($className, Model::class))
            {
                $object = BeanFactory::newInstance($className, $result);
            }
            else
            {
                $object = BeanFactory::newInstance($className);
                foreach($result as $k => $v)
                {
                    $object->$k = $v;
                }
            }
            if(is_subclass_of($object, IEvent::class))
            {
                $className = BeanFactory::getObjectClass($object);
                $object->trigger(ModelEvents::AFTER_QUERY, [
                    'model'      =>  $object,
                ], $object, AfterQueryEventParam::class);
            }
            return $object;
        }
    }
406397
private function createWithReflection($className)
    {
        $class = new ReflectionClass($className);
        $prototypeInstance = $class->newInstanceWithoutConstructor();

        /**
         * @var IPrototype $prototype
         */
        $prototype = new $this->prototypeClass(
            $prototypeInstance,
            $class->getInterfaceNames(),
            $this->getClassConstructorInfo($class),
            $this->getClassOptions($class, $prototypeInstance)
        );

        if (!$prototype instanceof IPrototype) {
            throw new RuntimeException(sprintf(
                'Prototype class "%s" should implement IPrototype.',
                $this->prototypeClass
            ));
        }

        return $prototype;
    }
1036010
public function getColumn($column = 0)
    {
        $this->parseDefer();
        if(!$this->isSuccess)
        {
            throw new \RuntimeException('Result is not success!');
        }
        return $this->statement->fetchAll(\PDO::FETCH_COLUMN, $column);
    }
783564
final private static function getColumnType($fieldName) {
		
		$db = Database::getInstance();
		$column = $db->describeColumn(static::TABLE_NAME, $fieldName);
		
		if (is_null($column)) {
			return NULL;
		}
		
		// split the column Type to recognize field type and length
		preg_match('#^([\w]+)(\([^\)]+\))? ?(unsigned)?#i', $column->Type, $matches);
		
		$field = new \stdClass();
		
		$field->name	= $fieldName;
		$field->type	= $matches[1];
		$field->unsigned= (isset($matches[3]));
		$field->nullable= 'YES' == $column->Null ? TRUE : FALSE;
		$field->key		= $column->Key;
		$field->default	= $column->Default;
		$field->extra	= $column->Extra;

		if (isset($matches[2])) {
			if (in_array($field->type, ['enum','set'])) {
				$field->length = explode("','", substr($matches[2], 2, -2));
			} else {
				$field->length = explode(",", substr($matches[2], 1, -1));
			}
		} else {
			$field->length = NULL;
		}
		
		return $field;
		
	}
1321993
protected static function checkColumn($tableName, $columnName, $con=NULL)
    {
        $connection = self::checkConnection($con);

            $result = $connection->prepare("SELECT {$columnName} FROM {$tableName}");
            $result->execute();
            if (! $result->columnCount())
            {
                throw new ColumnNotExistExeption();
            }
            return $columnName;
    }
206334
public function dropColumn($columnName)
    {
        $columnName = $this->normalizeIdentifier($columnName);
        unset($this->_columns[$columnName]);

        return $this;
    }
515833
public function getColumn($columnName)
    {
        $columnName = $this->normalizeIdentifier($columnName);
        if (! $this->hasColumn($columnName)) {
            throw SchemaException::columnDoesNotExist($columnName, $this->_name);
        }

        return $this->_columns[$columnName];
    }
156493
public function getTypeByName($name)
    {
        foreach ($this->collection as $type) {
            /** @var $type TypeInterface */
            if ($type->getName() === $name) {
                return $type;
            }
        }

        throw new \RuntimeException(\sprintf('No type found for name %s, list: %s', \var_export($name, true), \var_export($this->collection, true)));
    }
276797
public static function fromFile($filename): self
    {
        if (!is_readable($filename) ||
             false === ($str = file_get_contents($filename))) {
            throw new \RuntimeException("Failed to read $filename.");
        }
        return self::fromString($str);
    }
335456
public function getColumnType($tableName, $columnName) {
        $columns = $this->getTableColumns($tableName);
        foreach ($columns as $column) {
            if ($column['Field'] != $columnName)
                continue;
            $type = explode('(', $column['Type'], 2);
            return $type[0];
        }
        throw new \Exception("Column `$columnName` not found in table `$tableName`!");
    }
869607
public function create(string $className, string $typeName): Type
    {
        $type = new InputObjectType([
            'name' => $typeName,
            'description' => 'Type to specify join tables in a filter',
            'fields' => function () use ($className): array {
                return $this->getJoinsFields($className);
            },
        ]);

        return $type;
    }
231425
public function isCustomColumn($columnName)
    {
        $columnName = str_replace('.', '_', $columnName);
        $methodName = camel_case('laratables_custom_'.$columnName);

        if (method_exists($this->class, $methodName)) {
            return $methodName;
        }

        return false;
    }
992600
public static function toMigrationMethodName($type, $columnName)
    {
        $typeMap = self::getDoctrineTypeMap();

        if (!in_array($type, $typeMap)) {
            throw new SystemException(sprintf('Unknown column type: %s', $type));
        }

        // Some Doctrine types map to multiple migration types, for example
        // Doctrine boolean could be boolean and tinyInteger in migrations.
        // Some guessing could be required in this method. The method is not
        // 100% reliable.

        if ($type == DoctrineType::DATETIME) {
            // The datetime type maps to datetime and timestamp. Use the name 
            // guessing as the only possible solution.

            if (in_array($columnName, ['created_at', 'updated_at', 'deleted_at', 'published_at', 'deleted_at'])) {
                return self::TYPE_TIMESTAMP;
            }

            return self::TYPE_DATETIME;
        }

        $typeMap = array_flip($typeMap);
        return $typeMap[$type];
    }
406484
function columnType($fieldname, $source)
    {
        $column = self::describeColumn($fieldname, $source);
        if ( ! $column ) throw new \Exception("Could not find $fieldname");
        $type = U::get($column, "Type");
        if ( ! $type ) return null;
        if ( strpos($type, '(') === false ) return $type;
        $matches = array();
        preg_match('/([a-z]+)\([0-9]+\)/', $type, $matches);
        if ( count($matches) == 2 ) return $matches[1];
        return null;
    }
1022178
public function getPropertiesRequiredFor(string $columnName) : array
    {
        $propertyNames = [];

        foreach ($this->propertyComponentIdMap as $propertyName => $componentId) {
            if ($this->getColumnNameFromComponentId($componentId) === $columnName) {
                $propertyNames[$propertyName] = $propertyName;
            }
        }

        return $propertyNames;
    }
868624
public static function findByID($userID, $columnName = '')
    {
        $userObj = User::where('userID', $userID)->first();

        // return custom column
        if ($columnName && isset($userObj->$columnName)) {
            return $userObj->$columnName;
        }

        return $userObj;
    }