ConfigEntityInterface::setOriginalID() should return $this, just like any other setter.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Xano’s picture

Assigned: Xano » Unassigned
Status: Active » Needs review
FileSize
999 bytes

Also, should the method name not be setOriginalId()?

dawehner’s picture

Issue tags: +Needs tests

I also agree that it should be name setOriginalId

Xano’s picture

FileSize
6.27 KB
6.81 KB
Xano’s picture

Issue tags: -Needs tests

.

Status: Needs review » Needs work

The last submitted patch, drupal_2088241_3.patch, failed testing.

dawehner’s picture

  1. +++ b/core/lib/Drupal/Core/Config/Entity/ConfigEntityInterface.php
    @@ -28,9 +28,9 @@ public function getOriginalID();
    -   * @return void
    +   * @return \Drupal\Core\Config\Entity\ConfigEntityInterface
    

    We are using '@return self' in quite some places which gives even more information.

  2. +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigEntityUnitTest.php
    @@ -62,12 +78,22 @@ public function testStorageControllerMethods() {
    +    $this->assertTrue($entity->setOriginalId($id) instanceof EntityInterface);
    

    We could even check that it is the same object using spl_object_hash

Xano’s picture

Status: Needs work » Needs review
FileSize
729 bytes
7.71 KB
Xano’s picture

FileSize
7.68 KB
1.15 KB
dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Thank you!

xjm’s picture

Category: feature » task
webchick’s picture

Title: ConfigEntityInterface::setOriginalID() should return $this » Change notice: ConfigEntityInterface::setOriginalID() should return $this
Priority: Normal » Major
Status: Reviewed & tested by the community » Active
Issue tags: +Needs change record

Committed and pushed to 8.x. Thanks!

Will need a change notice.

Xano’s picture

Title: Change notice: ConfigEntityInterface::setOriginalID() should return $this » ConfigEntityInterface::setOriginalID() should return $this
Priority: Major » Normal
Status: Active » Fixed
Issue tags: -Needs change record

Change notice is at https://drupal.org/node/2107951.

Xano’s picture

For some reason the capitalization issue was never fixed or rolled back. See #2113319: Rename getOriginalID() to getOriginalId() and setOriginalID() to setOriginalId().

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.