You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How can we add properties to existing relationships dynamically? We are able to create them within Entity classes, but how can we create them on the fly?
This was from a previous answer with the same question
There is no direct way to do it through the API at this time. While there is some work in progress, it is quite far from completed.
You can register a callback on relation creation.
$em->registerEvent(HireVoice\Neo4j\EntityManager::RELATION_CREATE, function ($type, $relationName, $from, $to, $relation) {
// $relation is the Everyman\Neo4j\Relationshipif ($relationName === 'GOES_TO_MARKET') {
$relation->setProperty('foobar', 'baz')->save();
}
});
How exactly does this return a relation to modify? How do we use this?
The text was updated successfully, but these errors were encountered:
Ah I missed that, this bundle is great, we just need a method of adding properties to relationships dynamically which your example callback seems to do, an example use case would be great as I along with others are unsure how to implement it.
How can we add properties to existing relationships dynamically? We are able to create them within Entity classes, but how can we create them on the fly?
This was from a previous answer with the same question
How exactly does this return a relation to modify? How do we use this?
The text was updated successfully, but these errors were encountered: