jadell / neo4jphp

PHP wrapper of the Neo4j REST interface
Other
532 stars 137 forks source link

Create addLabel method for Node class #166

Closed stevenmaguire closed 8 years ago

stevenmaguire commented 9 years ago

Occasionally you need to add a single Label to a Node and it is clumsy to do so by first creating a new array.

I am proposing a new method on the Node class to allow addition of a single Label to a Node.

This method centralizes the creation of an array with the provided Label, passes it directly to the addLabels method, and returns the list of all Node Labels.

public function addLabel(Label $label)
{
        $labels = array($label);
        return $this->addLabels($labels);
}
stevenmaguire commented 9 years ago

This build is failing and it appears to be related to https://github.com/php-memcached-dev/php-memcached/issues/126

A quick review of Travis CI indicates that this issue is also affecting PRs #121 and #117

jadell commented 9 years ago

Do we need to extend the Node class's API for this? Would it be enough for the existing addLabels on the Node (or better yet, the Client) class to check using is_array and wrap the parameter if it isn't already an array? Same questions apply to #167

stevenmaguire commented 9 years ago

@jadell I would lean on you for final say. For me from a style perspective I don't think these solutions are too much overhead when compared against the value of having method names the describe the functionality.