In includes/database/mysql/schema.inc, the two functions createKeySql and createKeysSqlHelper are identical.
The code for both functions goes back to the original commit.
This also applies to D7.
| Comment | File | Size | Author |
|---|---|---|---|
| #39 | 1224892-39.patch | 1.78 KB | linl |
Comments
Comment #1
jonvk commentedThe attached patch removes function createKeysSqlHelper and replaces all calls with calls to createKeySql.
Comment #2
iaine commentedQueued for testing
Comment #4
berdirThis might apply to 7.x, but it doesn't against 8.x, the files have been moved around a lot, everything is in core/ now and the classes are below core/lib/Drupal/Core/.. according to the PSR-0 standards.
Comment #5
iaine commentedUpdated the patch to look at the Schema.php in core 8.x. Rerolls jonvk's suggested changes.
Comment #6
iaine commentedI've just realised that and rerolled to try and correct this.
Comment #8
iaine commentedRerolled to try and correct earlier patch issue
Comment #9
iaine commentedComment #11
iaine commentedAccording to the latest code from 8.x, this code appears to have been fixed in the mysql/Schema.php and the duplicate function removed. (We've been looking at this as part of Drupal Ladder this afternoon - hence trying to patch).
Comment #12
iaine commentedSorry my fault for not looking carefully enough.
Comment #14
lapistano commentedHi,
sprinting at devdays in Dublin I took the liberty and claimed the work to be done here.
Pls review my patch. There are a bunch on unit tests for the schema class added as well.
Comment #15
linl commentedSetting to needs review.
Comment #16
berdirThis is an internal, protected helper method. It's not part of an interface/API, so we can simply remove it. I think :)
Comment #18
lapistano commentedI did a grep over the complete drupal dir. The reason why I did not remove it, was that there is potentionally the chance someone extended the class and uses this function - even if it is not the desired way to do.
Marking it deprecated and leaving it in for some time will give them the chance to migrate.
Comment #19
lapistano commentedActually I have no clue why the patch is failing .. says it fails to setup a drupal system. Can someone help?
Comment #20
lapistano commented#14: Duplicate_code_in_mysql_schema.inc_createKeySql=createKeysSqlHelper-1224892-14.patch queued for re-testing.
Comment #22
lapistano commented#14: Duplicate_code_in_mysql_schema.inc_createKeySql=createKeysSqlHelper-1224892-14.patch queued for re-testing.
Comment #24
lapistano commentedtypos in method call probably caused the tests to fail ... will see ;)
Comment #25
lapistano commentedjust to start the tests
Comment #26
miklIf createKeysSqlHelper is not present in Drupal 7, I don't think we should keep the deprecated stub in Drupal 8. Otherwise, looks fine to me.
Comment #27
miklIt's also in Drupal 7, so we might keep it for one more version.
Comment #28
webchickMoving to the documentation component so Jennifer can have a look.
Comment #29
webchickOops, sorry, my bad. I didn't read down far enough. Good catch!
I'm not sure why these missing params / returns are being added here, but they're missing the descriptions of what they are, so those need to be added, too.
But it seems like this is crunching two issues into one; might be easier to split the docs improvements out (assuming #2057809: Correct the @param and @return statements on dbtng doesn't cover it already that is), and just fix the problem in the issue title here.
I agree with mikl that I think this entire function can be removed, since the impact on module developers would be minimal.
Comment #30
webchickOops.
Comment #31
lapistano commentedThe issue #2057809 does not cover the Driver directory.
As for the proposal to split the doc improvments into a separate issue , I'd rather spend the time in an other issues than cherry picking the changes from the patch.
As for the removal of the function I have no doubt in removing this if you insist.
Comment #32
linl commentedGoing back to just fixing the original issue, without the additional docs changes, it looks like iaine's patch in #8 works.
Reloading it here to see. And adding "needs backport to 7" tag.
Comment #34
linl commentedAah, should be createKeySql, not createKeysSql, let's try that again.
Comment #36
jhedstrom+1 for removing duplicated code. As per #29, we were clear to remove the entire method, and #34 looks good. However, I'm not sure if this can be done post-beta (impact still seems minimal since this was a protected helper method).
Comment #37
alexpottThis issue is a minor bug fix, and doesn't include any disruptive changes, so it is allowed per https://www.drupal.org/core/beta-changes. There is no point maintaining 100% duplicated protected methods. Committed 8a8c28c and pushed to 8.0.x. Thanks!
Comment #39
linl commentedHere's the D7 patch.
Comment #40
linl commentedComment #42
erik.erskine commentedD7 patch in #39 looks good. The changes are essentially same as the D8 version but applied to a different file.
What are the implications of removing the protected function though?
Comment #43
linl commentedThanks, erik.erskine. Not sure of the implications of removing the protected function in D7.
Maybe time to close this issue??