From 1f37e57598e46b4df27da50ddf7f7eac60e18490 Mon Sep 17 00:00:00 2001 From: webchick <webchick@24967.no-reply.drupal.org> Date: Tue, 16 Oct 2012 14:17:41 -0700 Subject: [PATCH] Revert "Issue #1813832 by andypost: Fixed Allow use '0' as id for entity." This reverts commit f8673ac410db0cedd8c49f0cbc7c99c0a35ec3b7. Needs more discussion. --- core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php | 3 +-- core/lib/Drupal/Core/Entity/Entity.php | 3 +-- .../config/lib/Drupal/config/Tests/ConfigEntityTest.php | 5 +---- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php b/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php index 1258395455c8..77ffa8cfb1f7 100644 --- a/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php +++ b/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php @@ -51,8 +51,7 @@ public function getOriginalID() { * since each configuration entity is unique. */ final public function isNew() { - $id = $this->id(); - return !isset($id); + return !$this->id(); } /** diff --git a/core/lib/Drupal/Core/Entity/Entity.php b/core/lib/Drupal/Core/Entity/Entity.php index 7f5ae872cb4e..8f462de71540 100644 --- a/core/lib/Drupal/Core/Entity/Entity.php +++ b/core/lib/Drupal/Core/Entity/Entity.php @@ -91,8 +91,7 @@ public function uuid() { * Implements EntityInterface::isNew(). */ public function isNew() { - $id = $this->id(); - return !empty($this->enforceIsNew) || !isset($id); + return !empty($this->enforceIsNew) || !$this->id(); } /** diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigEntityTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigEntityTest.php index 494f5e0e5fc1..532979c3110b 100644 --- a/core/modules/config/lib/Drupal/config/Tests/ConfigEntityTest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigEntityTest.php @@ -78,16 +78,13 @@ function testCRUD() { // Rename the configuration entity's ID/machine name. $this->assertLinkByHref('admin/structure/config_test/manage/' . $id); $edit = array( - 'id' => '0', + 'id' => strtolower($this->randomName()), 'label' => $label3, ); $this->drupalPost('admin/structure/config_test/manage/' . $id, $edit, 'Save'); $this->assertResponse(200); $this->assertNoText($label1); $this->assertText($label3); - $this->drupalPost('admin/structure/config_test/manage/0/delete', array(), 'Delete'); - $this->assertResponse(200); - $this->assertNoText($label3); } } -- GitLab