neo4j-php-ogm icon indicating copy to clipboard operation
neo4j-php-ogm copied to clipboard

Implemented multiple labels ability.

Open chvarkov opened this issue 5 years ago • 3 comments

Added ability usage multiple labels. See issue https://github.com/graphaware/neo4j-php-ogm/issues/54 Example of usage:

/**
 * @OGM\Node(labels={"Person"})
 */
class Person
{
}

/**
 * @OGM\Node(labels={"Student", "Person"})
 */
class Student extends Person
{
}

/**
 * @OGM\Node(labels={"Worker", "Person"})
 */
class Worker extends Person
{
}
 // Returns an array of Person from nodes (:Person)
$this->em->getRepository(Person::class)->findAll(); 

// Returns an array of Student from nodes (:Student:Person)
$this->em->getRepository(Student::class)->findAll(); 

// Returns an array of Student from nodes (:Worker:Person)
$this->em->getRepository(Worker::class)->findAll();  // Returns an array of Worker

chvarkov avatar May 03 '19 20:05 chvarkov

Dear @chvarkov,

thank you very much for your Github contributions to GraphAware's software. In order for us to be able to accept and keep your contributions, we would like to ask you to download, fill in, sign, and send us a photo / scanned copy of the attached Contributor License Agreement to [email protected] .

Thank you very much in advance,

Kind Regards,

The GraphAware Team

graphaware-bot avatar May 03 '19 20:05 graphaware-bot

Thanks @chvarkov

This looks great ! One small question, in the case of a class with 2 labels, let's say Student and Person, and an index in the database on Person only, are the queries optimized to make use of the index ?

ikwattro avatar May 05 '19 08:05 ikwattro

@ikwattro Oops. I need better research it. Maybe you see solution?

chvarkov avatar May 07 '19 10:05 chvarkov