Replace use of Configurable stat() with config()->get(), will be deprecated in future

This commit is contained in:
Robbie Averill 2017-08-23 09:42:10 +12:00
parent 9b4d689bb2
commit 8ebc13ae4e
7 changed files with 15 additions and 15 deletions

View File

@ -201,7 +201,7 @@ abstract class BulkLoader extends ViewableData
*/
public function Title()
{
$title = $this->stat('title');
$title = $this->config()->get('title');
return $title ?: static::class;
}

View File

@ -329,7 +329,7 @@ class GridFieldAddExistingAutocompleter implements GridField_HTMLProvider, GridF
$obj = DataObject::singleton($dataClass);
$fields = null;
if ($fieldSpecs = $obj->searchableFields()) {
$customSearchableFields = $obj->stat('searchable_fields');
$customSearchableFields = $obj->config()->get('searchable_fields');
foreach ($fieldSpecs as $name => $spec) {
if (is_array($spec) && array_key_exists('filter', $spec)) {
// The searchableFields() spec defaults to PartialMatch,

View File

@ -652,7 +652,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
*/
public function singular_name()
{
$name = $this->stat('singular_name');
$name = $this->config()->get('singular_name');
if ($name) {
return $name;
}
@ -688,7 +688,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
*/
public function plural_name()
{
if ($name = $this->stat('plural_name')) {
if ($name = $this->config()->get('plural_name')) {
return $name;
}
$name = $this->singular_name();
@ -1354,7 +1354,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
$this->record['Created'] = $now;
}
$this->record['LastEdited'] = $now;
// New records have their insert into the base data table done first, so that they can pass the
// generated primary key on to the rest of the manipulation
$baseTable = $this->baseTable();
@ -3083,7 +3083,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
$fields,
$indexes,
$hasAutoIncPK,
$this->stat('create_table_options'),
$this->config()->get('create_table_options'),
$extensions
);
} else {
@ -3173,7 +3173,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
public function searchableFields()
{
// can have mixed format, need to make consistent in most verbose form
$fields = $this->stat('searchable_fields');
$fields = $this->config()->get('searchable_fields');
$labels = $this->fieldLabels();
// fallback to summary fields (unless empty array is explicitly specified)
@ -3221,7 +3221,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
// 'title' => 'My Title', // optional
// ))
$rewrite[$identifer] = array_merge(
array('filter' => $this->relObject($identifer)->stat('default_search_filter_class')),
array('filter' => $this->relObject($identifer)->config()->get('default_search_filter_class')),
(array)$specOrName
);
} else {
@ -3275,7 +3275,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
$cacheKey = static::class . '_' . $includerelations;
if (!isset(self::$_cache_field_labels[$cacheKey])) {
$customLabels = $this->stat('field_labels');
$customLabels = $this->config()->get('field_labels');
$autoLabels = array();
// get all translated static properties as defined in i18nCollectStatics()
@ -3336,7 +3336,7 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
*/
public function summaryFields()
{
$fields = $this->stat('summary_fields');
$fields = $this->config()->get('summary_fields');
// if fields were passed in numeric array,
// convert to an associative array

View File

@ -171,7 +171,7 @@ class DataQuery
$this->query = new SQLSelect(array());
$this->query->setDistinct(true);
if ($sort = singleton($this->dataClass)->stat('default_sort')) {
if ($sort = singleton($this->dataClass)->config()->get('default_sort')) {
$this->sort($sort);
}

View File

@ -580,7 +580,7 @@ abstract class DBField extends ViewableData implements DBIndexable
public function defaultSearchFilter($name = null)
{
$name = ($name) ? $name : $this->name;
$filterClass = $this->stat('default_search_filter_class');
$filterClass = $this->config()->get('default_search_filter_class');
return Injector::inst()->create($filterClass, $name);
}

View File

@ -547,7 +547,7 @@ class Security extends Controller implements TemplateGlobalProvider
protected function getResponseController($title)
{
// Use the default setting for which Page to use to render the security page
$pageClass = $this->stat('page_class');
$pageClass = $this->config()->get('page_class');
if (!$pageClass || !class_exists($pageClass)) {
return $this;
}
@ -1026,7 +1026,7 @@ class Security extends Controller implements TemplateGlobalProvider
[
"Security_{$action}",
"Security",
$this->stat("template_main"),
$this->config()->get("template_main"),
"BlankPage"
]
);

View File

@ -35,7 +35,7 @@ interface i18nEntityProvider
* public function provideI18nEntities()
* {
* $entities = [];
* foreach($this->stat('my_static_array) as $key => $value) {
* foreach($this->config()->get('my_static_array) as $key => $value) {
* $entities["MyTestClass.my_static_array_{$key}"] = $value;
* }
* $entities["MyTestClass.PLURALS"] = [