Skip to content
This repository has been archived by the owner on Dec 1, 2021. It is now read-only.

Multiple labels for a node #54

Open
fre5h opened this issue Jan 29, 2017 · 2 comments
Open

Multiple labels for a node #54

fre5h opened this issue Jan 29, 2017 · 2 comments

Comments

@fre5h
Copy link

fre5h commented Jan 29, 2017

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

  1. array of labels in annotation
    @OGM\Node(labels={"Stop", "TrolleybusStop"})

  2. 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.
}
@ikwattro
Copy link
Member

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

@ikwattro
Copy link
Member

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants