You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Example: every book belongs to an optional subcategory, in turn belonging to a regular category.
We're trying to use the querybuilder to exclude books belonging to a category meeting certain conditions. (e.g. set to invisible)
$builder->whereDoesntHave('subcategory.category', function ($query) {
$query->where('visible', 0);
})
The above example would not return a book without a subcategory.
However, this book doesn't have a related category set to visible = 0, so one would expect this book to turn up in the results.
I'm not sure if this is intended this way, but it sure confused me for some time. So either a fix, or a warning in the docs might be useful.
Steps To Reproduce:
Test the above query.
To work correctly, the model would need a corresponding subcategory.
*Please note: this is my first issue in the Laravel repo. Feedback is welcomed.
The text was updated successfully, but these errors were encountered:
I can see why you would expect a different behavior, but I don't think this will be changed. It would potentially break people's existing code and probably wouldn't be an easy fix.
Description:
Example: every book belongs to an optional subcategory, in turn belonging to a regular category.
We're trying to use the querybuilder to exclude books belonging to a category meeting certain conditions. (e.g. set to invisible)
The above example would not return a book without a subcategory.
However, this book doesn't have a related category set to visible = 0, so one would expect this book to turn up in the results.
I'm not sure if this is intended this way, but it sure confused me for some time. So either a fix, or a warning in the docs might be useful.
Steps To Reproduce:
Test the above query.
To work correctly, the model would need a corresponding subcategory.
*Please note: this is my first issue in the Laravel repo. Feedback is welcomed.
The text was updated successfully, but these errors were encountered: