Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recombine atomic rules in composit rules after the simplification to improve readability #27

Closed
jclaveau opened this issue Jun 6, 2018 · 1 comment
Milestone

Comments

@jclaveau
Copy link
Owner

jclaveau commented Jun 6, 2018

Depending on the DB server, this could be used top optimize generated queries.

The code below:

$filter = (new LogicalFilter([
    'and',
    ['field_1', '=', 2],
    [
        'or',
        ['field_2', '>', 4],
        ['field_2', '<', -4],
    ]
]))
->simplify()
->dump()
;

Would dump:

array (
  0 => 'or',
  1 => 
  array (
    0 => 'and',
    1 => 
    array (
      0 => 'field_1',
      1 => '=',
      2 => 2,
    ),
    2 => 
    array (
      0 => 'field_2',
      1 => '>',
      2 => 4,
    ),
  ),
  2 => 
  array (
    0 => 'and',
    1 => 
    array (
      0 => 'field_1',
      1 => '=',
      2 => 2,
    ),
    2 => 
    array (
      0 => 'field_2',
      1 => '<',
      2 => -4,
    ),
  ),
)

= and < opertations could be merged in ">=" / "<=" operations (same for in)

@jclaveau jclaveau added this to the Wishlist milestone Jun 6, 2018
@jclaveau
Copy link
Owner Author

jclaveau commented Jan 2, 2019

duplicate of #66

@jclaveau jclaveau closed this as completed Jan 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant