Vinelab / NeoEloquent

The Neo4j OGM for Laravel
MIT License
634 stars 200 forks source link

orWhereHas() query operator mismatch #131

Closed KinaneD closed 4 years ago

KinaneD commented 8 years ago

Using Laravel 5.1 and NeoEloquent 2.0.0, I am trying to run a query similar to something like the following:

$model->whereHas('parents', function($query) use($progenitorId){
            $query->whereIn('id', $progenitorId);
        })->orWhereHas('mother', function($query) use($progenitorId){
            $query->whereIn('id', $progenitorId);
        })->skip($offset)
                  ->take($limit)
                  ->get();

The query parameter received in Vinelab\NeoEloquent\Connection::run() goes like this:

MATCH (model:`Model`), (model)-[rel_has_parent:HAS_PARENT]->(progenitor:`Progenitor`),
(model:`Model`), (model)-[rel_has_mother:HAS_MOTHER]->(progenitor:`Progenitor`) WHERE
progenitor.id IN ['1e844336-17d2-4cc4-8c8c-89f5c2cb3da7'] and progenitor.id IN ['1e844336-17d2-4cc4-
8c8c-89f5c2cb3da7'] RETURN model, rel_has_parent, rel_has_mother SKIP 0 LIMIT 10

Obviously, the use of AND operator instead of OR is an issue.

KinaneD commented 8 years ago

@tomb10516 Hey Tom, I read recently that you have been working on something related to this, any chance you already have a fix?

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.