This file is indexed.

/usr/share/doc/php-doctrine-orm/html/tutorials/extra-lazy-associations.html is in doctrine-orm-doc 2.4.6-1+deb8u1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
<!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>Extra Lazy Associations &mdash; Doctrine 2 ORM 2 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:     '2',
        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="top" title="Doctrine 2 ORM 2 documentation" href="../index.html" />
    <link rel="next" title="Composite and Foreign Keys as Primary Key" href="composite-primary-keys.html" />
    <link rel="prev" title="Working with Indexed Associations" href="working-with-indexed-associations.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="/">home</a></li>
            <li><a class="" target="_top" href="http://www.doctrine-project.org/about">about</a></li>
            <li><a class="" target="_top" href="http://www.doctrine-project.org/projects.html">projects</a></li>
            <li><a class="" target="_top" href="http://www.doctrine-project.org/projects/orm">orm</a></li>
            <li><a class="" target="_top" href="http://www.doctrine-project.org/projects/dbal">dbal</a></li>
            <li><a class="" target="_top" href="http://www.doctrine-project.org/blog">blog</a></li>
            <li><a class="" target="_top" href="http://www.doctrine-project.org/jira">development</a></li>
            <li><a class="" target="_top" href="http://www.doctrine-project.org/contribute">contribute</a></li>
            <li><a class="" target="_top" href="http://www.doctrine-project.org/community">community</a></li>
          </ul>
        </div>
      </div>
      <div id="content" class="cls">
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="composite-primary-keys.html" title="Composite and Foreign Keys as Primary Key"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="working-with-indexed-associations.html" title="Working with Indexed Associations"
             accesskey="P">previous</a> |</li>
        <li><a href="/">Doctrine Homepage</a> &raquo;</li>
        <li><a href="../index.html">Doctrine 2 ORM 2 documentation</a> &raquo;</li> 
      </ul>
    </div>  

        <div class="document">
            <div class="documentwrapper">
                <div class="bodywrapper">

              <div class="body" >
                
  <div class="section" id="extra-lazy-associations">
<h1>Extra Lazy Associations<a class="headerlink" href="#extra-lazy-associations" title="Permalink to this headline"></a></h1>
<div class="versionadded">
<p><span class="versionmodified">New in version 2.1.</span></p>
</div>
<p>In many cases associations between entities can get pretty large. Even in a simple scenario like a blog.
where posts can be commented, you always have to assume that a post draws hundreds of comments.
In Doctrine 2.0 if you accessed an association it would always get loaded completely into memory. This
can lead to pretty serious performance problems, if your associations contain several hundreds or thousands
of entities.</p>
<p>With Doctrine 2.1 a feature called <strong>Extra Lazy</strong> is introduced for associations. Associations
are marked as <strong>Lazy</strong> by default, which means the whole collection object for an association is populated
the first time its accessed. If you mark an association as extra lazy the following methods on collections
can be called without triggering a full load of the collection:</p>
<ul class="simple">
<li><tt class="docutils literal"><span class="pre">Collection#contains($entity)</span></tt></li>
<li><tt class="docutils literal"><span class="pre">Collection#count()</span></tt></li>
<li><tt class="docutils literal"><span class="pre">Collection#slice($offset,</span> <span class="pre">$length</span> <span class="pre">=</span> <span class="pre">null)</span></tt></li>
</ul>
<p>For each of this three methods the following semantics apply:</p>
<ul class="simple">
<li>For each call, if the Collection is not yet loaded, issue a straight SELECT statement against the database.</li>
<li>For each call, if the collection is already loaded, fallback to the default functionality for lazy collections. No additional SELECT statements are executed.</li>
</ul>
<p>Additionally even with Doctrine 2.0 the following methods do not trigger the collection load:</p>
<ul class="simple">
<li><tt class="docutils literal"><span class="pre">Collection#add($entity)</span></tt></li>
<li><tt class="docutils literal"><span class="pre">Collection#offsetSet($key,</span> <span class="pre">$entity)</span></tt> - ArrayAccess with no specific key <tt class="docutils literal"><span class="pre">$coll[]</span> <span class="pre">=</span> <span class="pre">$entity</span></tt>, it does
not work when setting specific keys like <tt class="docutils literal"><span class="pre">$coll[0]</span> <span class="pre">=</span> <span class="pre">$entity</span></tt>.</li>
</ul>
<p>With extra lazy collections you can now not only add entities to large collections but also paginate them
easily using a combination of <tt class="docutils literal"><span class="pre">count</span></tt> and <tt class="docutils literal"><span class="pre">slice</span></tt>.</p>
<div class="section" id="enabling-extra-lazy-associations">
<h2>Enabling Extra-Lazy Associations<a class="headerlink" href="#enabling-extra-lazy-associations" title="Permalink to this headline"></a></h2>
<p>The mapping configuration is simple. Instead of using the default value of <tt class="docutils literal"><span class="pre">fetch=&quot;LAZY&quot;</span></tt> you have to
switch to extra lazy as shown in these examples:</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">namespace</span> <span class="nx">Doctrine\Tests\Models\CMS</span><span class="p">;</span>

<span class="sd">/**</span>
<span class="sd"> * @Entity</span>
<span class="sd"> */</span>
<span class="k">class</span> <span class="nc">CmsGroup</span>
<span class="p">{</span>
    <span class="sd">/**</span>
<span class="sd">     * @ManyToMany(targetEntity=&quot;CmsUser&quot;, mappedBy=&quot;groups&quot;, fetch=&quot;EXTRA_LAZY&quot;)</span>
<span class="sd">     */</span>
    <span class="k">public</span> <span class="nv">$users</span><span class="p">;</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-mapping</span> <span class="na">xmlns=</span><span class="s">&quot;http://doctrine-project.org/schemas/orm/doctrine-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/orm/doctrine-mapping</span>
<span class="s">                          http://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd&quot;</span><span class="nt">&gt;</span>

    <span class="nt">&lt;entity</span> <span class="na">name=</span><span class="s">&quot;Doctrine\Tests\Models\CMS\CmsGroup&quot;</span><span class="nt">&gt;</span>
        <span class="c">&lt;!-- ... --&gt;</span>
        <span class="nt">&lt;many-to-many</span> <span class="na">field=</span><span class="s">&quot;users&quot;</span> <span class="na">target-entity=</span><span class="s">&quot;CmsUser&quot;</span> <span class="na">mapped-by=</span><span class="s">&quot;groups&quot;</span> <span class="na">fetch=</span><span class="s">&quot;EXTRA_LAZY&quot;</span> <span class="nt">/&gt;</span>
    <span class="nt">&lt;/entity&gt;</span>
<span class="nt">&lt;/doctrine-mapping&gt;</span>
</pre></div>
</div>
</li>
<li><em>YAML</em><div class="highlight-yaml"><div class="highlight"><pre><span class="l-Scalar-Plain">Doctrine\Tests\Models\CMS\CmsGroup</span><span class="p-Indicator">:</span>
  <span class="l-Scalar-Plain">type</span><span class="p-Indicator">:</span> <span class="l-Scalar-Plain">entity</span>
  <span class="c1"># ...</span>
  <span class="l-Scalar-Plain">manyToMany</span><span class="p-Indicator">:</span>
    <span class="l-Scalar-Plain">users</span><span class="p-Indicator">:</span>
      <span class="l-Scalar-Plain">targetEntity</span><span class="p-Indicator">:</span> <span class="l-Scalar-Plain">CmsUser</span>
      <span class="l-Scalar-Plain">mappedBy</span><span class="p-Indicator">:</span> <span class="l-Scalar-Plain">groups</span>
      <span class="l-Scalar-Plain">fetch</span><span class="p-Indicator">:</span> <span class="l-Scalar-Plain">EXTRA_LAZY</span>
</pre></div>
</div>
</li>
</ul>
</div>
</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="#">Extra Lazy Associations</a><ul>
<li><a class="reference internal" href="#enabling-extra-lazy-associations">Enabling Extra-Lazy Associations</a></li>
</ul>
</li>
</ul>

            <h4>Previous topic</h4>
            <p class="topless"><a href="working-with-indexed-associations.html"
                                  title="previous chapter">Working with Indexed Associations</a></p>
            <h4>Next topic</h4>
            <p class="topless"><a href="composite-primary-keys.html"
                                  title="next chapter">Composite and Foreign Keys as Primary Key</a></p>
            <h3>This Page</h3>
            <ul class="this-page-menu">
              <li><a href="../_sources/tutorials/extra-lazy-associations.txt"
                     rel="nofollow">Show Source</a></li>
            </ul>
        </div>
      </div>
          <div class="clearer"></div>
        </div>
          <div class="footer">
              &copy; Copyright 2010-12, Doctrine Project Team.
              Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.2.3.
            <br/>
            <a target="_BLANK" href="http://www.servergrove.com"><img src="../_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="Submit" value="Donate via PayPal" />
            </form>
          </div>
      </div>

      <div id="bot-rcnr">
        <div class="tl"><!-- corner --></div>
      </div>
    </div>

  <a class="githublink" href="http://github.com/doctrine">Fork me on GitHub</a>
  </body>
</html>