Unverified Commit 2bbbaa3f authored by alexpott's avatar alexpott
Browse files

Issue #2949021 by tim.plunkett, Wim Leers: Deprecate schema fallback in...

Issue #2949021 by tim.plunkett, Wim Leers: Deprecate schema fallback in ConfigEntityType::getPropertiesToExport
parent b4297ade
......@@ -173,6 +173,7 @@ public function getPropertiesToExport($id = NULL) {
if (!isset($definition['mapping'])) {
return NULL;
}
@trigger_error(sprintf('Entity type "%s" is using config schema as a fallback for a missing `config_export` definition is deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0. See https://www.drupal.org/node/2949023.', $this->id()), E_USER_DEPRECATED);
$this->mergedConfigExport = array_combine(array_keys($definition['mapping']), array_keys($definition['mapping']));
}
return $this->mergedConfigExport;
......
......@@ -36,6 +36,7 @@ function config_test_entity_type_alter(array &$entity_types) {
$config_test_no_status->set('id', 'config_test_no_status');
$config_test_no_status->set('entity_keys', $keys);
$config_test_no_status->set('config_prefix', 'no_status');
$config_test_no_status->set('mergedConfigExport', ['id' => 'id', 'label' => 'label']);
if (\Drupal::service('state')->get('config_test.lookup_keys', FALSE)) {
$entity_types['config_test']->set('lookup_keys', ['uuid', 'style']);
}
......
......@@ -16,6 +16,12 @@
* }
* },
* config_prefix = "query",
* config_export = {
* "id",
* "label",
* "array",
* "number",
* },
* entity_keys = {
* "id" = "id",
* "label" = "label"
......
......@@ -28,6 +28,15 @@
* "label" = "label",
* "status" = "status"
* },
* config_export = {
* "id",
* "label",
* "weight",
* "style",
* "size",
* "size_value",
* "protected_property",
* },
* links = {
* "edit-form" = "/admin/structure/config_test/manage/{config_test}",
* "delete-form" = "/admin/structure/config_test/manage/{config_test}/delete",
......
......@@ -26,6 +26,13 @@
* entity_keys = {
* "id" = "id"
* },
* config_export = {
* "id",
* "target_entity_type_id",
* "target_bundle",
* "default_langcode",
* "language_alterable",
* },
* list_cache_tags = { "rendered" }
* )
*/
......
......@@ -34,6 +34,13 @@
* "id" = "id",
* "label" = "label"
* },
* config_export = {
* "id",
* "label",
* "image_style_mappings",
* "breakpoint_group",
* "fallback_image_style",
* },
* links = {
* "edit-form" = "/admin/config/media/responsive-image-style/{responsive_image_style}",
* "duplicate-form" = "/admin/config/media/responsive-image-style/{responsive_image_style}/duplicate",
......
......@@ -118,6 +118,9 @@ protected function setUp() {
'uuid' => 'uuid',
'langcode' => 'langcode',
],
'config_export' => [
'id',
],
'list_cache_tags' => [$this->entityTypeId . '_list'],
]);
......@@ -254,7 +257,14 @@ public function testSaveInsert(EntityInterface $entity) {
$immutable_config_object->isNew()->willReturn(TRUE);
$config_object = $this->prophesize(Config::class);
$config_object->setData(['id' => 'foo', 'uuid' => 'bar', 'dependencies' => []])
$config_object
->setData([
'id' => 'foo',
'uuid' => 'bar',
'dependencies' => [],
'langcode' => 'hu',
'status' => TRUE,
])
->shouldBeCalled();
$config_object->save(FALSE)->shouldBeCalled();
$config_object->get()->willReturn([]);
......@@ -299,7 +309,14 @@ public function testSaveUpdate(EntityInterface $entity) {
$immutable_config_object->isNew()->willReturn(FALSE);
$config_object = $this->prophesize(Config::class);
$config_object->setData(['id' => 'foo', 'uuid' => 'bar', 'dependencies' => []])
$config_object
->setData([
'id' => 'foo',
'uuid' => 'bar',
'dependencies' => [],
'langcode' => 'hu',
'status' => TRUE,
])
->shouldBeCalled();
$config_object->save(FALSE)->shouldBeCalled();
$config_object->get()->willReturn([]);
......@@ -347,7 +364,14 @@ public function testSaveRename(ConfigEntityInterface $entity) {
$immutable_config_object->isNew()->willReturn(FALSE);
$config_object = $this->prophesize(Config::class);
$config_object->setData(['id' => 'bar', 'uuid' => 'bar', 'dependencies' => []])
$config_object
->setData([
'id' => 'bar',
'uuid' => 'bar',
'dependencies' => [],
'langcode' => 'hu',
'status' => TRUE,
])
->shouldBeCalled();
$config_object->save(FALSE)
->shouldBeCalled();
......@@ -443,7 +467,14 @@ public function testSaveNoMismatch() {
$config_object = $this->prophesize(Config::class);
$config_object->get()->willReturn([]);
$config_object->setData(['id' => 'foo', 'uuid' => NULL, 'dependencies' => []])
$config_object
->setData([
'id' => 'foo',
'uuid' => NULL,
'dependencies' => [],
'langcode' => 'en',
'status' => TRUE,
])
->shouldBeCalled();
$config_object->save(FALSE)->shouldBeCalled();
......
......@@ -193,6 +193,9 @@ public function providerGetPropertiesToExport() {
/**
* @covers ::getPropertiesToExport
*
* @group legacy
* @expectedDeprecation Entity type "example_config_entity_type" is using config schema as a fallback for a missing `config_export` definition is deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0. See https://www.drupal.org/node/2949023.
*/
public function testGetPropertiesToExportSchemaFallback() {
$this->typedConfigManager->expects($this->once())
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment