CouchDB ODM

基于CouchDB的Document Mapper。(A Document Mapper based on CouchDB.)

  • 所有者: doctrine/couchdb-odm
  • 平台: BSD, Linux, Mac, Windows
  • 许可证: MIT License
  • 分类:
  • 主题:
  • 喜欢:
    0
      比较:

Github星跟踪图

CouchDB ODM

Doctrine CouchDB是PHP和CouchDB文档之间的映射器。 它使用元数据映射模式将文档映射到普通的旧php对象,不需要任何类型的ActiveRecord模式或基类。

元数据映射可以通过注释、xml、yaml或php完成。 使用注释映射到CouchDB的示例PHP对象如下所示:

/**
 * @Document
 */
class Article
{
    /** @Id */
    private $id;

    /**
     * @Field(type="string")
     */
    private $topic;

    /**
     * @Field(type="string")
     */
    private $text;

    /**
     * @ReferenceOne(targetDocument="User")
     */
    private $author;

    // a bunch of setters and getters
}

此文档的简单工作流程如下所示:

 <?php
$article = new Article();
$article->setTopic("Doctrine CouchDB");
$article->setText("Documentation");
$article->setAuthor(new Author("beberlei"));

// creating the document
$dm->persist($article);
$dm->flush();

$article = $dm->find("Article", 1234);
$article->setText("Documentation, and more documentation!");

// update the document
$dm->flush();

// removing the document
$dm->remove($article);
$dm->flush();

您可以使用每个git checkout的沙箱/文件夹中提供的沙箱,或者阅读文档 http://docs.doctrine-project.org/projects/doctrine-couchdb/en/latest/

主要指标

概览
名称与所有者doctrine/couchdb-odm
主编程语言PHP
编程语言PHP (语言数: 2)
平台BSD, Linux, Mac, Windows
许可证MIT License
所有者活动
创建于2010-09-18 09:37:23
推送于2019-09-02 14:16:11
最后一次提交2019-03-12 02:20:21
发布数3
最新版本名称v1.0.0-alpha3 (发布于 2015-11-11 19:36:57)
第一版名称1.0.0alpha1 (发布于 2011-05-27 20:58:54)
用户参与
星数149
关注者数14
派生数53
提交数512
已启用问题?
问题数55
打开的问题数20
拉请求数64
打开的拉请求数10
关闭的拉请求数25
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?

CouchDB ODM

Build Status
Scrutinizer Quality Score

Doctrine CouchDB is a mapper between PHP and CouchDB documents. It uses a metadata mapping
pattern to map the documents to plain old php objects, no ActiveRecord pattern or base class
of any kind is necessary.

Metadata mapping can be done through annotations, xml, yaml or php. A sample PHP object
that is mapped to CouchDB with annotations looks like this:

/**
 * @Document
 */
class Article
{
    /** @Id */
    private $id;

    /**
     * @Field(type="string")
     */
    private $topic;

    /**
     * @Field(type="string")
     */
    private $text;

    /**
     * @ReferenceOne(targetDocument="User")
     */
    private $author;

    // a bunch of setters and getters
}

A simple workflow with this document looks like:

<?php
$article = new Article();
$article->setTopic("Doctrine CouchDB");
$article->setText("Documentation");
$article->setAuthor(new Author("beberlei"));

// creating the document
$dm->persist($article);
$dm->flush();

$article = $dm->find("Article", 1234);
$article->setText("Documentation, and more documentation!");

// update the document
$dm->flush();

// removing the document
$dm->remove($article);
$dm->flush();

You can play around with the sandbox shipped in the sandbox/ folder of every git checkout
or read the documentation at https://www.doctrine-project.org/projects/doctrine-couchdb-odm/en/latest/index.html