Vinelab / NeoEloquent

The Neo4j OGM for Laravel
MIT License
633 stars 197 forks source link

Select not working on eager loading #328

Closed raresnv closed 3 years ago

raresnv commented 5 years ago

I have the following subgraph of my db:

(:Person)-[:LIVES_ON]->(:Street)-[:PART_OF]->(:Neighbourhood)-[:LOCATED_IN]->(:City)-[:IN]->(:Country)

The models in Laravel are according to Neoeloquent documentation but i'm having trouble writing a query that would return: Person.fullname, Street.name, Neighbourhood.name, City.name, Country.name

Each of these entities contain a lot of information, but i just want to get their names.

What I've tried:

$result = App\Person::with('street', 'city', 'neighbourhood', 'country')->select('person.fullname', 'street.name', 'neighbourhood.name', 'city.name', 'country.name')->get();

Does not work. Now in eloquent normally this could be done with joins, but that's not an option in neoeloquent, so what am I doing wrong?

stale[bot] commented 3 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.