replace all core usages of id() with getid()

Created on 21 April 2014, over 11 years ago
Updated 18 August 2025, 12 days ago

Problem/Motivation

We have a pattern of having properties on classes, and making getters for them. See #2016679: Expand Entity Type interfaces to provide methods, protect the properties .

In sub issues of that methods meta, and also in general when people look at our classes, they are confused that we have id() (and label()) [ .. a separate issue would be for and not getId() and getName() (or getLabel).]

To postpone or not to postpone

According to #2350615: [policy, no patch] What changes can be accepted during the Drupal 8 beta phase? :

This is desirable because of DX and reducing confusion because some code will have both ->id() in some lines and getId() in others. The outside-of-drupal world expects getId().
This is a task, because it is not a bug.
This is normal, because .. it is not critical or major. https://www.drupal.org/node/45111 (priority definition, needs more detail there)
This impacts core and contributed modules .. negatively because lot and lots of places have id() and it will be a giant patch for core.

Benefit of this is perhaps equal to the disruption.

And thus, should be 8.1.x

Proposed resolution

Proposed resolution: do a mega patch to programatically change id() to getId() everywhere.

Remaining tasks

User interface changes

No.

API changes

No.

📌 Task
Status

Postponed: needs info

Version

11.0 🔥

Component

entity system

Created by

🇺🇸United States yesct

Live updates comments and jobs are added and updated live.
  • stale-issue-cleanup

    To track issues in the developing policy for closing stale issues, [Policy, no patch] closing older issues

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇺🇸United States smustgrave

    Thank you for creating this issue to improve Drupal.

    We are working to decide if this task is still relevant to a currently supported version of Drupal. There hasn't been any discussion here for over 8 years which suggests that this has either been implemented or is no longer relevant. Your thoughts on this will allow a decision to be made.

    Since we need more information to move forward with this issue, the status is now Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.

    Thanks!

Production build 0.71.5 2024