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

Understanding of brackets placement #54

Open
n10ty opened this issue Dec 1, 2016 · 0 comments
Open

Understanding of brackets placement #54

n10ty opened this issue Dec 1, 2016 · 0 comments

Comments

@n10ty
Copy link

n10ty commented Dec 1, 2016

I need to sync my understanding of how and why rulerz place brackets. Below you can see several examples.
Condidtion:
$rules = '1 = 1 and 1 = 1 and 1 = 1 or 1 = 1';
Result in query:
WHERE ((1 = 1 AND (1 = 1 AND (1 = 1 OR 1 = 1))))

Condition:
(1 = 1) and ((1 = 1) or (1 = 1) or (1 = 1)) and (1 = 1 or 1 = 1 or 1 = 1)
Result:
((1 = 1 AND ((1 = 1 OR (1 = 1 OR 1 = 1)) AND (1 = 1 OR (1 = 1 OR 1 = 1)))))

In the second example, it increases the deep of Doctrine query. In result: simple condition becomes enormous.
So, I have a situation where I need only a lot of conditions joined with OR, but after adding brackets it becomes 256 nested level error.
I don't understand it. Is it always add brackets? How should I avoid this? Why it so? What is the main idea of it? I didn't find any mention of this case in documentation. Thank for your answer, your library is really great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant