timgws / QueryBuilderParser

A simple to use query builder for the jQuery QueryBuilder plugin for use with Laravel.
MIT License
159 stars 65 forks source link

Ability to check exists through tables with "through" key. #30

Open RaitzeR opened 6 years ago

RaitzeR commented 6 years ago

Checking exists changed to join, since it's insanely much faster (from tens or hundreds of seconds to milliseconds). Checking not exists is as before.

Through works with unlimited number of pivot tables.

Example:

'join2through' => array(             'from_table'      => 'master2',             'from_col'        => 'm2_col',             'to_table'        => 'subtable2',             'to_col'          => 's2_col',             'to_value_column' => 's2_value',             'not_exists'      => true,             'through' => array(             'from_table'      => 'subtable2',             'from_col'        => 's2_col',             'to_table'        => 'subtable3',             'to_col'          => 's3_col',             'to_value_column' => 's3_value',             )             ),

Keep adding "through" if there's more tables in between.

RaitzeR commented 6 years ago

The failed tests comes from the fact that the tests check for exists, instead of how it's done now. I didn't want to rewrite the tests, in case you're not going to accept this pull request.