user3323098
user3323098

Reputation: 1

Call to makeLabel in Neo4j for PHP is failing

Creating nodes works fine, but when I try to add labels I run into the following problem.

PHP Fatal error: Call to undefined method Everyman\Neo4j\Client::makeLabel() in /elixir/apps/home/bin/elixir_classes/class.StorageController.php on line 208

What am I doing wrong here?

Thanks,

-Edwin

This is the snippet of the relevant code

<?php

use Everyman\Neo4j\Client,
    Everyman\Neo4j\Transport,
    Everyman\Neo4j\Node,
    Everyman\Neo4j\Relationship;

.
.

$neo4jclient = new Client(new Transport('durq2idb10-tst.corp.xyz.com', 7474));

// Create nodes

$controller = new Node($neo4jclient);
$controller->setProperty('serialnumber', "$this->serialnumber")->save();
$controller->setProperty('system_id', "$this->system_id")->save();
$controller->setProperty('hostname', "$this->hostname")->save();

$controller_label=$neo4jclient->makeLabel('Storage Controller');
$controller->addLabels($controller_label)->save();

Upvotes: 0

Views: 124

Answers (1)

Josh Adell
Josh Adell

Reputation: 1555

You seem to be using an older version of neo4jphp. Please install the lastest version using Composer, as described here: https://github.com/jadell/neo4jphp/wiki/Getting-started

You will need to change the Client instantiation. Change the line to

$neo4jclient = new Client('durq2idb10-tst.corp.xyz.com', 7474);

If you need to customize the Transport (it does not look like you are doing that, but just in case) you can do new Transport\Curl($host, $port) or new Transport\Stream($host, port).

Upvotes: 1

Related Questions