Conversation
f520de7 to
adc4c29
Compare
|
IMHO you can do this on the stable branch if you implement the |
This is what I thought at first (it's in the description) and also implemented, but we (and maybe others) are using And calling |
|
Could you please rebase your PR and fix merge conflicts? |
adc4c29 to
ea55a98
Compare
ea55a98 to
21835be
Compare
21835be to
82b9f00
Compare
|
If we merge this, it will require to update the filter from persistence bundle. It would be great to find a way to provide a BC way... With an option maybe ? |
|
And why this part https://github.com/sonata-project/SonataAdminBundle/blob/master/src/Datagrid/Datagrid.php#L290-L300 is untouched ? |
Since these changes are targeting the next major, I think there is no need for a BC layer (which will require more work to maintain). |
I had in mind to target 3.x instead. For a smooth update. |
In that case, I think we could follow your suggestion about the switch parameter, deprecating its usage with the value that provides the array based filters and indicating that it will be removed in the next major. |
|
Maybe it could help to implement ArrayAccess in FilterData.
|
|
There are already PRs to use this in the persistence bundles: sonata-project/SonataDoctrineORMAdminBundle#1407 and sonata-project/SonataDoctrineMongoDBAdminBundle#574 (to be updated to the new namespace). I don't think it's too much work to update to use
Because it's not needed, |
It's not a lot of for persistence bundle indeed. When I'll want to update to 4.0, I'll need to update all the other BC-break (for instance the typehint) for my code. But maybe it's better to do something here https://github.com/sonata-project/SonataDoctrineORMAdminBundle/blob/3.x/src/Filter/CallbackFilter.php#L44 It could be something introduce in 4.0 - alpha/beta and removed before the real 4.0. |
VincentLanglet
left a comment
There was a problem hiding this comment.
I'd like to release the alpha before this merge ; if it's okay for you.
It could be the step I look for.
|
@franmomu @jordisala1991 If I merge this, do you prefer to
|
|
I think the second option is better but not strong opinion |
| public const CONDITION_AND = 'AND'; | ||
|
|
||
| /** | ||
| * @phpstan-param array{type?: int|null, value?: mixed} $filterData |
There was a problem hiding this comment.
Just realised that type could not exists, but not sure if that makes sense.
With the current implementation FilterData::getType() would return null if type is not present in the array.
There was a problem hiding this comment.
null and no value should behave the same IMHO.
how so? |
82b9f00 to
5618fa5
Compare
|
just squashed the two commits and renamed methods |
I saw here: https://github.com/sonata-project/SonataAdminBundle/pull/7033/files#diff-e279d5562ba068b14806eea28b5eea2b485848e73618a8a712dae6cc52e89e98R119 some I thought we got rid of this |
|
After this merge, we could update the persistence bundle and release an alpha-2. WDYT @sonata-project/contributors ? |
|
Do you have some time to finish this @franmomu ? :) |
e03427a to
a49f757
Compare
a49f757 to
2a64bfa
Compare
|
I was thinking that we can copy Before calling: We can maybe check with reflection the last parameter of
These callables are not supposed to implement The only BC break in 4.0 would be for classes implementing |
Subject
I have doubts on where to do this, the easy way is to do it in
4.x, I thought about addingFilterDataTypein3.x, but removingbuildFormfrom types is BC break, so not sure if is worth it to do it in3.x.My idea with filters was:
FilterDataTypeThis type will be used as a base of filter types, it contains
typeandvaluefields and it definesoperator_type,field_type,operator_optionsandfield_optionsoptions.The idea is that other types will override
getParent()method returningFilterDataType, so there is no need for them to overridebuildFormwithtypeandvalueand only have to configure theoperator_typeandfield_typeoptions (and other options if they have).The datatransform transforms from
arraytoFilterData(I'll extract theCallbackTransformerto a class).FilterDataThis VO (ref: #6658) will be used instead of
arrayfor filters, this cannot be done with BC (at first I thought that implementingArrayAccesscould work, butarray_key_existsdoes not work with objects and will break implementations).I am targeting this branch, because this is not BC.
Closes #6658.
Changelog
To do
CallbackTransformerto a class.