Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
23902766
Commit
23902766
authored
Mar 20, 2014
by
Angie Byron
Browse files
Issue
#2219925
by tim.plunkett: Rename ConfigEntityInterface::getExportProperties() to toArray().
parent
032c3986
Changes
24
Hide whitespace changes
Inline
Side-by-side
core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php
View file @
23902766
...
...
@@ -198,7 +198,7 @@ public static function sort($a, $b) {
/**
* {@inheritdoc}
*/
public
function
getExportProperties
()
{
public
function
toArray
()
{
// Configuration objects do not have a schema. Extract all key names from
// class properties.
$class_info
=
new
\
ReflectionClass
(
$this
);
...
...
core/lib/Drupal/Core/Config/Entity/ConfigEntityInterface.php
View file @
23902766
...
...
@@ -120,6 +120,6 @@ public function set($property_name, $value);
* @return array
* An array of exportable properties and their values.
*/
public
function
getExportProperties
();
public
function
toArray
();
}
core/lib/Drupal/Core/Config/Entity/ConfigStorageController.php
View file @
23902766
...
...
@@ -328,7 +328,7 @@ public function save(EntityInterface $entity) {
}
// Retrieve the desired properties and set them in config.
foreach
(
$entity
->
getExportProperties
()
as
$key
=>
$value
)
{
foreach
(
$entity
->
toArray
()
as
$key
=>
$value
)
{
$config
->
set
(
$key
,
$value
);
}
...
...
core/modules/block/lib/Drupal/block/Entity/Block.php
View file @
23902766
...
...
@@ -127,10 +127,10 @@ public function label() {
}
/**
*
Overrides \Drupal\Core\Config\Entity\ConfigEntityBase::getExportProperties();
*
{@inheritdoc}
*/
public
function
getExportProperties
()
{
$properties
=
parent
::
getExportProperties
();
public
function
toArray
()
{
$properties
=
parent
::
toArray
();
$names
=
array
(
'theme'
,
'region'
,
...
...
core/modules/breakpoint/lib/Drupal/breakpoint/Entity/BreakpointGroup.php
View file @
23902766
...
...
@@ -196,7 +196,7 @@ public function getBreakpointById($id) {
/**
* {@inheritdoc}
*/
public
function
getExportProperties
()
{
public
function
toArray
()
{
$names
=
array
(
'id'
,
'uuid'
,
...
...
core/modules/config/lib/Drupal/config/Tests/ConfigEntityStorageControllerTest.php
View file @
23902766
...
...
@@ -40,7 +40,7 @@ public function testUUIDConflict() {
entity_create
(
$entity_type
,
array
(
'id'
=>
$id
))
->
save
();
$entity
=
entity_load
(
$entity_type
,
$id
);
$original_properties
=
$entity
->
getExportProperties
();
$original_properties
=
$entity
->
toArray
();
// Override with a new UUID and try to save.
$new_uuid
=
$this
->
container
->
get
(
'uuid'
)
->
generate
();
...
...
@@ -56,7 +56,7 @@ public function testUUIDConflict() {
// Ensure that the config entity was not corrupted.
$entity
=
entity_load
(
'config_test'
,
$entity
->
id
(),
TRUE
);
$this
->
assertIdentical
(
$entity
->
getExportProperties
(),
$original_properties
);
$this
->
assertIdentical
(
$entity
->
toArray
(),
$original_properties
);
}
}
core/modules/config/lib/Drupal/config/Tests/ConfigSingleImportExportTest.php
View file @
23902766
...
...
@@ -144,7 +144,7 @@ public function testExport() {
$this
->
assertFieldByXPath
(
'//select[@name="config_name"]//option[@selected="selected"]'
,
t
(
'Fallback date format'
),
'The fallback date format config entity is selected when specified in the URL.'
);
$fallback_date
=
\
Drupal
::
entityManager
()
->
getStorageController
(
'date_format'
)
->
load
(
'fallback'
);
$data
=
\
Drupal
::
service
(
'config.storage'
)
->
encode
(
$fallback_date
->
getExportProperties
());
$data
=
\
Drupal
::
service
(
'config.storage'
)
->
encode
(
$fallback_date
->
toArray
());
$this
->
assertFieldByXPath
(
'//textarea[@name="export"]'
,
$data
,
'The fallback date format config entity export code is displayed.'
);
}
...
...
core/modules/config/tests/config_test/lib/Drupal/config_test/Entity/ConfigTest.php
View file @
23902766
...
...
@@ -77,10 +77,10 @@ class ConfigTest extends ConfigEntityBase implements ConfigTestInterface {
protected
$protected_property
;
/**
*
Overrides \Drupal\Core\Config\Entity\ConfigEntityBase::getExportProperties();
*
{@inheritdoc}
*/
public
function
getExportProperties
()
{
$properties
=
parent
::
getExportProperties
();
public
function
toArray
()
{
$properties
=
parent
::
toArray
();
$protected_names
=
array
(
'protected_property'
,
);
...
...
core/modules/entity/lib/Drupal/entity/Entity/EntityFormDisplay.php
View file @
23902766
...
...
@@ -149,7 +149,7 @@ public function getRenderer($field_name) {
*/
public
function
__sleep
()
{
// Only store the definition, not external objects or derived data.
$keys
=
array_keys
(
$this
->
getExportProperties
());
$keys
=
array_keys
(
$this
->
toArray
());
$keys
[]
=
'entityTypeId'
;
return
$keys
;
}
...
...
@@ -158,8 +158,8 @@ public function __sleep() {
* {@inheritdoc}
*/
public
function
__wakeup
()
{
// Run the values from
getExportProperties
() through __construct().
$values
=
array_intersect_key
(
$this
->
getExportProperties
(),
get_object_vars
(
$this
));
// Run the values from
self::toArray
() through __construct().
$values
=
array_intersect_key
(
$this
->
toArray
(),
get_object_vars
(
$this
));
$this
->
__construct
(
$values
,
$this
->
entityTypeId
);
}
...
...
core/modules/entity/lib/Drupal/entity/EntityDisplayBase.php
View file @
23902766
...
...
@@ -158,7 +158,7 @@ public function postSave(EntityStorageControllerInterface $storage_controller, $
/**
* {@inheritdoc}
*/
public
function
getExportProperties
()
{
public
function
toArray
()
{
$names
=
array
(
'id'
,
'uuid'
,
...
...
core/modules/field/lib/Drupal/field/Entity/FieldConfig.php
View file @
23902766
...
...
@@ -237,7 +237,7 @@ public function id() {
/**
* {@inheritdoc}
*/
public
function
getExportProperties
()
{
public
function
toArray
()
{
$names
=
array
(
'id'
,
'uuid'
,
...
...
@@ -409,7 +409,7 @@ public static function preDelete(EntityStorageControllerInterface $storage_contr
$deleted_fields
=
$state
->
get
(
'field.field.deleted'
)
?:
array
();
foreach
(
$fields
as
$field
)
{
if
(
!
$field
->
deleted
)
{
$config
=
$field
->
getExportProperties
();
$config
=
$field
->
toArray
();
$config
[
'deleted'
]
=
TRUE
;
$config
[
'bundles'
]
=
$field
->
getBundles
();
$deleted_fields
[
$field
->
uuid
]
=
$config
;
...
...
@@ -693,16 +693,16 @@ public function hasData() {
* @todo Investigate in https://drupal.org/node/2074253.
*/
public
function
__sleep
()
{
// Only serialize properties from
getExportProperties
().
return
array_keys
(
array_intersect_key
(
$this
->
getExportProperties
(),
get_object_vars
(
$this
)));
// Only serialize properties from
self::toArray
().
return
array_keys
(
array_intersect_key
(
$this
->
toArray
(),
get_object_vars
(
$this
)));
}
/**
* Implements the magic __wakeup() method.
*/
public
function
__wakeup
()
{
// Run the values from
getExportProperties
() through __construct().
$values
=
array_intersect_key
(
$this
->
getExportProperties
(),
get_object_vars
(
$this
));
// Run the values from
self::toArray
() through __construct().
$values
=
array_intersect_key
(
$this
->
toArray
(),
get_object_vars
(
$this
));
$this
->
__construct
(
$values
);
}
...
...
core/modules/field/lib/Drupal/field/Entity/FieldInstanceConfig.php
View file @
23902766
...
...
@@ -259,7 +259,7 @@ public function __construct(array $values, $entity_type = 'field_instance_config
$this
->
field
=
$field
;
// Discard the 'field_type' entry that is added in config records to ease
// schema generation. See
getExportProperties
().
// schema generation. See
self::toArray
().
unset
(
$values
[
'field_type'
]);
// Check required properties.
...
...
@@ -288,7 +288,7 @@ public function id() {
/**
* {@inheritdoc}
*/
public
function
getExportProperties
()
{
public
function
toArray
()
{
$names
=
array
(
'id'
,
'uuid'
,
...
...
@@ -381,7 +381,7 @@ public static function preDelete(EntityStorageControllerInterface $storage_contr
$deleted_instances
=
$state
->
get
(
'field.instance.deleted'
)
?:
array
();
foreach
(
$instances
as
$instance
)
{
if
(
!
$instance
->
deleted
)
{
$config
=
$instance
->
getExportProperties
();
$config
=
$instance
->
toArray
();
$config
[
'deleted'
]
=
TRUE
;
$deleted_instances
[
$instance
->
uuid
]
=
$config
;
}
...
...
@@ -619,16 +619,16 @@ public function targetBundle() {
* @todo Investigate in https://drupal.org/node/2074253.
*/
public
function
__sleep
()
{
// Only serialize properties from
getExportProperties
().
return
array_keys
(
array_intersect_key
(
$this
->
getExportProperties
(),
get_object_vars
(
$this
)));
// Only serialize properties from
self::toArray
().
return
array_keys
(
array_intersect_key
(
$this
->
toArray
(),
get_object_vars
(
$this
)));
}
/**
* Implements the magic __wakeup() method.
*/
public
function
__wakeup
()
{
// Run the values from
getExportProperties
() through __construct().
$values
=
array_intersect_key
(
$this
->
getExportProperties
(),
get_object_vars
(
$this
));
// Run the values from
self::toArray
() through __construct().
$values
=
array_intersect_key
(
$this
->
toArray
(),
get_object_vars
(
$this
));
$this
->
__construct
(
$values
);
}
...
...
core/modules/filter/lib/Drupal/filter/Entity/FilterFormat.php
View file @
23902766
...
...
@@ -173,8 +173,8 @@ public function setFilterConfig($instance_id, array $configuration) {
/**
* {@inheritdoc}
*/
public
function
getExportProperties
()
{
$properties
=
parent
::
getExportProperties
();
public
function
toArray
()
{
$properties
=
parent
::
toArray
();
// @todo Make self::$weight and self::$cache protected and add them here.
$names
=
array
(
'filters'
,
...
...
core/modules/image/lib/Drupal/image/Entity/ImageStyle.php
View file @
23902766
...
...
@@ -369,8 +369,8 @@ public function saveImageEffect(array $configuration) {
/**
* {@inheritdoc}
*/
public
function
getExportProperties
()
{
$properties
=
parent
::
getExportProperties
();
public
function
toArray
()
{
$properties
=
parent
::
toArray
();
$names
=
array
(
'effects'
,
);
...
...
core/modules/rdf/lib/Drupal/rdf/Entity/RdfMapping.php
View file @
23902766
...
...
@@ -136,7 +136,7 @@ public function id() {
/**
* {@inheritdoc}
*/
public
function
getExportProperties
()
{
public
function
toArray
()
{
$names
=
array
(
'id'
,
'uuid'
,
...
...
core/modules/search/lib/Drupal/search/Entity/SearchPage.php
View file @
23902766
...
...
@@ -163,8 +163,8 @@ public function getWeight() {
/**
* {@inheritdoc}
*/
public
function
getExportProperties
()
{
$properties
=
parent
::
getExportProperties
();
public
function
toArray
()
{
$properties
=
parent
::
toArray
();
$names
=
array
(
'path'
,
'weight'
,
...
...
core/modules/serialization/lib/Drupal/serialization/Normalizer/ConfigEntityNormalizer.php
View file @
23902766
...
...
@@ -23,7 +23,7 @@ class ConfigEntityNormalizer extends EntityNormalizer {
* {@inheritdoc}
*/
public
function
normalize
(
$object
,
$format
=
NULL
,
array
$context
=
array
())
{
return
$object
->
getExportProperties
();
return
$object
->
toArray
();
}
}
core/modules/serialization/tests/Drupal/serialization/Tests/Normalizer/ConfigEntityNormalizerTest.php
View file @
23902766
...
...
@@ -43,7 +43,7 @@ public function testNormalize() {
$config_entity
=
$this
->
getMock
(
'Drupal\Core\Config\Entity\ConfigEntityInterface'
);
$config_entity
->
expects
(
$this
->
once
())
->
method
(
'
getExportProperties
'
)
->
method
(
'
toArray
'
)
->
will
(
$this
->
returnValue
(
$test_export_properties
));
$this
->
assertSame
(
$test_export_properties
,
$normalizer
->
normalize
(
$config_entity
));
...
...
core/modules/system/lib/Drupal/system/Entity/Action.php
View file @
23902766
...
...
@@ -143,8 +143,8 @@ public static function sort($a, $b) {
/**
* {@inheritdoc}
*/
public
function
getExportProperties
()
{
$properties
=
parent
::
getExportProperties
();
public
function
toArray
()
{
$properties
=
parent
::
toArray
();
$names
=
array
(
'type'
,
'plugin'
,
...
...
core/modules/system/lib/Drupal/system/Entity/DateFormat.php
View file @
23902766
...
...
@@ -71,8 +71,8 @@ class DateFormat extends ConfigEntityBase implements DateFormatInterface {
/**
* {@inheritdoc}
*/
public
function
getExportProperties
()
{
$properties
=
parent
::
getExportProperties
();
public
function
toArray
()
{
$properties
=
parent
::
toArray
();
$names
=
array
(
'locked'
,
'pattern'
,
...
...
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment