neoxygen / neo4j-neoclient

Simple PHP HttpClient for the Neo4j ReST API with Multi DB Support
MIT License
121 stars 138 forks source link

There should be a way to manually configure ha_mode on building client #52

Closed markharding closed 9 years ago

markharding commented 9 years ago

Currently you have to use the YAML config if you want to set ha_mode parameter. A function such as 'setHAMode()' in the connection builder would be helpful.

Currently I'm getting errors thrown because I'm not using the YAML config. neoxygen/neoclient/src/DependencyInjection/NeoClientExtension.php:64

ikwattro commented 9 years ago

@markharding Good point. Will add a method to stay inline with the yaml definition.

ikwattro commented 9 years ago

@markharding A PR is waiting for merge after the Travis build.

config :

$client = ClientBuilder::create()
    ->addConnection('server1', 'http', '193.147.213.3', 7474)
    ->addConnection('server2', 'http', '193.147.213.4', 7474)
    ->addConnection('server3', 'http', '193.147.213.7', 7474)
    ->setMasterConnection('server1') // Define the Master Connection by providing the connection alias
    ->setSlaveConnection('server2') // Idem for slave connections
    ->setSlaveConnection('server3')
    ->enableHAMode()
    ->build();

Please note that this will be valid only for Enterprise mode as the community support will disappear due to NeoTechnology license and rules.