定制 klaussilveira/neo4j-ogm-bundle 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

klaussilveira/neo4j-ogm-bundle

Composer 安装命令:

composer require klaussilveira/neo4j-ogm-bundle

包简介

This bundle provides a simple integration of the Neo4j PHP Object Graph Mapper into Symfony2

README 文档

README

This bundle provides a simple integration of the "Neo4j PHP Object Graph Mapper" from Louis-Philippe Huberdeau into Symfony2. The Neo4j OGM is an object management layer built on top of Josh Adell's Neo4jPHP. It allows manipulation of data inside the Neo4j graph database through the REST connectors.

Installation

To install this bundle, add this to your project's composer.json:

"require": {
    // ...
    "klaussilveira/neo4j-ogm-bundle": "dev-master",
}

Next, update your vendors by running:

$ composer update

Now enable the bundle in the kernel:

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Neo4j\OGM\OGMBundle\Neo4jOGMBundle(),
    );
}

And configure the bundle by adding the neo4j_ogm namespace into config.yml:

neo4j_ogm:
    host: 'localhost'
    port: 7474

Congratulations! You're ready to use Neo4j OGM into Symfony2.

Basic Usage

The only thing to do is to request the neo4j.manager service from the container to get an instance of HireVoice\Neo4j\EntityManager.

<?php

$em = $this->container->get('neo4j.manager');
$repo = $em->getRepository('Entity\\User');
$john = $repo->findOneByFullName('John Doe');

$list = $em->createCypherQuery()
    ->startWithNode('john', $john)
    ->match('john -[:follow]-> followedBy <-[:follow]- similarInterest')
    ->match('similarInterest -[:follow]-> potentialMatch')
    ->end('potentialMatch', 'count(*)')
    ->order('count(*) DESC')
    ->limit(10)
    ->getList();

Configuration

You can easily configure the Neo4j OGM by changing neo4j_ogm on your config.yml:

neo4j_ogm:
    transport: 'curl'
    host: 'localhost'
    port: 7474
    username: 'test'
    password: '123456'
    proxy_dir: '/tmp'
    debug: true

统计信息

  • 总下载量: 24.83k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 30
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 29
  • Watchers: 3
  • Forks: 9
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2012-11-20