You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The spatial types example should be used as a normal type (e.g. Type::INTEGER, Type::STRING or DateTimeType::NAME).
Row Attributes are simply added to SELECT when data are read from a database without any changes. I use them to call various functions and add columns with their results. For example, if I have a column that links to some user, I can add an extra column that would have user's name
/** * @inheritdoc */publicstaticfunctiongetRawAttributes(): array
{
return [
[self::class, 'getRawAttributeFullName'],
] + parent::getRawAttributes();
}
/** * Called to add an extra column in SELECT statements. * * @param ModelQueryBuilder $builder * * @return string */publicstaticfunctiongetRawAttributeFullName(ModelQueryBuilder$builder): string
{
$function = UserFullNameFunctionMigration::FUNCTION_NAME;
$userId = $builder->getQuotedMainAliasColumn(self::FIELD_ID_USER);
$columnName = self::V_FIELD_AUTHOR_FULL_NAME;
return"$function($userId) AS $columnName";
}
Curious if the getRawAttributes() can be used for storing spatial data type.
The text was updated successfully, but these errors were encountered: