Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Following plublic methods have are not defined on any interface:
DefaultTableMapping::setFieldNames
DefaultTableMapping::setExtraColumns
DefaultTableMapping::allowsSharedTableStorage
DefaultTableMapping::requiresDedicatedTableStorage
DefaultTableMapping::getDedicatedTableNames
DefaultTableMapping::getDedicatedDataTableName
DefaultTableMapping::getDedicatedRevisionTableName
Proposed resolution
Either add all the DefaultTableMapping public methods to TableMappingInterface or introduce new interface
Remaining tasks
Finalize the aporch and write a patch
User interface changes
None
API changes
None
Data model changes
None
Beta phase evaluation
Issue category | Task because simple adds method to interface |
---|---|
Issue priority | Normal because nothing is broken |
Disruption | Non Disruptive for core/contributed and custom modules/themes |
Comments
Comment #1
jibranComment #2
dawehnerNo, interfaces are there because they are designed like that. Just adding all the methods is not always the best idea. I think its fine in some code to bypass the interface
and use just a specific instance, but ideally no code should have to rely on those public methods.
Comment #3
ysaid CreditAttribution: ysaid as a volunteer commentedComment #4
ysaid CreditAttribution: ysaid as a volunteer commentedI created a patch and done the following :
- 7 public methods of DefaultTableMapping are now declared in TableMappingInterface
- Jibran mentioned DefaultTableMapping::generateFieldTableName in the issue description but it's a protected method. I Didn't include it in TableMappingInterface
It's my first patch and contribution to drupal core, please be kind :)
Comment #5
jibranThank you for your contribution @ysaid. Changes look good only minor spacing issue to address. I have also removed
DefaultTableMapping::generateFieldTableName
from issue summary.Extra white spacing.
Comment #6
ysaid CreditAttribution: ysaid as a volunteer commentedThanks for your feedback @jibran. I fixed spaces issues. Please check it.
Comment #7
jibranThanks for the fix @ysaid. It is easier for reviewers if you upload an interdiff.
Comment #8
BerdirNo so fast :)
See #2. Just because those methods are public doesn't mean they are supposed to be on an or that interface.
At least @plach should provide his opinion on this, there might be good reasons why this wasn't done.
Comment #9
dawehnerSo +1 to that statement. The interface is designed for a generic table mapping not specific to any implementation vs. the DefaultMapping which has the notion of those specific table types.
Comment #10
plachWhat #9 said. Thanks for the patch @ysaid, it looks perfect, but this is a won't fix by me.
Comment #11
plachOr better: a "works as designed" :)
Comment #12
jibranAs per #9 and #10.