yiisoft / data

Data providers

Home Page:https://www.yiiframework.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The Iterable filter is limited to one dimension

kamarton opened this issue · comments

What steps will reproduce the problem?

Currently, the filtered value is treated as $item[$field]. I'm not really frontend developer, but I think yii2 knew it too:
https://github.com/yiisoft/yii2/blob/f8611d170d77f8b89f24bd80e7f3b6b2a8947380/framework/grid/DataColumn.php#L232

What is the expected result?

Yii3 also uses <field>.<subfield> with ArrayHelper::getValue()

What do you get instead?

Currently not supported.

Additional info

in #28 issue also affect the implementation.

Q A
Version 1.0.0-under development
PHP version -
Operating system -

I think there's no need to support that on data provider level. Having it at grid level should be enough.

An interesting question, because basically you can avoid (eg. flatten, filter in browser with javascript). But I can imagine its use:

$data = StoreAR::find()->with('location')->where(..public..)->asArray()->all();  // eg counts less than 100
$cache->set('stores', $data);
// ...
$data = $cache->get('stores');
$reader = (new IterableDataReader($data))
   ->withFilters(new Like('location.city', $cityFilter));
// ...

I'd postpone it till grids are implemented.