PHP Класс FluentExtension

Автор: Damian Mooyman ([email protected])
Наследование: extends DataExtension
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$_enable_write_augmentation
$disable_fluent_fields boolean Hook allowing temporary disabling of extra fluent fields
$translated_fields_for_cache array Cache for list of translated fields for all inspected classes

Открытые методы

Метод Описание
BaseURLForLocale ( string $locale = null ) : string Determine the baseurl within a specified $locale.
CurrentLocale ( ) : string Current locale code
LocaleInformation ( string $locale = null ) : ArrayData Retrieves information about this object in the specified locale
LocaleLink ( string $locale ) : string Determine the link to this object given the specified $locale.
Locales ( ) : ArrayList Templatable list of all locales
augmentDataQueryCreation ( SQLQuery $query, DataQuery $dataQuery ) Amend freshly created DataQuery objects with the current locale and frontend status
augmentSQL ( SQLQuery &$query, DataQuery &$dataQuery = null )
augmentWrite ( &$manipulation )
base_indexes ( $class )
generate_extra_config ( string $class ) Generates the extra DB fields for a class (not including subclasses)
get_extra_config ( $class, $extension, $args )
isFieldNullable ( string $field ) : boolean Can this field be left empty?
onBeforeWrite ( )
set_enable_write_augmentation ( $enabled ) * Enable or disable write augmentations. Useful for setting up test cases with specific hard coded values.
translated_fields_for ( $class ) : array Determines the fields to translate on the given class
updateCMSFields ( FieldList $fields )

Защищенные методы

Метод Описание
addLocaleIndicatorMessage ( FieldList $fields ) Adds a UI message to indicate whether you're editing in the default locale or not
detectFilterColumn ( string $condition, array $includedTables ) : array Determines the table/column identifier that first appears in the $condition, and returns the localised version of that column.
determine_index_type ( type $spec ) : string Given an index spec determines the index type
explode_column_string ( string $spec ) : array Splits a spec string safely, considering quoted columns, whitespace, and cleaning brackets
getTranslatedTables ( ) : array Get all database tables in the class ancestry and their respective translatable fields
implode_column_list ( array $columns ) : string Builds a properly quoted column list from an array
localiseFilterCondition ( string $condition, array $includedTables, string $locale ) : string Replaces all columns in the given condition with any localised
localiseSelect ( string $class, string $select, string $fallback ) : string Generates a select fragment based on a field with a fallback
parse_index_spec ( $name, string | array $spec ) : array Converts an array or string index spec into a universally useful array
quote_column_spec_string ( string $spec ) : string Given an index specification in the form of a string ensure that each column name is property quoted, stripping brackets and modifiers.
without_fluent_fields ( callback $callback ) : mixed Executes a callback with extra fluent fields disabled

Описание методов

BaseURLForLocale() публичный Метод

Determine the baseurl within a specified $locale.
public BaseURLForLocale ( string $locale = null ) : string
$locale string Locale, or null to use current locale
Результат string

CurrentLocale() публичный Метод

Current locale code
public CurrentLocale ( ) : string
Результат string Locale code

LocaleInformation() публичный Метод

Retrieves information about this object in the specified locale
public LocaleInformation ( string $locale = null ) : ArrayData
$locale string The locale information to request, or null to use the default locale
Результат ArrayData Mapped list of locale properties

Locales() публичный Метод

Templatable list of all locales
public Locales ( ) : ArrayList
Результат ArrayList

addLocaleIndicatorMessage() защищенный Метод

Adds a UI message to indicate whether you're editing in the default locale or not
protected addLocaleIndicatorMessage ( FieldList $fields )
$fields FieldList

augmentDataQueryCreation() публичный Метод

Amend freshly created DataQuery objects with the current locale and frontend status
public augmentDataQueryCreation ( SQLQuery $query, DataQuery $dataQuery )
$query SQLQuery
$dataQuery DataQuery

augmentSQL() публичный Метод

public augmentSQL ( SQLQuery &$query, DataQuery &$dataQuery = null )
$query SQLQuery
$dataQuery DataQuery

augmentWrite() публичный Метод

public augmentWrite ( &$manipulation )

base_indexes() публичный статический Метод

public static base_indexes ( $class )

detectFilterColumn() защищенный Метод

Determines the table/column identifier that first appears in the $condition, and returns the localised version of that column.
protected detectFilterColumn ( string $condition, array $includedTables ) : array
$condition string Condition SQL string
$includedTables array
Результат array Array with items [$table, $column], or null if not found

determine_index_type() защищенный статический Метод

Given an index spec determines the index type
protected static determine_index_type ( type $spec ) : string
$spec type
Результат string

explode_column_string() защищенный статический Метод

Splits a spec string safely, considering quoted columns, whitespace, and cleaning brackets
protected static explode_column_string ( string $spec ) : array
$spec string The input index specification
Результат array List of columns in the spec

generate_extra_config() публичный статический Метод

Generates the extra DB fields for a class (not including subclasses)
public static generate_extra_config ( string $class )
$class string

getTranslatedTables() защищенный Метод

Get all database tables in the class ancestry and their respective translatable fields
protected getTranslatedTables ( ) : array
Результат array

get_extra_config() публичный статический Метод

public static get_extra_config ( $class, $extension, $args )

implode_column_list() защищенный статический Метод

Builds a properly quoted column list from an array
protected static implode_column_list ( array $columns ) : string
$columns array List of columns to implode
Результат string A properly quoted list of column names

isFieldNullable() публичный Метод

Can this field be left empty?
public isFieldNullable ( string $field ) : boolean
$field string
Результат boolean False if the field inherits, true if it is nullable

localiseFilterCondition() защищенный Метод

Replaces all columns in the given condition with any localised
protected localiseFilterCondition ( string $condition, array $includedTables, string $locale ) : string
$condition string Condition SQL string
$includedTables array
$locale string Locale to localise to
Результат string $condition parameter with column names replaced

localiseSelect() защищенный Метод

Generates a select fragment based on a field with a fallback
protected localiseSelect ( string $class, string $select, string $fallback ) : string
$class string Table/Class name
$select string Column to select from
$fallback string Column to fallback to if $select is empty
Результат string Select fragment

onBeforeWrite() публичный Метод

public onBeforeWrite ( )

parse_index_spec() защищенный статический Метод

Converts an array or string index spec into a universally useful array
protected static parse_index_spec ( $name, string | array $spec ) : array
$spec string | array
Результат array The resulting spec array with the required fields name, type, and value

quote_column_spec_string() защищенный статический Метод

This index may also be in the form of a "CREATE INDEX..." sql fragment
protected static quote_column_spec_string ( string $spec ) : string
$spec string The input specification or query. E.g. 'unique (Column1, Column2)'
Результат string The properly quoted column list. E.g. '"Column1", "Column2"'

set_enable_write_augmentation() публичный статический Метод

* Enable or disable write augmentations. Useful for setting up test cases with specific hard coded values.
public static set_enable_write_augmentation ( $enabled )
$enabled

translated_fields_for() публичный статический Метод

Determines the fields to translate on the given class
public static translated_fields_for ( $class ) : array
Результат array List of field names and data types

updateCMSFields() публичный Метод

public updateCMSFields ( FieldList $fields )
$fields FieldList

without_fluent_fields() защищенный статический Метод

Executes a callback with extra fluent fields disabled
protected static without_fluent_fields ( callback $callback ) : mixed
$callback callback
Результат mixed

Описание свойств

$_enable_write_augmentation защищенное статическое свойство

protected static $_enable_write_augmentation

$disable_fluent_fields защищенное статическое свойство

Hook allowing temporary disabling of extra fluent fields
protected static bool $disable_fluent_fields
Результат boolean

$translated_fields_for_cache защищенное статическое свойство

Cache for list of translated fields for all inspected classes
protected static array $translated_fields_for_cache
Результат array