Get relation

@param string $attribute The attribute name
@return \ActiveQuery
324715
public function fileRelation($attribute)
    {
        if ($this->relation === null) {
            $this->relation = $this->owner->getRelation($this->fileOption($attribute, 'relation'));
        }
        return $this->relation;
    }
153351
protected function getAttribute( $attribute )
	{
		$primaryAttribute = $this->getPrimaryAttribute( $attribute );

		$expectedAttributes = $attribute != $primaryAttribute ? [$attribute, $primaryAttribute] : [$attribute];

		foreach ( $expectedAttributes as $expectedAttributeName )
		{
			// The developer may dynamically specify the array of custom attributes
			// on this Validator instance. If the attribute exists in this array
			// it takes precedence over all other ways we can pull attributes.
			if ( isset( $this->customAttributes[$expectedAttributeName] ) )
			{
				return $this->customAttributes[$expectedAttributeName];
			}

			$key = "validation.attributes.{$expectedAttributeName}";

			// We allow for the developer to specify language lines for each of the
			// attributes allowing for more displayable counterparts of each of
			// the attributes. This provides the ability for simple formats.
			if ( ( $line = $this->translator->trans( $key ) ) !== $key )
			{
				return $line;
			}
		}

		// When no language line has been specified for the attribute and it is
		// also an implicit attribute we will display the raw attribute name
		// and not modify it with any replacements before we display this.
		if ( isset( $this->implicitAttributes[$primaryAttribute] ) )
		{
			return $attribute;
		}

		return str_replace( '_', ' ', Str::snake( $attribute ) );
	}
642960
protected function loadModelsOneToMany($attribute)
    {
        $data = $this->relationalData[$attribute];
        
        $activeQuery = $data['activeQuery'];
        $class = $activeQuery->modelClass;

        // default query conditions
        $params = !ArrayHelper::isAssociative($activeQuery->on) ? [] : $activeQuery->on;
        // one-to-many
        foreach ($activeQuery->link as $childAttribute => $parentAttribute) {
            $params[$childAttribute] = $this->owner->$parentAttribute;
        }

        if (!empty($data['data'])) {
            foreach ($data['data'] as $attributes) {
                $model = new $class(
                    array_merge(
                        $params,
                        ArrayHelper::isAssociative($attributes) ? $attributes : []
                    )
                );
                if (isset($this->relations[$attribute]) && is_callable($this->relations[$attribute])) {
                    $model = call_user_func($this->relations[$attribute], $model, $attributes);
                }
                $data['newModels'][] = $model;
            }
        }

        $this->relationalData[$attribute] = $data;
    }
909525
public function getLocaled(string $attribute)
    {
        // if always decoded
        if (Any::isArray($this->{$attribute})) {
            return $this->{$attribute}[App::$Request->getLanguage()];
        }

        if (!Any::isStr($attribute) || Str::likeEmpty($this->{$attribute})) {
            return null;
        }

        return Serialize::getDecodeLocale($this->{$attribute});
    }
1149844
protected function resolveAttribute($model, $attribute)
    {
        $result = $this->mapToClass($model->{$this->attribute . '_type'});

        foreach ($this->meta['types'] as $type) {

            $relatedModel = new $type['value'];

            if($this->mapToKey($type['value']) == $model->{$this->attribute . '_type'}) {
                $relatedModel = ($model->{$this->attribute}) ? $model->{$this->attribute}
                     : $relatedModel->newQuery()->findOrFail($model->{$this->attribute . '_id'});
            }

            foreach ($type['fields'] as $field) {
                $field->resolve($relatedModel);
            }

        }

        return $result;
    }
632411
public function getDbAttribute($attribute, $default = null)
    {
        return isset($this->_dbAttributes[$attribute]) ? $this->_dbAttributes[$attribute] : $default;
    }
1047031
protected function getAttribute($attribute)
	{
		// The developer may dynamically specify the array of custom attributes
		// on this Validator instance. If the attribute exists in this array
		// it takes precedence over all other ways we can pull attributes.
		if (isset($this->customAttributes[$attribute]))
		{
			return $this->customAttributes[$attribute];
		}

		$key = "validation.attributes.{$attribute}";

		// We allow for the developer to specify language lines for each of the
		// attributes allowing for more displayable counterparts of each of
		// the attributes. This provides the ability for simple formats.
		if (($line = $this->translator->trans($key)) !== $key)
		{
			return $line;
		}

		// If no language line has been specified for the attribute all of the
		// underscores are removed from the attribute name and that will be
		// used as default versions of the attribute's displayable names.
		return str_replace('_', ' ', snake_case($attribute));
	}
131820
public function getAttribute( $attribute ) {
		$data = $this->getData();

		return ! empty ( $data[$attribute] ) ? $data[$attribute] : '';
	}
1137316
public function resolveModelAttribute($attribute)
    {
        try {
            return $this->formField->resolveModelAttribute($this->model, $attribute);
        }
        catch (Exception $ex) {
            throw new ApplicationException(Lang::get('backend::lang.model.missing_relation', [
                'class' => get_class($this->model),
                'relation' => $attribute
            ]));
        }
    }
789311
public function getRelation($relation)
    {
        $query = Relation::noConstraints(function() use ($relation)
        {
            return $this->getModel()->$relation();
        });

        $nested = $this->nestedRelations($relation);

        if (count($nested) > 0) {
            $query->getQuery()->with($nested);
        }

        return $query;
    }
940864
protected function getAttributeId($attribute)
	{
		return isset($this->htmlOptions['id'])
			? $this->htmlOptions['id']
			: CHtml::getIdByName(CHtml::resolveName($this->model, $attribute));
	}
937301
public function getAttribute($key)
	{
		if (isset($this->attributes[$key]))
			return $this->attributes[$key];

		if (isset($this->relationships[$key]))
			return $this->relationships[$key];

		return null;
	}
1198273
public function getAttribute($attribute)
    {
        switch ($attribute) {
            case self::ATTR_PERSISTENT:
                return false;

            case self::ATTR_PREFETCH:
                return false;

            case self::ATTR_CLIENT_VERSION:
                return self::VERSION;

            case self::ATTR_SERVER_VERSION:
                return $this->server->getServerVersion();

            case self::ATTR_SERVER_INFO:
                return $this->server->getServerInfo();

            case self::ATTR_TIMEOUT:
                return $this->attributes['timeout'];

            case self::CRATE_ATTR_HTTP_BASIC_AUTH:
                return $this->attributes['auth'];

            case self::ATTR_DEFAULT_FETCH_MODE:
                return $this->attributes['defaultFetchMode'];

            case self::ATTR_ERRMODE:
                return $this->attributes['errorMode'];

            case self::ATTR_DRIVER_NAME:
                return static::DRIVER_NAME;

            case self::ATTR_STATEMENT_CLASS:
                return [$this->attributes['statementClass']];

            case self::CRATE_ATTR_DEFAULT_SCHEMA:
                return $this->attributes['defaultSchema'];

            case self::CRATE_ATTR_SSL_MODE:
                return $this->attributes['sslMode'];

            case self::CRATE_ATTR_SSL_CA_PATH:
                return $this->attributes['sslCa'] ?? null;

            case self::CRATE_ATTR_SSL_CA_PASSWORD:
                return $this->attributes['sslCaPassword'] ?? null;

            case self::CRATE_ATTR_SSL_CERT_PATH:
                return $this->attributes['sslCert'] ?? null;

            case self::CRATE_ATTR_SSL_CERT_PASSWORD:
                return $this->attributes['sslCertPassword'] ?? null;

            case self::CRATE_ATTR_SSL_KEY_PATH:
                return $this->attributes['sslKey'] ?? null;

            case self::CRATE_ATTR_SSL_KEY_PASSWORD:
                return $this->attributes['sslKeyPassword'] ?? null;

            default:
                // PHP Switch is a lose comparison
                if ($attribute === self::ATTR_AUTOCOMMIT) {
                    return true;
                }

                throw new Exception\PDOException(sprintf('Unsupported driver attribute: %s', $attribute));
        }
    }
356228
public function getAttribute(string $attribute): array
    {
        // Determine if the attribute is present
        if (! array_key_exists($attribute, $this->attributes)) {
            return [];
        }

        // Return the value of the attribute
        return $this->attributes[$attribute];
    }
423598
private function getRelated($name)
    {
        $relation = &static::$relations[$name];
        $class    = $relation[0];
        $FKName   = isset($relation[1]) ? $relation[1] : static::$PKFieldName[0];

        $related = &$this->related[$name];

        return $related === null
            ? $related = new $class($this->$FKName)
            : $related;
    }
715090
public function getAttribute($attribute)
    {
        switch ($attribute) {
            case self::PROPEL_ATTR_CACHE_PREPARES:
                return $this->cachePreparedStatements;
                break;
            case self::PROPEL_ATTR_CONNECTION_NAME:
                return $this->connectionName;
                break;
            default:
                return parent::getAttribute($attribute);
        }
    }
852902
public function attr($attribute)
    {
        if (!$this->nodes) {
            throw new \InvalidArgumentException('The current node list is empty.');
        }

        $node = $this->getNode(0);

        return $node->hasAttribute($attribute) ? $node->getAttribute($attribute) : null;
    }