dev-master
9999999-dev https://github.com/tlg05/cakephp-neo4jNeo4j Datasource for CakePHP
GPL-3.0
The Requires
- php >=5.3.0
- composer/installers *
The Development Requires
by Ligeng Te
cakephp datasource neo4j
Neo4j Datasource for CakePHP
Place the repository under the Plugin folder, (*1)
cd my/app/Plugin git clone git://github.com/tlg05/cakephp-neo4j.git Neo4j
Load the plugin in bootstrap.php, (*2)
CakePlugin::load("Neo4j");
Provider database server information in database.php:, (*3)
class DATABASE_CONFIG { public $neo4j = array( 'datasource' => 'Neo4j.Neo4jSource', 'host' => 'localhost', 'port' => 34618, 'login' => 'neo4j', 'password' => 'password' ); public $test_neo4j = array( 'datasource' => 'Neo4j.Neo4jSource', 'host' => 'localhost', 'port' => 33110, 'login' => 'neo4j', 'password' => 'password' ); }
Note, (*4)
- Please make sure the model files use schemaless behavior.
- There is model Node and Relationship to be extended. These 2 kinds of models are differentiated by the property $modelType
The test cases contain thorough examples of the usages. , (*5)
Nodes can be managed like normal CakePHP data:, (*6)
$data = array( 'title' => 'test1', 'body' => 'aaaa', 'text' => 'bbbb' ); $this->Post->create(); $this->Post->save($data); $data = $this->Post->find('all');
Relationships are special. We need to provide start node, end node and the properties for a relationship. The properties of the relationship needs to be placed under properties tag instead of the root level of the data:, (*7)
$data = array( 'start' => 'Post', 'end' => 'Writer', 'conditions' => array( 'start.title' => 'The Old Man and the Sea', 'end.name' => 'Hemingway' ), 'properties' => array( 'note' => ‘Hemingway writes The Old Man and the Sea' ) ); $this->Write->create(); $this->Write->save($data3, array("atomic" => false));
Data association is not supported yet. , (*8)
Ligeng Te tlgnewlife@gmail.com, (*9)
Neo4j Datasource for CakePHP
GPL-3.0
cakephp datasource neo4j