doctrine/couchdb-odm
PHP Doctrine CouchDB Object Document Mapper (ODM) provides transparent persistence for PHP objects to CouchDB.
Maintainers
Requires
- php: >=5.3.2
- doctrine/common: ~2.2
- doctrine/couchdb: dev-master
- doctrine/instantiator: ~1.0
- symfony/console: >=2.0
Requires (Dev)
- phpunit/phpunit: @stable
- symfony/yaml: ~2.0
Suggests
- symfony/yaml: If you want to use YAML Mappings
Provides
None
Conflicts
None
Replaces
None
MIT 668817fd269f2f83739b8ac5297b674819084ad4
- Benjamin Eberlei <kontakt.woop@beberlei.de>
- Lukas Kahwe Smith <smith.woop@pooteeweet.org>
This package is auto-updated.
Last update: 2024-02-12 11:06:56 UTC
README
👁 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
