neoxygen/neo4j-neoclient — pull request #14 by ikwattro (2014-10-25 00:05:43+00:00)
Title: 2.0

This branch contains improvements from the 1.7 branch + the proof of concept for the 2.0 version :

Thoughts about the 2.0 branch :

### Bootstrapping changes

The first call will not be done against the Client class, but against the `ServiceContainer` class that will process configuration and returns a `Client` object. This fixes problem accessing the methods in the Client when the library is used from a framework and using the service container.

### New extension management

The extensions now extends `AbstractExtension` , having access to the *invoke* mehtod.

This brings 10x more flexibilty and user/developer friendlyness.

Also, The doc MUST be more clear to explain that `commands` are target to be calls to the api endpoint. Normally you should not write so much commands.

#### Before

For using a command from a custom extension the following was needed :

```php
$command = $client->invoke('my_custom_command');
$command->setArguments($param1, $param2);
$command->execute();
```

Also, you could not write custom methods in your extension class that will be accessible through your application.

#### After

Your extension have automatically access to the invoke method of the commandManager, also you can write custom methods that will be available through your application, thanks to the `__call` magic method.

```php
// In your Custom Extension class
public function doWhateverIWant()
{
$this->invoke('my_super_command');
return $command->execute();
}
```

```php
// from your application
$client->doWhateverIWant();
```

I started to move the core methods present in the Client class to the `NeoClientCoreExtension` class and all my tests are still passing.

This gives really good future for new extensions with useful methods like spatial.

NB: The `getAvailableCommands` static function of your extension class still remains, this gives the possibility to other extensions to access the commands.

NB2: Extensions are registered in reversed order, this means you can override core commands with your specific commands.

### Response handling

The client will expose automatically a Response handling system, no need to format the response yourself and the possibility to handle `row` parts of the api will be implemented.

### Matrix

An adjacency matrix will be implemented in the Result class, in order to avoid current recursive arrays.

Ping @Mulkave