doctrine/orientdb-odm 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

doctrine/orientdb-odm

最新稳定版本:1.0.0-beta7

Composer 安装命令:

composer require doctrine/orientdb-odm

包简介

PHP OrientDB Object Document Mapper (ODM) provides transparent persistence for PHP objects to OrientDB.

关键字:

README 文档

README

Build Status Total Downloads Latest Stable Version

What's Orient?

A set of tools to use and manage any OrientDB instance from PHP.

Orient includes:

  • the HTTP protocol binding
  • the query builder
  • the data mapper ( Object Graph Mapper )

If you don't know OrientDB take a look at its Documentation.

After cloning

In order to be able to run the examples and the test suite provided by Orient, you must first enter the root of the cloned repository and initialize all the needed dependencies using Composer. We provide an utility script in the bin/ subdirectory to ease this process so you can just do the following:

$ ./bin/initialize-dependencies.sh

Current status of the binding

The binding is complete: it is an HTTP client wrapper with some methods bound to OrientDB's HTTP interface.

Its usage is straightforward:

$parameters = Doctrine\OrientDB\Binding\BindingParameters::create('http://admin:admin@127.0.0.1:2480/demo');
$orient = new Doctrine\OrientDB\Binding\HttpBinding($parameters);
$output = $orient->query("SELECT FROM Address");

foreach ($output->getResult() as $address) {
    var_dump($address->street);
}

Use the PHP5.3 standard autoloader (https://gist.github.com/221634).

Current status of the query builder

The query-builder is finished, in the future we will consider the integration of OrientDB Graph Edition: http://code.google.com/p/orient/wiki/GraphEdTutorial.

To take advantage of the QB you only have to instantiate a Query object:

use Doctrine\OrientDB\Query\Query;

$query = new Query();
$query->from(array('users'))->where('username = ?', "admin");

echo $query->getRaw();      // SELECT FROM users WHERE username = "admin"

The Query object incapsulates lots of sub-commands, like SELECT, DROP, GRANT, INSERT and so on...

You can use also those commands:

use Doctrine\OrientDB\Query\Command\Select;

$select = new Select(array('users'));
echo $select->getRaw();     // SELECT FROM users

However, we strongly discourage this approach: commands will change, Query, thought as a facade, - hopefully - not.

You'd better take a look at the tests of the Query class and its subcommands to get a full overview of the available commands: in order to match OrientDB's native SQL-like synthax we tried to preserve names and stuff like that, but a few things have changed so far.

Current status of the mapper

We started working on the mapper and, right now, it is able to map OrientDB responses (converted in StdObject) to annotation-mapped POPOs. Also collections are hydrated properly.

However, it's under heavy work, so don't expect to be able to use it in a few weeks. Next steps are:

  • hydrate OrientDB native data-type (it includes floats, embedded-set|link|list, embedded-map|link|list and many others...)
  • provide a base repository class
  • implementation of the persistence from the ODM to OrientDB

Utilities

Orient incapsulates also a few utilities for PHP developers: on of them is an implementation of Dijkstra's algorithm.

use Doctrine\OrientDB\Graph\Graph;
use Doctrine\OrientDB\Graph\Vertex;
use Doctrine\OrientDB\Graph\Algorithm\Dijkstra;

$graph = new Graph();

$rome = new Vertex('Rome');
$paris = new Vertex('Paris');
$london = new Vertex('London');

$rome->connect($paris, 2);
$rome->connect($london, 3);
$paris->connect($london, 1);

$graph->add($rome);
$graph->add($paris);
$graph->add($london);

$algorithm = new Dijkstra($graph);
$algorithm->setStartingVertex($rome);
$algorithm->setEndingVertex($london);

var_dump($algorithm->solve());

Tests

The test suite can be launched simply by executing phpunit from the root directory of the repository.

By default the suite does not perform integration tests to verify the correct behaviour of our implementation against a running instance of OrientDB. Since integration tests are marked using the @group annotation, they can be enabled by default via phpunit.xml by adding a comment to the integration group in the list of excluded groups or, if you just want to execute them on a single execution basis, first load fixtures with this script

php ./test/Integration/fixtures/load.php

followeb by launching the suite with the additional --group argument:

phpunit --group __nogroup__,integration

It is also possible to generate a HTML report showing the code health of the library using PHP_CodeBrowser paired with the following dependencies (in addition to phpunit):

  • phpcpd
  • phpdcd
  • phploc
  • phpmd
  • phpdepend
  • phpcb

Executing ./bin/report.sh from the root directory of the repository will generate the report in log/report/index.html.

Requirements

These are the requirements in order to use the library:

  • PHP >= 5.3.3
  • OrientDB >= 1.2.0

In order to launch the test suite PHPUnit 3.6 is required.

Tracker & software lifecycle

See: https://github.com/doctrine/orientdb-odm/issues

Further documentation

If you want to take a look at a fancy PHPDoc documentation you can use doxygen:

sudo apt-get install doxygen

and then use the script provided under the docs directory:

doxygen docs/orient.d

which will generate technical documentation under the folder docs/html.

doctrine/orientdb-odm 适用场景与选型建议

doctrine/orientdb-odm 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.66k 次下载、GitHub Stars 达 156, 最近一次更新时间为 2012 年 12 月 28 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「orientdb」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 doctrine/orientdb-odm 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 doctrine/orientdb-odm 我们能提供哪些服务?
定制开发 / 二次开发

基于 doctrine/orientdb-odm 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 2.66k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 158
  • 点击次数: 27
  • 依赖项目数: 4
  • 推荐数: 0

GitHub 信息

  • Stars: 156
  • Watchers: 30
  • Forks: 54
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2012-12-28