Uh oh!
There was an error while loading. Please reload this page.
Handle binary UUID in SearchFilter - #3774
Conversation
alanpoulain
commented
Oct 20, 2020
Since it's a bugfix, it should target 2.5. |
Uh oh!
There was an error while loading. Please reload this page.
odoucet
left a comment
There was a problem hiding this comment.
I used a less generic parameter name ... Tell me if it's the right way to do.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
soyuka
commented
Nov 8, 2020
Nice patch, please target 2.5 |
odoucet
commented
Nov 9, 2020
Updated to use QueryNameGenerator for variable names. |
| for ($i = 0; $i < $nbArgs; ++$i) { | ||
| $inQuery[] = ':filterproperty'.$i; | ||
| $parameters->add(new Parameter('filterproperty'.$i, $caseSensitive ? $values[$i] : strtolower($values[$i]), $type)); | ||
| $args = []; |
There was a problem hiding this comment.
This will require updating some tests expectations because when multiple values are given, they are set as one unique array parameter, and that will become several parameters. See https://github.com/api-platform/core/pull/3774/checks?check_run_id=1379433208#step:14:91
I'm currently blocked at adding UUID tests, I cant fully understand yet how tests are organized and how can I add custom types.
\Doctrine\DBAL\Types\Type::addType('uuid', \Ramsey\Uuid\Doctrine\UuidType::class);
is required to manipulate uuid types.
Uh oh!
There was an error while loading. Please reload this page.
odoucet
commented
Nov 10, 2020
I've pushed an attempt to add test on UUID field, but the current test failed because |
soyuka
commented
Jan 22, 2021
if you need more help @odoucet ping me on symfony's slack! |
odoucet
commented
Feb 8, 2021
I'll update my PR with latest master branch in a few days. |
odoucet
commented
Feb 11, 2021
Hello, |
aa50420 to
83d4dfaCompare4ded0f9 to
16dd558Compare16dd558 to
a1f12caComparealanpoulain
commented
Feb 19, 2021
Hello @odoucet, |
alanpoulain
commented
Feb 19, 2021
Thank you @odoucet. |
This reverts commit ff248ae.
This reverts commit ff248ae.
This reverts commit ff248ae.
When searching on a binary UUID field, current behaviour leads to search done on Doctrine with the string UUID and not the binary version of it.
This is because the field type must be provided to Doctrine each time we use QueryBuilder. Why ? Because Doctrine sees string on input, and does not know it needs conversion.
This PR reads
$metadata->getTypeOfField()and force field type.WARNING
Current PR passes the unit tests (so it does not break current behaviour), but does not implement two new needed tests (to make sure it fixes the issue mentioned) :
Test has been done on a local project so I know it works, but better to check this with a test :)
I need some help adding custom type to SearchFilterTestTrait as
uuidBinaryis not recognized.