Convert DefaultTableMapping::setFieldNames() and ::setExtraColumns() to protected methods

Created on 11 July 2019, over 5 years ago
Updated 17 August 2024, 4 months ago

Problem/Motivation

The two DefaultTableMapping::setFieldNames() and ::setExtraColumns() methods are internal helpers of the table mapping class and should not be exposed as public API.

Proposed resolution

Change them to be protected instead.

Remaining tasks

Wait until the 9.0.x branch is opened, write a patch, etc.

User interface changes

Nope.

API changes

Nope.

Data model changes

Nope.

Release notes snippet

Nope.

📌 Task
Status

Needs work

Version

11.0 🔥

Component
Entity 

Last updated about 15 hours ago

Created by

🇷🇴Romania amateescu

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

Merge Requests

Comments & Activities

Not all content is available!

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

  • 🇩🇪Germany tstoeckler Essen, Germany

    Just stumbled upon this. Currently there is not really an easy way to modify the default table mapping, in my opinion. Unless you actually want something radically different providing a different (sub-)class other than DefaultTableMapping, while possible, is not actually very helpful, because you may need to copy the entire class just to change a few lines. Having these methods public, currently allows avoiding that and actually making small alterations with just a small amount of code. See 🐛 Cannot use UUID as entity ID Needs work for something that is currently fixable fairly cleanly from custom code which would become impossible, not in principle, but in reality, if these methods were made protected.

    Since this also does not bring any maintainability gain as far as I can tell, I am against this until we have a different more bespoke API for actually customizing the entity table layout.

  • 🇩🇪Germany tstoeckler Essen, Germany
  • First commit to issue fork.
  • Merge request !9228TableMapping protected method conversion → (Open) created by arunkumark
  • Status changed to Needs review 4 months ago
  • 🇮🇳India arunkumark Coimbatore

    The methods setFieldNames() and setExtraColumns() are called inside the class only. So, it can be converted into the protected.

    There is another conversion of renaming setFieldNames the function on issue 📌 Replace DefaultTableMapping::setFieldNames() with ::add*() and ::remove*() Needs work . If the approach is taken place we have to reroll this patch by making a protected method.

  • 🇩🇪Germany tstoeckler Essen, Germany

    Re #16: As I noted in #12 these methods are helpful for contrib/custom code, so I don't think your argument is very convincing

  • Status changed to Needs work 4 months ago
  • 🇺🇸United States smustgrave

    For more discussion.

    Also don't believe we can change this in a minor so if we still decide to update we can't do until D12

Production build 0.71.5 2024