stwe / DatatablesBundle

This Bundle integrates the jQuery DataTables plugin into your Symfony application.
355 stars 236 forks source link

Correction adding like% and %like in filter #921

Closed elpoutro closed 5 years ago

elpoutro commented 5 years ago

Pushing https://github.com/stwe/DatatablesBundle/pull/870 has made reappear the issue https://github.com/doctrine/doctrine2/issues/6363.

I have reproduce trying something like that:

` $this->columnBuilder->add('structurePath', Column::class, array(

'title' => 'structure path',
    'searchable' => true,
    'dql' => '(SELECT GROUP_CONCAT({s}.label SEPARATOR \' \') FROM '.Structure::class.' {s} WHERE {s}.lft <= structure.lft and {s}.rgt >= structure.rgt and {s}.root = structure.root)',
    'type_of_field' => 'string',
    'filter' => array(TextFilter::class, array(
        'search_type' => 'like%',
    ))
));

` So I suggest this correction according to the existing solution.

elpoutro commented 5 years ago

Just for understanding, Why just not throw an exception when someone try to use "like" with a subquery (or "CASE WHEN" or something else than a string expression)?