Multiple labels for a node
I didn't find possibility to add multiple labels for a node. For example, I have a base node Stop then I have inherited nodes like BusStop, TramStop, TrolleybusStop. I need that stops for trolleybus have two labels (Stop:TrolleybusStop). As I understood it is impossible now to do this. Am I right?
I would like to have something like this
-
array of labels in annotation
@OGM\Node(labels={"Stop", "TrolleybusStop"}) -
or like this
/**
* @OGM\Node(label="Stop")
*/
class Stop
{
}
/**
* @OGM\Node(label="TrolleybusStop")
*/
class TrolleybusStop extends Stop
{
// This entity should have both labels: Stop and TrolleybusStop.
// Because first one should be inherited from the parent class.
}
It is impossible to do it with inheritance. I agree it should be add when mapping inheritance will be in place.
In the meantime what you can do is add a @Label on a boolean property :
/**
* @OGM\Label(name="Stop")
*/
protected $isTrolley = true;
This is hacky but will work
While I understand the need, the way I would like to be achieved would require a bit time and development so I decided to plan this feature post GA release and spend more time on stability and the UOW refactoring which are more critical for now.
You can still use the trick I posted. Note though that having inherited labels in Neo4j is a bit useless because you have the same metadata implicitly from the relationships.