Returns the datatype of the field, the default datatype, string, is set in the getValidation() function.

@param string $key The name of the field

@return string
353951
public function getDatatype($key)
    {

        $validation = $this->getValidation($key);

        if(empty($validation['datatype']))
            throw new Exception('No datatype defined for key: '.$key);

        return $validation['datatype'];
    }
209005
public function getDataType($key)
    {
        // check for existing datatype, and raise an exception
        // if it doesn't exist. Usefull when new data type defined
        // in the new version of MySQL Workbench
        if (isset($this->dataTypes[$key])) {
            return $this->dataTypes[$key];
        } elseif (isset($this->userDatatypes[$key])) {
            return $this->userDatatypes[$key];
        } else {
            throw new \RuntimeException(sprintf('Unknown data type "%s".', $key));
        }
    }
525615
protected function objectForKey($key)
    {
        /**
         * Fixes https://github.com/silverstripe/silverstripe-framework/issues/8332
         *
         * Due to historic reasons, the default (empty) value for this field is 'unchanged', even though
         * the field is usually integer on the database side.
         * MySQL handles that gracefully and returns an empty result in that case,
         * whereas some other databases (e.g. PostgreSQL) do not support comparison
         * of numeric types with string values, issuing a database error.
         *
         * This fix is not ideal, but supposed to keep backward compatibility for SS4.
         *
         * In 5.0 this method to be removed and NULL should be used instead of 'unchanged' (or an empty array. to be decided).
         * In 5.0 this class to be refactored so that $this->value is always an array of values (or null)
         */
        if ($this->getKeyField() === 'ID' && $key === 'unchanged') {
            $key = null;
        } elseif (is_string($key)) {
            $key = preg_split('/\s*,\s*/', trim($key));
        }

        return parent::objectForKey($key);
    }
1294236
public static function getValue(string $key)
    {
        $key = \mb_strtolower($key);
        if(isset(self::$_data[$key])) {
            return self::$_data[$key];
        }
        return null;
    }
1267197
public function getAttribute($key)
    {
        //set default language
        if(!$this->_defaultTranslateLanguage) {
            $this->setDefaultTranslateLanguage();
        }

        // In case we just need the translation for current property
        if(!$this->getTranslateLanguage()) {
            $this->translate($this->_defaultTranslateLanguage);
        }

        if(method_exists($this, 'isCustomField') && $this->isCustomField($key)) {
            $value = $this->customFieldValue($key);

            // If the given $attribute has a mutator, we push it to $attributes and then call getAttributeValue
            // on it. This way, we can use Eloquent's checking for Mutation, type casting, and
            // Date fields.
            if ($this->hasGetMutator($key)) {
                $this->attributes[$key] = $value;
                $value = $this->getAttributeValue($key);
            }
        }else{
            //is translatable value
            $value = parent::getAttribute($key);

            if ($this->autoTranslate && $this->isTranslatable($value, $key)) {

                // If the given $attribute has a mutator, we push it to $attributes and then call getAttributeValue
                // on it. This way, we can use Eloquent's checking for Mutation, type casting, and
                // Date fields.
                if ($this->hasGetMutator($key)) {
                    $this->attributes[$key] = $this->getTranslation($value);
                    $value = $this->getAttributeValue($key);
                }else {
                    $value = $this->getTranslation($value);
                }

                // we don't need current language any more, we have the default une
                $this->resetTranslateLanguage();
            }else{

                // If the given $attribute has a mutator, we push it to $attributes and then call getAttributeValue
                // on it. This way, we can use Eloquent's checking for Mutation, type casting, and
                // Date fields.
                if ($this->hasGetMutator($key)) {
                    $this->attributes[$key] = $value;
                    $value =  $this->getAttributeValue($key);
                }
            }
        }
        //handle custom fields

        return $value;
    }
13549
public function data( $key )
    {

        // string, key clause
        if( is_scalar( $key ) ) {

            $dataTypes = $this->dataTypesGet( DataType::PRIMARY_KEYS );
            try {
                $key = array_combine(
                    array_keys( $dataTypes ),
                    explode( Base::KEY_SEPARATOR, $key )
                );
            } catch ( \Exception $e ) {
                throw new BadKeyException(
                    sprintf(
                        "Passed key `%s` needs %d fragments; it has %d",
                        $key,
                        count( $dataTypes ),
                        count( explode( Base::KEY_SEPARATOR, $key ) )
                    )
                );
            }

        // is array
        } elseif( is_array( $key ) and count( $key ) > 0 ) {

            $dataTypes = $this->dataTypesGet( array_keys( $key ) );

        // bad argument
        } else {
            throw new \InvalidArgumentException("Can't lookup data for entity with this argument -> " . print_r( $key, true ) );
        }

        // we got the right amount of keyFragments?
        if( count($key) !== count($dataTypes) ) {
            throw new \InvalidArgumentException(
                sprintf(
                    "The passed key (%s) can't be married to the repository keys (%s). Epic fail.",
                    print_r($key, true),
                    implode(',', array_keys($dataTypes) )
                )
            );
        }

        // build where clause
        $where = array();
        foreach( $dataTypes as $name => $dataType ) {

            $where[] = sprintf(
                "%s = %s",
                $this->db->quoteIdent( $name ),
                $dataType->toQueryTag()
            );
            $data[$name] = $key[$name];

        }

        // build query
        $query = new Query(
            sprintf(
                "SELECT * FROM ONLY %s WHERE %s",
                $this->db->quoteIdent( $this->__get('table') ),
                implode( ' AND ', $where )
            ),
            $data
        );

        $result = $this->db->query( $query );
        $data = $result->fetch( Result::FETCH_SINGLE | Result::FLATTEN_PREVENT );

        return $data;

    }
1166840
public function attribute(string $key)
    {
        if (! isset($this->attributes[$key])) {
            return '';
        }

        return $this->attributes[$key];
    }
739955
private function Lang($key) {
    if(count($this->language) < 1) {
      $this->SetLanguage('en'); // set the default language
    }

    if(isset($this->language[$key])) {
      return $this->language[$key];
    } else {
      return 'Language string failed to load: ' . $key;
    }
  }
331455
protected function getCastType($key)
    {
        if ($this->isCustomDateTimeCast($this->getCasts()[$key])) {
            return 'custom_datetime';
        }

        if ($this->isDecimalCast($this->getCasts()[$key])) {
            return 'decimal';
        }

        return trim(strtolower($this->getCasts()[$key]));
    }
888683
public function getValidationValue($key, $default = null)
    {
        if (is_array($this->validation) && array_key_exists($key, $this->validation)) {
            return $this->validation[$key];
        }

        return $default;
    }
703576
protected function _validateDataKey($key, $data)
    {
        $dataOkFlag = true;

        if (!$this->_validationOn) {
            return $dataOkFlag;
        }

        foreach ($this->_validationRules as $ruleKey => $ruleValue) {
            if (!preg_match($ruleKey, $key)) {
                continue;
            }

            $bool = $this->_validateData($ruleValue, $key, $data);
            if (!$bool) {
                $dataOkFlag = false;
            }
        }

        return $dataOkFlag;
    }
1308804
public function get($key) {
		$row = $this->db->dal()->from($this->getTable())->where('key', $key)->first();
		if(isset($row['value'])) {
			$res = unserialize($row['value']);
			if(isset($res['_dataType']) && isset($res['input']))
				return $this->types[$res['_dataType']][1]($res['input']);
			else
				return $res;
		}
	}
937668
public function get($key, $default = null)
    {
        $key = strtolower($key);

        if (!array_key_exists($key, $this->data)) {
            if (null === $default) {
                return null;
            }

            return $default;
        }

        return $this->data[$key];
    }
1227703
public function getAttribute($key)
    {
        $value = parent::getAttribute($key);

        if ($key === 'name') {
            $value = str_replace($this->multiValueSuffix, '', $value);
        }

        return $value;
    }
1188315
public static function get($key = null, $default = '')
    {
        if (empty($key)) {
            return '';
        }
        $key = strtolower($key);
        $val = Cml::doteToArr($key, self::$lang);

        if (is_null($val)) {
            return is_array($default) ? '' : $default;
        } else {
            if (is_array($default)) {
                $keys = array_keys($default);
                $keys = array_map(function ($key) {
                    return '{' . $key . '}';
                }, $keys);
                return str_replace($keys, array_values($default), $val);
            } else {
                $replace = func_get_args();
                $replace[0] = $val;
                return call_user_func_array('sprintf', array_values($replace));
            }
        }
    }
830317
public static function get($key, $default = null)
    {
        $value = static::getRaw($key, $default);

        if (is_string($value)) {
            // Convert some common values into their scalar types.
            switch (strtolower($value)) {
                case 'true':
                    return true;

                case 'false':
                    return false;

                case 'null':
                    return null;
            }

            // Strip "" if the string is wrapped in them.
            if (Str::beginsWith($value, '"') && Str::endsWith($value, '"')) {
                return substr($value, 1, -1);
            }
        }

        return $value;
    }
356350
public function getValue($key)
    {
        return isset($this->langstrings[$key]) ? $this->langstrings[$key] : null;
    }