Closed (fixed)
Project:
Drupal core
Version:
9.1.x-dev
Component:
views.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
16 Aug 2016 at 09:33 UTC
Updated:
25 Jan 2021 at 20:44 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
lendudeComment #3
prashant.cReplacing occurrences of db_like with Database::getConnection()->escapeLike($string) in Views module.
Comment #4
prashant.cComment #6
chanderbhushan commentedSubmitting new patch
Comment #8
prashant.cPatch #6 is applying successfully.
Comment #9
chanderbhushan commentedAdded my new patch
Comment #10
slasher13Comment #11
slasher13Comment #12
slasher13Comment #13
mradcliffeWouldn't it be better to inject the
databaseservice into the plugin via ContainerFactoryPluginInterface?Likewise for other instances. I'm not familiar with enough with views plugins to know if there is a significant performance impact to use the injection interface instead of tightly-coupling the Database class.
Comment #14
slasher13re-roll
Comment #15
slasher13addresses #13 except in EntityReference class because of special handling in DisplayPluginBase:
parent::__construct(array(), $plugin_id, $plugin_definition)Comment #20
slasher13Comment #21
lendude@slasher13, this is starting to look good! Couple of things I see:
Since we are updating the return value, maybe give this method a docblock to be able to reflect what we are returning now and a visibility while we are at it (for BC reasons probably public)
Shouldn't all the LIKE/NOT LIKE in StringFilter not also use getConditionOperator?
And this will need a change record for the update to the constructor and the addition of the getConditionOperator method I think.
Comment #22
slasher13#21.1 done
#21.2
addWhereusesConnection::mapConditionOperatorduring\Drupal\Core\Database\Query\Condition->compile()andaddWhereExpressiondoesn't.Perhaps pointing out to use addWhereExpression with Connection::mapConditionOperator would be helpful for contrib.
Comment #23
lendudeOpened #2818017: A number of Views combined fields filter operators are currently pointless to an end user to clean up this mess of pointless operators in the combined field filter.
Most of these operator methods don't have any test coverage (and in the current format they just don't make any sense). So I think we either need to postpone this on #2818017: A number of Views combined fields filter operators are currently pointless to an end user and see what happens there or just add some minimal test coverage for all these operators to
\Drupal\Tests\views\Kernel\Handler\FilterCombineTest.Any other thoughts on this?
Comment #26
Juterpillar commentedThanks slasher13 and chanderbhushan. I've re-rolled patch 22 for 8.3.x.
Comment #28
meenakshig commentedAs patch was not applying so i rerolled it for 8.4.x.
Comment #29
meenakshig commentedComment #31
mradcliffeThank you for attempting a re-roll, @Meenakshi Gupta. The patch in #28 seems to not have all the changes in #26. Did you run into conflicts applying all of the changes in #26? A helpful way to determine what changes occurred between patches is to create an "interdiff" between 2 patches. You can learn more about how to create an interdiff at https://www.drupal.org/documentation/git/interdiff.
For a re-roll, an interdiff probably won't show any changes, but if you do see changes, then it's possible your new patch is missing changes from the old patch. It is not necessary to upload the interdiff file. However if we need to add/remove or make other changes in our new patch, then an interdiff should be posted in order to help patch reviewers.
Comment #32
sutharsan commentedComment #33
sutharsan commentedComment #34
miiimoooI'm at DC Vienna and having a look at this.
Comment #35
miiimoooPatch re-rolled for 8.5-x
Comment #36
miiimoooComment #37
mradcliffeThank you for the patch, @miiimooo.
I found a couple of minor code standard issues with the patch.
Also, it seems like code in patch from #26 and #28 is not in the patch in #35, and that code still applies. You should try to apply the changes from #28 as well.
The ending parentheses should be indented at 4 spaces instead of 6 spaces.
I think the convention here is to use
{@inheritdoc}for methods that are extended.Comment #38
miiimoooThanks for the review @mradcliffe
I had more time now and managed to incorporate all the above patches.
Comment #40
miiimoooFix tests
Comment #42
ivan berezhnov commentedComment #43
rosk0Comment #45
mohit1604 commentedComment #46
mohit1604 commentedPatch for version 8.6.x,8.5.x and 8.4.x, hope it shows green :)
Comment #47
mohit1604 commentedComment #48
mohit1604 commentedComment #49
mohit1604 commentedWhat is Vienna2017 and CSKyiv18 to which this issue is tagged in ?
Comment #50
rosk0I think we can remove those tags as corresponding events are already past(obvious for DrupalCon, proof for CSKiyv18 https://groups.drupal.org/node/517964).
Comment #51
mradcliffeWe should keep issue tags that are related to sprints because it is useful for sprint organizers to see a list of issues that were worked on during a sprint.
Comment #52
volegerRelated #2850037: Replace all calls to db_like(), which is deprecated
Comment #53
MerryHamster commentedComment #54
zymbian commentedPatch #46 looks good, thanks for the patch. Marking RTBC.
Comment #55
alexpottThere should be a failing test at least on Postgres as this change claims to be a bugfix for something in Postgres. Also the issue summary should be updated to reflect what is being fixed.
What's also odd is that we're mixing a task - replacing db_like() with a bug fix. I think this issue should only do the necessary to "Fix PostgreSQL operator"... the "and replace db_like wherever possible
in views" should be done by #2850037: Replace all calls to db_like(), which is deprecatedComment #56
gawaksh commentedThis should solve the issue.
Comment #59
MerryHamster commentedReroll #56 patch for 8.7.x
Comment #60
MerryHamster commentedComment #61
andypostunused use - just remove it
Comment #62
MerryHamster commentedComment #64
MerryHamster commentedReroll #56 patch for 8.7.x and added changes with Dependency Injection from #46 patch.
Comment #65
MerryHamster commentedComment #67
mradcliffeI'm adding the Needs tests tag based on @alexpott in comment #55. I think that we should add a kernel test to assert the failure.
The issue title and summary mentions replacing db_like() and like @alexpott mentioned this should not be done in this issue. I added the Needs issue summary update tag because we should clarify the proposed resolution and remaining tasks. Not everyone is knowledgeable about PostgreSQL so it would be great to add an explanation of the bug. This would probably require some digging and background research.
Comment #68
volegerUpdated IS. Reverted changes that are out of scope.
Still requires IS update to clarify the proposed resolution and remaining tasks.
Comment #69
volegerForgot about the title update.
Comment #70
slasher13https://www.drupal.org/pift-ci-job/1066793
11 coding standards messages
I can't open it, but use of short array syntax might be one of them.
Comment #71
volegeraddressed #70
Comment #72
andypostLast patch was commited as part of
db_like()conversion so only extra test coverage here makes senseSee https://cgit.drupalcode.org/drupal/commit/?id=a0608f0
Comment #73
andypostComment #74
kostyashupenkoIn this patch mostly changed constructions like
db_like($this->value)on:
$this->connection->escapeLike($this->value)Comment #75
kostyashupenkoComment #80
sylvain lavielle commentedLooks like the #74 patch can no longer be applied.
There's a new one.
Comment #82
daffie commentedThe patch looks good. Just a couple of minor points:
Where does the inherit comes from? I cannot find it.
Does this "helper" method need to be public. Can we change it to a protected method?
Adding the
$this->connection->escapeLike()should not be part of this patch. It is out of scope for this issue.Comment #83
anmolgoyal74 commentedAddressed #82.1,#82.3,#82.4
For #82.2, In #80, It is already using the new method getConditionOperator.
Comment #84
lendudeStill needs test coverage
Comment #85
daffie commentedWorking on the tests.
Comment #86
daffie commentedAdded tests and also fixed a number of "LIKE"'s in StringFilter.php
Comment #87
lendude@daffie very nice! Can we get a test-only patch too? Just some nitpicks that I see:
This needs to be a better sentence 'Get the query operator.' would probably do?
This isn't correct anymore, it can return more then that
"Tests the Combine field filter using the 'equal' operator."
Using the combined field filter with one field is a bit weird, but I totally agree it is the only logical use when using these operators ¯\_(ツ)_/¯
"Tests the Combine field filter using the 'start' operator."
"Tests the Combine field filter using the 'not_starts' operator."
"Tests the Combine field filter using the 'ends' operator."
"Tests the Combine field filter using the 'not_ends' operator."
"Tests the Combine field filter using the 'not' operator."
Comment #88
daffie commentedUpdated the IS.
Comment #89
daffie commentedUpdated the patch for the comment #87 from @lendude.
Also added a tests only patch.
Comment #90
mradcliffeI reviewed the latest patch. The usage of the getConditionOperator() method is clean and shouldn't pose any risk.
I found one nitpick code standard issue in that patch.
Nit: There should be a separate line between @param and @return annotations
[x] Separate the @param and @return sections by a blank line
Comment #91
daffie commentedFixed the coding standard violation.
Comment #92
lendudeNothing further to add, looks good to me.
Comment #95
catchCommitted/pushed to 9.2.x and cherry-picked to 9.1.x, thanks!