Skip to content

orWhere()/orWhereIn() breaks Query Builder #12842

@marcorieser

Description

@marcorieser

Bug description

I'm using the Stache for querying entries.

I try to query some entries from a set of collections, but I need to include some entries from another collection by ID.

This works perfectly fine:

Entry::query()
    ->whereIn('collection', ['pages', 'events'])
    ->get();

But adding ->orWhereIn('id', ['1234','456']) returns zero results:

Entry::query()
    ->whereIn('collection', ['pages', 'events'])
    ->orWhereIn('id', ['1234','456'])
    ->get();

According to Ryan, this could be solved by modifying lines 25 and 42, like in that screenshot below.

Image

How to reproduce

Run a similar query as written in the description.

Logs

nope

Environment

Environment
Application Name: Statamic
Laravel Version: 11.44.7
PHP Version: 8.4.13
Composer Version: 2.8.11
Environment: local
Debug Mode: ENABLED
URL: voicesforhealthykids.test
Maintenance Mode: OFF
Timezone: America/Chicago
Locale: en

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: file
Database: mysql
Logs: stack / single
Mail: smtp
Queue: sync
Session: file

Livewire
Livewire: v3.6.3

Statamic
Addons: 4
Sites: 1
Stache Watcher: Enabled
Static Caching: Disabled
Version: 5.53.1 PRO

Statamic Addons
marcorieser/statamic-livewire: 4.4.3
rias/statamic-color-swatches: 2.3.0
statamic/seo-pro: 6.6.3
transformstudios/front: 3.0.2

Installation

Fresh statamic/statamic site via CLI

Additional details

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions