188 lines
11 KiB
HTML
188 lines
11 KiB
HTML
<!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>Console Commands — 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> »</li>
|
|
<li><a href="../index.html">Doctrine MongoDB ODM 1.1.5 documentation</a> »</li>
|
|
</ul>
|
|
</div>
|
|
|
|
<div class="document">
|
|
<div class="documentwrapper">
|
|
<div class="bodywrapper">
|
|
|
|
<div class="body" >
|
|
|
|
<div class="section" id="console-commands">
|
|
<h1>Console Commands<a class="headerlink" href="#console-commands" title="Permalink to this headline">¶</a></h1>
|
|
<p>Doctrine MongoDB ODM offers some console commands, which utilize Symfony2's
|
|
Console component, to ease your development process:</p>
|
|
<ul class="simple">
|
|
<li><code class="docutils literal"><span class="pre">odm:clear-cache:metadata</span></code> - Clear all metadata cache of the various cache drivers.</li>
|
|
<li><code class="docutils literal"><span class="pre">odm:query</span></code> - Query mongodb and inspect the outputted results from your document classes.</li>
|
|
<li><code class="docutils literal"><span class="pre">odm:generate:documents</span></code> - Generate document classes and method stubs from your mapping information.</li>
|
|
<li><code class="docutils literal"><span class="pre">odm:generate:hydrators</span></code> - Generates hydrator classes for document classes.</li>
|
|
<li><code class="docutils literal"><span class="pre">odm:generate:proxies</span></code> - Generates proxy classes for document classes.</li>
|
|
<li><code class="docutils literal"><span class="pre">odm:generate:repositories</span></code> - Generate repository classes from your mapping information.</li>
|
|
<li><code class="docutils literal"><span class="pre">odm:schema:create</span></code> - Allows you to create databases, collections and indexes for your documents</li>
|
|
<li><code class="docutils literal"><span class="pre">odm:schema:drop</span></code> - Allows you to drop databases, collections and indexes for your documents</li>
|
|
<li><code class="docutils literal"><span class="pre">odm:schema:update</span></code> - Allows you to update indexes for your documents</li>
|
|
<li><code class="docutils literal"><span class="pre">odm:schema:shard</span></code> - Allows you to enable sharding for your documents</li>
|
|
</ul>
|
|
<p>Provided you have an existing <code class="docutils literal"><span class="pre">DocumentManager</span></code> instance, you can setup a
|
|
console command easily with the following code:</p>
|
|
<div class="highlight-php"><div class="highlight"><pre><span class="cp"><?php</span>
|
|
|
|
<span class="c1">// mongodb.php</span>
|
|
|
|
<span class="c1">// ... include Composer autoloader and configure DocumentManager instance</span>
|
|
|
|
<span class="nv">$helperSet</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">\Symfony\Component\Console\Helper\HelperSet</span><span class="p">(</span><span class="k">array</span><span class="p">(</span>
|
|
<span class="s1">'dm'</span> <span class="o">=></span> <span class="k">new</span> <span class="nx">\Doctrine\ODM\MongoDB\Tools\Console\Helper\DocumentManagerHelper</span><span class="p">(</span><span class="nv">$dm</span><span class="p">),</span>
|
|
<span class="p">));</span>
|
|
|
|
<span class="nv">$app</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Application</span><span class="p">(</span><span class="s1">'Doctrine MongoDB ODM'</span><span class="p">);</span>
|
|
<span class="nv">$app</span><span class="o">-></span><span class="na">setHelperSet</span><span class="p">(</span><span class="nv">$helperSet</span><span class="p">);</span>
|
|
<span class="nv">$app</span><span class="o">-></span><span class="na">addCommands</span><span class="p">(</span><span class="k">array</span><span class="p">(</span>
|
|
<span class="k">new</span> <span class="nx">\Doctrine\ODM\MongoDB\Tools\Console\Command\GenerateDocumentsCommand</span><span class="p">(),</span>
|
|
<span class="k">new</span> <span class="nx">\Doctrine\ODM\MongoDB\Tools\Console\Command\GenerateHydratorsCommand</span><span class="p">(),</span>
|
|
<span class="k">new</span> <span class="nx">\Doctrine\ODM\MongoDB\Tools\Console\Command\GenerateProxiesCommand</span><span class="p">(),</span>
|
|
<span class="k">new</span> <span class="nx">\Doctrine\ODM\MongoDB\Tools\Console\Command\GenerateRepositoriesCommand</span><span class="p">(),</span>
|
|
<span class="k">new</span> <span class="nx">\Doctrine\ODM\MongoDB\Tools\Console\Command\QueryCommand</span><span class="p">(),</span>
|
|
<span class="k">new</span> <span class="nx">\Doctrine\ODM\MongoDB\Tools\Console\Command\ClearCache\MetadataCommand</span><span class="p">(),</span>
|
|
<span class="k">new</span> <span class="nx">\Doctrine\ODM\MongoDB\Tools\Console\Command\Schema\CreateCommand</span><span class="p">(),</span>
|
|
<span class="k">new</span> <span class="nx">\Doctrine\ODM\MongoDB\Tools\Console\Command\Schema\DropCommand</span><span class="p">(),</span>
|
|
<span class="k">new</span> <span class="nx">\Doctrine\ODM\MongoDB\Tools\Console\Command\Schema\UpdateCommand</span><span class="p">(),</span>
|
|
<span class="k">new</span> <span class="nx">\Doctrine\ODM\MongoDB\Tools\Console\Command\Schema\ShardCommand</span><span class="p">(),</span>
|
|
<span class="p">));</span>
|
|
|
|
<span class="nv">$app</span><span class="o">-></span><span class="na">run</span><span class="p">();</span>
|
|
</pre></div>
|
|
</div>
|
|
<p>A reference implementation of the console command may be found in the
|
|
<code class="docutils literal"><span class="pre">tools/sandbox</span></code> directory of the project repository. That command is
|
|
configured to store generated hydrators and proxies in the same directory, and
|
|
relies on the main project's Composer dependencies. You will want to customize
|
|
its configuration files if you intend to use it in your own project.</p>
|
|
</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>This Page</h3>
|
|
<ul class="this-page-menu">
|
|
<li><a href="../_sources/reference/console-commands.rst.txt"
|
|
rel="nofollow">Show Source</a></li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div class="clearer"></div>
|
|
</div>
|
|
<div class="footer">
|
|
© 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> |