function testNodeIndexLookup() { $entity = new Entity\Movie(); $entity->setTitle('Return of the king'); $entity->setCategory('long'); $matrix = new Entity\Movie(); $matrix->setTitle('Matrix'); $matrix->setCategory('scifi'); $matrix2 = new Entity\Movie(); $matrix2->setTitle('Matrix2'); $matrix2->setCategory('scifi'); $em = $this->getEntityManager(); $em->persist($entity); $em->persist($matrix); $em->persist($matrix2); $em->flush(); $movieKey = $entity->getMovieRegistryCode(); $em = $this->getEntityManager(); $movies = $em->createCypherQuery()->start('entity = node:`MovieNodeIndex`(movie_title = \'Return of the king\')')->end('entity')->getList(); foreach ($movies as $movie) { $this->assertEquals('Return of the king', $movie->getTitle()); } $movies = $em->createCypherQuery()->start('entity = node:`MovieNodeIndex`(title = \'Return of the king\')')->end('entity')->getList(); foreach ($movies as $movie) { $this->assertEquals('Return of the king', $movie->getTitle()); } }
public function createNodes() { $em = $this->getEntityManager(); $entity = new Entity\Movie(); $entity->setTitle('Return of the king'); $entity->setCategory('long'); $em->persist($entity); $uid = uniqid(); $matrix = new Entity\Movie(); $matrix->setTitle($uid); $matrix->setCategory('scifi'); $em->persist($matrix); $matrix2 = new Entity\Movie(); $matrix2->setTitle('The ' . $uid); $matrix->setCategory('scifi'); $em->persist($matrix2); $em->flush(); return $uid; }