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.
Issue fork drupal-3067336
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
longwaveThis can be considered now, but it looks like CiviCRM calls both these methods, so we might have to fully deprecate this somehow?
http://grep.xnddx.ru/search?text=setFieldNames&filename=
Comment #4
xjmSince 8.9.x and 9.0.x are now in beta, the way to do this would be to trigger a deprecation warning when the method is called from outside the class(es). We'd add that in a minor release of Drupal 9, and then that BC layer would be removed as part of the deprecation cleanup in Drupal 10. Thanks!
Comment #10
bhanu951 commentedSeems this issue has passed 10.x release as well, we need to plan it for 11.x release.
Comment #12
tstoecklerJust 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 #3310170: Use UUID as entity ID 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.
Comment #13
tstoecklerComment #16
arunkumarkThe methods
setFieldNames()andsetExtraColumns()are called inside the class only. So, it can be converted into the protected.There is another conversion of renaming
setFieldNamesthe function on issue #3458145: Replace DefaultTableMapping::setFieldNames() with ::add*() and ::remove*(). If the approach is taken place we have to reroll this patch by making a protected method.Comment #17
tstoecklerRe #16: As I noted in #12 these methods are helpful for contrib/custom code, so I don't think your argument is very convincing
Comment #18
smustgrave commentedFor 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