Neo4j-PHP-OGM icon indicating copy to clipboard operation
Neo4j-PHP-OGM copied to clipboard

How to add properties to relationships?

Open babaganoush opened this issue 11 years ago • 8 comments

Hello,

while we are able to create new nodes etc., we are still struggling to find out how properties can be added to existing relationships. For instance we are declaring the following in an Entity format:

/** * @OGM\ManyToMany(relation="GOES_TO_MARKET") */ protected $shoppers;

How do we make it so that we can add additional properties to GOES_TO_MARKET using doctrine format?

Thanks

babaganoush avatar Jun 28 '13 12:06 babaganoush

Since this was also posted on StackOverflow.

http://stackoverflow.com/questions/17364841/add-properties-to-relationships-in-a-neo4j-database-using-neo4j-ogm-in-php/17365248#17365248

I will leave the issue open as it relates to a feature request.

lphuberdeau avatar Jun 28 '13 12:06 lphuberdeau

yes thank you for answering the question on stack overflow by the way :)

I hope this feature gets implemented as that would really assist with adding properties to relationships in real time.

babaganoush avatar Jun 29 '13 04:06 babaganoush

Oh and this is an awesome bundle . Thanks for your hard work.

babaganoush avatar Jun 29 '13 05:06 babaganoush

According to the documentation we should be able to create Relations using the api http://docs.neo4j.org/chunked/stable/rest-api-relationships.html#rest-api-create-relationship

ayhid avatar Mar 17 '14 16:03 ayhid

Yes, relations are being created through that API. The issue is mostly about creating custom types of relationships, which the OGM has no mapping for at this time.

lphuberdeau avatar Mar 17 '14 16:03 lphuberdeau

I am just beginning to learn neo4j, so I don't know much about custom relationships sorry, but without going into these custom relationships, is it possible to just pass an extra argument which will be used as properties for the relationship? I am trying to figure out a way to implement this.

ayhid avatar Mar 17 '14 16:03 ayhid

The link to the stackoverflow question above is still your best bet.

lphuberdeau avatar Mar 17 '14 16:03 lphuberdeau

okay thanks for the answer, I'll try to look more into the code to understand how it works.

ayhid avatar Mar 17 '14 16:03 ayhid