Closed yulioaj290 closed 6 years ago
Thanks a lot for the PR Just some small coding style issues but the rest look good
You're welcome! This is a bundle that can avoid headache to many peoples. BTW. I have done some test to verify the "contain" filter over a column of type array (in Symfony), and it does works well. What you mean with this: "Contain for a path that is string works fine. Find a new filter type name for path being an array that contains value".
@yulioaj290 Glad to hear that About contain issue with arrays that's because the array gets serialized in a string column so if you do a contain filter with an element it finds it correctly but even if you put part of the element it also finds it which is not the right behaviour For example put apple, orange, banana in the array Then filter by contain app or ban and you still get the row
So @trivago-makbarof , is the intention to implement a new filter with the behavior of a reverse IN filter?
I think there is no a SQL operator to do this in a simple way. Maybe using a Data Transformer class to convert the serialized string into a PHP array, and then using "in_array" function, you could filter the finals rows accordingly to each filter of this kind, used on the query.
On the other hand, you could take advantage from the structure of the serialized string of the array, and implement a simple but uggly way to compare using the LIKE clause. This method is not the best solution but it is a good approach.
I can try to code this last method if you think it would be a great idea.
You have a point there. Parsing the column is definitely is not an option as it will make the whole library more complicated (the library will end up with 2 different way of filtering with not much of benefit) The ugly solution could work but maybe we can skip it until someone have a real need for it I had in mind defining custom filters (something like custom types of doctrine) that allows the developers to add their own filters in a nice way.
@trivago-makbarof I have implemented a good approach for "Contain for a path that is string works fine. Find a new filter type name for path being an array that contains value".
The two new filters are ARRAY_CONTAINS:ac and ARRAY_NOT_CONTAINS:anc
Added some new features to avoid filtering or sorting on columns that are not rendered.
The "excluded_attributes" configuration property was used to identify the not rendered columns and a new configuration property have been created, "strict_filtering_and_sorting" under security section, to tell to the bundle to ignore or not the excluded attributes used into the filtering or sorting.
The documentation has been updated properly.