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

doesntHave method does not work #36

Open
joseraul opened this issue Mar 19, 2021 · 2 comments
Open

doesntHave method does not work #36

joseraul opened this issue Mar 19, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@joseraul
Copy link

  • Laravel Version: 7.x
  • PHP Version: 7.4
  • NeoEloquent Version: 7.0.0

Description:

The doesntHave method does not work. I guess other variants like whereDoesntHave, orWhereDoesntHave will not work either.

Steps To Reproduce:

Person::doesntHave("twitter")

is generating a query like

MATCH (person:`Person`), (person)-[`rel_owns_twitter`:`OWNS`]->(twitter:`Twitter`) WHERE person.deleted_at is null WITH person, count(twitter) AS twitter_count WHERE twitter_count < 1 RETURN person

It is matching on the Persons Twitter account and then requiring that there is less than one Twitter account...

@joseraul joseraul added the bug Something isn't working label Mar 19, 2021
@raavus-funkmaster
Copy link

So doesntHave appears to call has in QueriesRelationships.php. I think if the second match clause was changed to an OPTIONAL MATCH, it would fix doesntHave without breaking has.

@xumng
Copy link

xumng commented Dec 15, 2021

So doesntHave appears to call has in QueriesRelationships.php. I think if the second match clause was changed to an OPTIONAL MATCH, it would fix doesntHave without breaking has.

yes. When I modify it, it can work. But where sub-clause don’t work. Because where sub-clause attach in optional match sub-clause not attach in match sub-clause.
I want cypher like this:
match (n) where … optional match (n)-[]-(m) with n, count(m) as cm where cm<1 return n

but it generate like this:
match (n) optional match (n)-[]-(m) where … with n, count(m) as cm where cm<1 return n

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants