mongodb-odm-docs-dash/build.docset/Contents/Resources/Documents/tutorials/getting-started.html
2017-12-01 19:35:11 -08:00

427 lines
27 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Getting Started &mdash; Doctrine MongoDB ODM 1.1.5 documentation</title>
<link rel="stylesheet" href="../_static/bootstrap/css/bootstrap.min.css" type="text/css" />
<link rel="stylesheet" href="../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../_static/layout.css" type="text/css" />
<link rel="stylesheet" href="../_static/configurationblock.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '1.1.5',
COLLAPSE_MODINDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/configurationblock.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/configurationblock.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<script type="text/javascript" src="../_static/configurationblock.js"></script>
<script src="../_static/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript">
<!--
$(document).ready(function() {
$("#versions").change(function() {
var docsUrl = $(this).val();
window.location.href = docsUrl;
});
});
-->
</script>
<link rel="shortcut icon" href="../_static/doctrine.ico"/>
<link rel="search" title="Search" href="../search.html" />
<link rel="top" title="Doctrine MongoDB ODM 1.1.5 documentation" href="../index.html" />
</head>
<body>
<div id="wrapper">
<div id="header">
<h1 id="h1title"></h1>
<div id="logo">
<a href="http://www.doctrine-project.org/">Doctrine - PHP Database Libraries</a>
</div>
</div>
<div id="nav" class="cls">
<div class="tl cls">
<ul>
<li><a target="_top" href="http://www.doctrine-project.org/">Home</a></li>
<li><a target="_top" href="http://www.doctrine-project.org/about.html">About</a></li>
<li><a target="_top" href="http://www.doctrine-project.org/projects.html">Projects</a></li>
<li><a target="_top" href="http://www.doctrine-project.org/contribute.html">Contribute</a></li>
<li><a target="_top" href="http://www.doctrine-project.org/community.html">Community</a></li>
<li><a target="_top" href="http://www.doctrine-project.org/archive.html">Blog</a></li>
<li><a target="_top" href="http://www.doctrine-project.org/jira">Development</a></li>
</ul>
</div>
</div>
<div id="content" class="cls">
<div class="related">
<h3>Navigation</h3>
<ul>
<li><a href="/">Doctrine Homepage</a> &raquo;</li>
<li><a href="../index.html">Doctrine MongoDB ODM 1.1.5 documentation</a> &raquo;</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" >
<div class="section" id="getting-started">
<h1>Getting Started<a class="headerlink" href="#getting-started" title="Permalink to this headline"></a></h1>
<p>Doctrine is a project that aims to handle the persistence of your
domain model in a non-interfering way. Non-relational or no-sql
databases like MongoDB give you flexibility of building data store
around your object model and not vise versa. You can read more on the
initial configuration and setup in <a class="reference internal" href="../reference/introduction.html"><span class="doc">Introduction to MongoDB Object
Document Mapper</span></a>. This section will give you a basic
overview of what could be accomplished using Doctrine MongoDB ODM.</p>
<div class="section" id="example-model-simple-blog">
<h2>Example Model: Simple Blog<a class="headerlink" href="#example-model-simple-blog" title="Permalink to this headline"></a></h2>
<p>To create the simplest example, lets assume the following in a simple blog web application:</p>
<ul class="simple">
<li>Blog has a user.</li>
<li>Blog user can make blog posts</li>
</ul>
</div>
<div class="section" id="a-first-prototype">
<h2>A first prototype<a class="headerlink" href="#a-first-prototype" title="Permalink to this headline"></a></h2>
<p>For the above mentioned example, something as simple as this could be modeled with plain PHP classes.
First define the <code class="docutils literal"><span class="pre">User</span></code> document:</p>
<div class="highlight-php"><div class="highlight"><pre><span class="cp">&lt;?php</span>
<span class="k">namespace</span> <span class="nx">Documents</span><span class="p">;</span>
<span class="k">class</span> <span class="nc">User</span>
<span class="p">{</span>
<span class="k">private</span> <span class="nv">$name</span><span class="p">;</span>
<span class="k">private</span> <span class="nv">$email</span><span class="p">;</span>
<span class="k">private</span> <span class="nv">$posts</span> <span class="o">=</span> <span class="k">array</span><span class="p">();</span>
<span class="c1">// ...</span>
<span class="p">}</span>
</pre></div>
</div>
<p>Now define the <code class="docutils literal"><span class="pre">BlogPost</span></code> document:</p>
<div class="highlight-php"><div class="highlight"><pre><span class="cp">&lt;?php</span>
<span class="k">namespace</span> <span class="nx">Documents</span><span class="p">;</span>
<span class="k">class</span> <span class="nc">BlogPost</span>
<span class="p">{</span>
<span class="k">private</span> <span class="nv">$title</span><span class="p">;</span>
<span class="k">private</span> <span class="nv">$body</span><span class="p">;</span>
<span class="k">private</span> <span class="nv">$createdAt</span><span class="p">;</span>
<span class="c1">// ...</span>
<span class="p">}</span>
</pre></div>
</div>
</div>
<div class="section" id="persistent-models">
<h2>Persistent Models<a class="headerlink" href="#persistent-models" title="Permalink to this headline"></a></h2>
<p>To make the above classes persistent, all we need to do is provide Doctrine with some mapping
information so that it knows how to consume the objects and persist them to the database.</p>
<p>You can provide your mapping information in Annotations, XML, or YAML:</p>
<div class="configuration-block">
<ul class="simple">
<li><em>PHP</em><div class="highlight-php"><div class="highlight"><pre><span class="cp">&lt;?php</span>
<span class="k">use</span> <span class="nx">Doctrine\ODM\MongoDB\Mapping\Annotations</span> <span class="k">as</span> <span class="nx">ODM</span><span class="p">;</span>
<span class="sd">/** @ODM\Document */</span>
<span class="k">class</span> <span class="nc">User</span>
<span class="p">{</span>
<span class="sd">/** @ODM\Id */</span>
<span class="k">private</span> <span class="nv">$id</span><span class="p">;</span>
<span class="sd">/** @ODM\Field(type=&quot;string&quot;) */</span>
<span class="k">private</span> <span class="nv">$name</span><span class="p">;</span>
<span class="sd">/** @ODM\Field(type=&quot;string&quot;) */</span>
<span class="k">private</span> <span class="nv">$email</span><span class="p">;</span>
<span class="sd">/** @ODM\ReferenceMany(targetDocument=&quot;BlogPost&quot;, cascade=&quot;all&quot;) */</span>
<span class="k">private</span> <span class="nv">$posts</span> <span class="o">=</span> <span class="k">array</span><span class="p">();</span>
<span class="c1">// ...</span>
<span class="p">}</span>
<span class="sd">/** @ODM\Document */</span>
<span class="k">class</span> <span class="nc">BlogPost</span>
<span class="p">{</span>
<span class="sd">/** @ODM\Id */</span>
<span class="k">private</span> <span class="nv">$id</span><span class="p">;</span>
<span class="sd">/** @ODM\Field(type=&quot;string&quot;) */</span>
<span class="k">private</span> <span class="nv">$title</span><span class="p">;</span>
<span class="sd">/** @ODM\Field(type=&quot;string&quot;) */</span>
<span class="k">private</span> <span class="nv">$body</span><span class="p">;</span>
<span class="sd">/** @ODM\Field(type=&quot;date&quot;) */</span>
<span class="k">private</span> <span class="nv">$createdAt</span><span class="p">;</span>
<span class="c1">// ...</span>
<span class="p">}</span>
</pre></div>
</div>
</li>
<li><em>XML</em><div class="highlight-xml"><div class="highlight"><pre><span class="cp">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;</span>
<span class="nt">&lt;doctrine-mongo-mapping</span> <span class="na">xmlns=</span><span class="s">&quot;http://doctrine-project.org/schemas/odm/doctrine-mongo-mapping&quot;</span>
<span class="na">xmlns:xsi=</span><span class="s">&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</span>
<span class="na">xsi:schemaLocation=</span><span class="s">&quot;http://doctrine-project.org/schemas/odm/doctrine-mongo-mapping</span>
<span class="s"> http://doctrine-project.org/schemas/odm/doctrine-mongo-mapping.xsd&quot;</span><span class="nt">&gt;</span>
<span class="nt">&lt;document</span> <span class="na">name=</span><span class="s">&quot;Documents\User&quot;</span><span class="nt">&gt;</span>
<span class="nt">&lt;field</span> <span class="na">fieldName=</span><span class="s">&quot;id&quot;</span> <span class="na">id=</span><span class="s">&quot;true&quot;</span> <span class="nt">/&gt;</span>
<span class="nt">&lt;field</span> <span class="na">fieldName=</span><span class="s">&quot;name&quot;</span> <span class="na">type=</span><span class="s">&quot;string&quot;</span> <span class="nt">/&gt;</span>
<span class="nt">&lt;field</span> <span class="na">fieldName=</span><span class="s">&quot;email&quot;</span> <span class="na">type=</span><span class="s">&quot;string&quot;</span> <span class="nt">/&gt;</span>
<span class="nt">&lt;reference-many</span> <span class="na">fieldName=</span><span class="s">&quot;posts&quot;</span> <span class="na">targetDocument=</span><span class="s">&quot;Documents\BlogPost&quot;</span><span class="nt">&gt;</span>
<span class="nt">&lt;cascade&gt;</span>
<span class="nt">&lt;all/&gt;</span>
<span class="nt">&lt;/cascade&gt;</span>
<span class="nt">&lt;/reference-many&gt;</span>
<span class="nt">&lt;/document&gt;</span>
<span class="nt">&lt;/doctrine-mongo-mapping&gt;</span>
<span class="cp">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;</span>
<span class="nt">&lt;doctrine-mongo-mapping</span> <span class="na">xmlns=</span><span class="s">&quot;http://doctrine-project.org/schemas/odm/doctrine-mongo-mapping&quot;</span>
<span class="na">xmlns:xsi=</span><span class="s">&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</span>
<span class="na">xsi:schemaLocation=</span><span class="s">&quot;http://doctrine-project.org/schemas/odm/doctrine-mongo-mapping</span>
<span class="s"> http://doctrine-project.org/schemas/odm/doctrine-mongo-mapping.xsd&quot;</span><span class="nt">&gt;</span>
<span class="nt">&lt;document</span> <span class="na">name=</span><span class="s">&quot;Documents\BlogPost&quot;</span><span class="nt">&gt;</span>
<span class="nt">&lt;field</span> <span class="na">fieldName=</span><span class="s">&quot;id&quot;</span> <span class="na">id=</span><span class="s">&quot;true&quot;</span> <span class="nt">/&gt;</span>
<span class="nt">&lt;field</span> <span class="na">fieldName=</span><span class="s">&quot;title&quot;</span> <span class="na">type=</span><span class="s">&quot;string&quot;</span> <span class="nt">/&gt;</span>
<span class="nt">&lt;field</span> <span class="na">fieldName=</span><span class="s">&quot;body&quot;</span> <span class="na">type=</span><span class="s">&quot;string&quot;</span> <span class="nt">/&gt;</span>
<span class="nt">&lt;field</span> <span class="na">fieldName=</span><span class="s">&quot;createdAt&quot;</span> <span class="na">type=</span><span class="s">&quot;date&quot;</span> <span class="nt">/&gt;</span>
<span class="nt">&lt;/document&gt;</span>
<span class="nt">&lt;/doctrine-mongo-mapping&gt;</span>
</pre></div>
</div>
</li>
<li><em>YAML</em><div class="highlight-yaml"><div class="highlight"><pre><span class="l l-Scalar l-Scalar-Plain">Documents\User</span><span class="p p-Indicator">:</span>
<span class="l l-Scalar l-Scalar-Plain">fields</span><span class="p p-Indicator">:</span>
<span class="l l-Scalar l-Scalar-Plain">id</span><span class="p p-Indicator">:</span>
<span class="l l-Scalar l-Scalar-Plain">type</span><span class="p p-Indicator">:</span> <span class="l l-Scalar l-Scalar-Plain">id</span>
<span class="l l-Scalar l-Scalar-Plain">id</span><span class="p p-Indicator">:</span> <span class="l l-Scalar l-Scalar-Plain">true</span>
<span class="l l-Scalar l-Scalar-Plain">name</span><span class="p p-Indicator">:</span>
<span class="l l-Scalar l-Scalar-Plain">type</span><span class="p p-Indicator">:</span> <span class="l l-Scalar l-Scalar-Plain">string</span>
<span class="l l-Scalar l-Scalar-Plain">email</span><span class="p p-Indicator">:</span>
<span class="l l-Scalar l-Scalar-Plain">type</span><span class="p p-Indicator">:</span> <span class="l l-Scalar l-Scalar-Plain">string</span>
<span class="l l-Scalar l-Scalar-Plain">referenceMany</span><span class="p p-Indicator">:</span>
<span class="l l-Scalar l-Scalar-Plain">posts</span><span class="p p-Indicator">:</span>
<span class="l l-Scalar l-Scalar-Plain">targetDocument</span><span class="p p-Indicator">:</span> <span class="l l-Scalar l-Scalar-Plain">Documents\BlogPost</span>
<span class="l l-Scalar l-Scalar-Plain">cascade</span><span class="p p-Indicator">:</span> <span class="l l-Scalar l-Scalar-Plain">all</span>
<span class="l l-Scalar l-Scalar-Plain">Documents\BlogPost</span><span class="p p-Indicator">:</span>
<span class="l l-Scalar l-Scalar-Plain">fields</span><span class="p p-Indicator">:</span>
<span class="l l-Scalar l-Scalar-Plain">id</span><span class="p p-Indicator">:</span>
<span class="l l-Scalar l-Scalar-Plain">type</span><span class="p p-Indicator">:</span> <span class="l l-Scalar l-Scalar-Plain">id</span>
<span class="l l-Scalar l-Scalar-Plain">id</span><span class="p p-Indicator">:</span> <span class="l l-Scalar l-Scalar-Plain">true</span>
<span class="l l-Scalar l-Scalar-Plain">title</span><span class="p p-Indicator">:</span>
<span class="l l-Scalar l-Scalar-Plain">type</span><span class="p p-Indicator">:</span> <span class="l l-Scalar l-Scalar-Plain">string</span>
<span class="l l-Scalar l-Scalar-Plain">body</span><span class="p p-Indicator">:</span>
<span class="l l-Scalar l-Scalar-Plain">type</span><span class="p p-Indicator">:</span> <span class="l l-Scalar l-Scalar-Plain">string</span>
<span class="l l-Scalar l-Scalar-Plain">createdAt</span><span class="p p-Indicator">:</span>
<span class="l l-Scalar l-Scalar-Plain">type</span><span class="p p-Indicator">:</span> <span class="l l-Scalar l-Scalar-Plain">date</span>
</pre></div>
</div>
</li>
</ul>
</div>
<p>Thats it, we have our models, and we can save and retrieve them. Now
all we need to do is to properly instantiate the <code class="docutils literal"><span class="pre">DocumentManager</span></code>
instance. Read more about setting up the Doctrine MongoDB ODM in the
<a class="reference internal" href="../reference/introduction.html"><span class="doc">Introduction to MongoDB Object Document Mapper</span></a>:</p>
<div class="highlight-php"><div class="highlight"><pre><span class="cp">&lt;?php</span>
<span class="k">use</span> <span class="nx">Doctrine\MongoDB\Connection</span><span class="p">;</span>
<span class="k">use</span> <span class="nx">Doctrine\ODM\MongoDB\Configuration</span><span class="p">;</span>
<span class="k">use</span> <span class="nx">Doctrine\ODM\MongoDB\DocumentManager</span><span class="p">;</span>
<span class="k">use</span> <span class="nx">Doctrine\ODM\MongoDB\Mapping\Driver\AnnotationDriver</span><span class="p">;</span>
<span class="nx">AnnotationDriver</span><span class="o">::</span><span class="na">registerAnnotationClasses</span><span class="p">();</span>
<span class="nv">$config</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Configuration</span><span class="p">();</span>
<span class="nv">$config</span><span class="o">-&gt;</span><span class="na">setProxyDir</span><span class="p">(</span><span class="s1">&#39;/path/to/generate/proxies&#39;</span><span class="p">);</span>
<span class="nv">$config</span><span class="o">-&gt;</span><span class="na">setProxyNamespace</span><span class="p">(</span><span class="s1">&#39;Proxies&#39;</span><span class="p">);</span>
<span class="nv">$config</span><span class="o">-&gt;</span><span class="na">setHydratorDir</span><span class="p">(</span><span class="s1">&#39;/path/to/generate/hydrators&#39;</span><span class="p">);</span>
<span class="nv">$config</span><span class="o">-&gt;</span><span class="na">setHydratorNamespace</span><span class="p">(</span><span class="s1">&#39;Hydrators&#39;</span><span class="p">);</span>
<span class="nv">$config</span><span class="o">-&gt;</span><span class="na">setMetadataDriverImpl</span><span class="p">(</span><span class="nx">AnnotationDriver</span><span class="o">::</span><span class="na">create</span><span class="p">(</span><span class="s1">&#39;/path/to/document/classes&#39;</span><span class="p">));</span>
<span class="nv">$dm</span> <span class="o">=</span> <span class="nx">DocumentManager</span><span class="o">::</span><span class="na">create</span><span class="p">(</span><span class="k">new</span> <span class="nx">Connection</span><span class="p">(),</span> <span class="nv">$config</span><span class="p">);</span>
</pre></div>
</div>
</div>
<div class="section" id="usage">
<h2>Usage<a class="headerlink" href="#usage" title="Permalink to this headline"></a></h2>
<p>Here is how you would use your models now:</p>
<div class="highlight-php"><div class="highlight"><pre><span class="cp">&lt;?php</span>
<span class="c1">// ...</span>
<span class="c1">// create user</span>
<span class="nv">$user</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">User</span><span class="p">();</span>
<span class="nv">$user</span><span class="o">-&gt;</span><span class="na">setName</span><span class="p">(</span><span class="s1">&#39;Bulat S.&#39;</span><span class="p">);</span>
<span class="nv">$user</span><span class="o">-&gt;</span><span class="na">setEmail</span><span class="p">(</span><span class="s1">&#39;email@example.com&#39;</span><span class="p">);</span>
<span class="c1">// tell Doctrine 2 to save $user on the next flush()</span>
<span class="nv">$dm</span><span class="o">-&gt;</span><span class="na">persist</span><span class="p">(</span><span class="nv">$user</span><span class="p">);</span>
<span class="c1">// create blog post</span>
<span class="nv">$post</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">BlogPost</span><span class="p">();</span>
<span class="nv">$post</span><span class="o">-&gt;</span><span class="na">setTitle</span><span class="p">(</span><span class="s1">&#39;My First Blog Post&#39;</span><span class="p">);</span>
<span class="nv">$post</span><span class="o">-&gt;</span><span class="na">setBody</span><span class="p">(</span><span class="s1">&#39;MongoDB + Doctrine 2 ODM = awesomeness!&#39;</span><span class="p">);</span>
<span class="nv">$post</span><span class="o">-&gt;</span><span class="na">setCreatedAt</span><span class="p">(</span><span class="k">new</span> <span class="nx">DateTime</span><span class="p">());</span>
<span class="nv">$user</span><span class="o">-&gt;</span><span class="na">addPost</span><span class="p">(</span><span class="nv">$post</span><span class="p">);</span>
<span class="c1">// store everything to MongoDB</span>
<span class="nv">$dm</span><span class="o">-&gt;</span><span class="na">flush</span><span class="p">();</span>
</pre></div>
</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Note that you do not need to explicitly call persist on the <code class="docutils literal"><span class="pre">$post</span></code> because the operation
will cascade on to the reference automatically.</p>
</div>
<p>Now if you did everything correctly, you should have those two objects
stored in MongoDB in correct collections and databases. You can use the
<a class="reference external" href="http://github.com/jwage/php-mongodb-admin">php-mongodb-admin project, hosted on github</a> to look at your
<code class="docutils literal"><span class="pre">BlogPost</span></code> collection, where you will see only one document:</p>
<div class="highlight-default"><div class="highlight"><pre>Array
(
[_id] =&gt; 4bec5869fdc212081d000000
[title] =&gt; My First Blog Post
[body] =&gt; MongoDB + Doctrine 2 ODM = awesomeness!
[createdAt] =&gt; MongoDate Object
(
[sec] =&gt; 1273723200
[usec] =&gt; 0
)
)
</pre></div>
</div>
<p>And the <code class="docutils literal"><span class="pre">User</span></code> collection would consist of the following:</p>
<div class="highlight-default"><div class="highlight"><pre>Array
(
[_id] =&gt; 4bec5869fdc212081d010000
[name] =&gt; Bulat S.
[email] =&gt; email@example.com
[posts] =&gt; Array
(
[0] =&gt; Array
(
[$ref] =&gt; blog_posts
[$id] =&gt; 4bec5869fdc212081d000000
[$db] =&gt; test_database
)
)
)
</pre></div>
</div>
<p>You can retrieve the user later by its identifier:</p>
<div class="highlight-php"><div class="highlight"><pre><span class="cp">&lt;?php</span>
<span class="c1">// ...</span>
<span class="nv">$userId</span> <span class="o">=</span> <span class="s1">&#39;....&#39;</span><span class="p">;</span>
<span class="nv">$user</span> <span class="o">=</span> <span class="nv">$dm</span><span class="o">-&gt;</span><span class="na">find</span><span class="p">(</span><span class="s1">&#39;User&#39;</span><span class="p">,</span> <span class="nv">$userId</span><span class="p">);</span>
</pre></div>
</div>
<p>Or you can find the user by name even:</p>
<div class="highlight-php"><div class="highlight"><pre><span class="cp">&lt;?php</span>
<span class="nv">$user</span> <span class="o">=</span> <span class="nv">$dm</span><span class="o">-&gt;</span><span class="na">getRepository</span><span class="p">(</span><span class="s1">&#39;User&#39;</span><span class="p">)</span><span class="o">-&gt;</span><span class="na">findOneByName</span><span class="p">(</span><span class="s1">&#39;Bulat S.&#39;</span><span class="p">);</span>
</pre></div>
</div>
<p>If you want to iterate over the posts the user references it is as easy as the following:</p>
<div class="highlight-php"><div class="highlight"><pre><span class="cp">&lt;?php</span>
<span class="nv">$posts</span> <span class="o">=</span> <span class="nv">$dm</span><span class="o">-&gt;</span><span class="na">getPosts</span><span class="p">();</span>
<span class="k">foreach</span> <span class="p">(</span><span class="nv">$posts</span> <span class="k">as</span> <span class="nv">$post</span><span class="p">)</span> <span class="p">{</span>
<span class="p">}</span>
</pre></div>
</div>
<p>You will notice that working with objects is nothing magical and you only have access to the properties,
getters and setters that you have defined yourself so the semantics are very clear. You can continue
reading about the MongoDB in the <a class="reference internal" href="../reference/introduction.html"><span class="doc">Introduction to MongoDB Object Document Mapper</span></a>.</p>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<div id="searchbox" style="">
<h3>Search</h3>
<form class="search" action="http://readthedocs.org/search/project/" method="get">
<input type="text" name="q" size="18">
<input type="submit" value="Go">
<input type="hidden" name="selected_facets" value="project:">
</form>
</div>
<h3><a href="../index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Getting Started</a><ul>
<li><a class="reference internal" href="#example-model-simple-blog">Example Model: Simple Blog</a></li>
<li><a class="reference internal" href="#a-first-prototype">A first prototype</a></li>
<li><a class="reference internal" href="#persistent-models">Persistent Models</a></li>
<li><a class="reference internal" href="#usage">Usage</a></li>
</ul>
</li>
</ul>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/tutorials/getting-started.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer">
&copy; Copyright 2013, Doctrine Project Team.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.6.2.
<br/>
<a target="_BLANK" href="http://www.servergrove.com"><img src="http://www.doctrine-project.org/_static/servergrove.jpg" /></a> <br/><br/>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick" />
<input type="hidden" name="hosted_button_id" value="BAE2E3XANQ77Y" />
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!" />
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" />
</form>
</div>
</div>
<div id="bot-rcnr">
<div class="tl"><!-- corner --></div>
</div>
</div>
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-288343-7";
urchinTracker();
</script>
<a class="githublink" href="http://github.com/doctrine"><img src="https://s3.amazonaws.com/github/ribbons/forkme_right_orange_ff7600.png" alt="Fork me on GitHub"></a>
</body>
</html>