jadell / neo4jphp

PHP wrapper of the Neo4j REST interface
Other
533 stars 137 forks source link

don't load the relationship when it's only traversed #113

Closed mitom closed 10 years ago

mitom commented 10 years ago

I was wondering why are the relationship's properties hydrated when only the start and end nodes of it are requested, seems unnecessary to me.

jadell commented 10 years ago

If the relationship hasn't been loaded from the server yet, we won't know what the start and end nodes are. The loadProperties call retrieves the entire representation of the relationship, which includes the properties and also the start/end nodes.

We don't have to call loadProperties if we already have the nodes; wrapping the $this->loadProperties() call in if ($this->start) or if ($this->end) would be better than not calling it at all.

mitom commented 10 years ago

Thank you for your response, I updated the PR accordingly.