Update EntityTypeInterface::getKeys() docs for string IDs

Created on 12 August 2024, 4 months ago

Problem/Motivation

EntityTypeInterface::getKeys() documents that entity IDs must be numeric. This is not true, however, we explicitly support string IDs, see in particular the EntityTestStringId test entity.

Steps to reproduce

-

Proposed resolution

Update the documentation.

Remaining tasks

User interface changes

-

Introduced terminology

-

API changes

-

Data model changes

-

Release notes snippet

-

📌 Task
Status

Active

Version

11.0 🔥

Component
Documentation 

Last updated 1 day ago

No maintainer
Created by

🇩🇪Germany tstoeckler Essen, Germany

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @tstoeckler
  • Status changed to Needs review 4 months ago
  • 🇩🇪Germany tstoeckler Essen, Germany

    Created a quick MR.

    Since this was directly in scope of the lines being touched, I opted to touch up two other things:
    - Removed the note about the ID key being required. It is not, it is only required if you actually want to save the entity. That of course means in 99% of cases you do want to specify an ID key, but with contact messages in core we actually have an example of not having an ID, so it doesn't make much sense to claim it's required.
    - Removed the usage of the term "Field API". It is a remnant of D7 times. In current times it is actually in correct because getKeys() is used for config entities as well and they have nothing to do with Field API in its current form. The more correct/current term would be "Entity API", but instead of replacing that I just removed the explicit mentioning of that as that would have felt somewhat out of place there.

    I also noted that we use the term "property" there, to describe the values of the keys array. That's also somewhat incorrect, as for content entities, those are actually field names and properties are something different, but for config entities we do tend to use the term properties (for example ConfigEntityTypeInterface::getPropertiesToExport(), so I think it might be more clear to consistently use "field or property" instead of just "property". That would need to be changed a bunch of times, though, in that documentation paragraphs, so I anticipate that being flagged as too broad in scope for this issue.

  • Pipeline finished with Success
    4 months ago
    Total: 608s
    #251416
  • 🇮🇳India prem suthar Ahemdabad- Gujrat , Jodhpur - Rajsthan

    @tstoeckler you used twice from at the @return array description .

     /**
       * Gets an array of entity keys.
       *
       * @return array
       *   An array describing how the certain information can be extracted <strong>from</strong>
       *   <strong>from</strong> entities of this entity type:
    
  • 🇩🇪Germany tstoeckler Essen, Germany

    Nice catch, thanks! 👍

  • Pipeline finished with Success
    4 months ago
    Total: 479s
    #251495
  • Status changed to RTBC 4 months ago
  • 🇺🇸United States smustgrave

    Seems pretty straightforward

  • 🇧🇷Brazil kleiton_rodrigues Americana/SP

    @prem-suthar RTBC +1

  • 🇳🇿New Zealand quietone

    @kleiton_rodrigues, There are contributor tasks on Drupal.org that provide the steps for making useful additions to an issue. You may find How is credit granted for Drupal core issues useful as well.

  • 🇬🇧United Kingdom catch

    One comment on the MR.

  • 🇩🇪Germany tstoeckler Essen, Germany

    Fixed

  • Pipeline finished with Failed
    2 months ago
    Total: 9253s
    #315954
  • 🇺🇸United States smustgrave

    Also the MR is 250 commits back :) but you're right the comments would not cause those failures. Feedback from @catch appears to be addressed.

    • quietone committed 7858c7be on 11.1.x
      Issue #3467540 by tstoeckler, prem suthar, smustgrave, catch: Update...
    • quietone committed 99a78afb on 11.x
      Issue #3467540 by tstoeckler, prem suthar, smustgrave, catch: Update...
  • Status changed to Fixed 4 days ago
  • 🇳🇿New Zealand quietone

    Committed to 11.x and cherry-picked to 11.1.x

    Thanks!

Production build 0.71.5 2024