Commits

aura committed aab57c3 Merge

merge eager conditions text from BigImp

Comments (0)

Files changed (1)

source/manual/related/eager.xml

         author, summary, comments, and tags.)
     </para>
     
+    <sect2 xml:id="related.eager.conditions">
+
+        <title>Setting Conditions for Eager Fetches</title>
+
+        <para>
+            At times you may want to have additional conditions on the related
+            model to narrow down your query. For example, let's say you want
+            fetch all tags that belong to a certain blog. You can achieve this
+            by setting the eager-fetch more explicitly:
+        </para>
+
+        <programlisting language="php"><![CDATA[
+<?php
+/**
+ * @var Solar_Sql_Model_Catalog $model
+ */
+
+$list = $model->tags>fetchAll(array(
+    'page'   => 1,
+    'paging' => 10,
+    'eager'  => array(
+        'blogs' => array(
+            'join_type' => 'inner',
+            'conditions' => array(
+                'blog_id = 1',   // refers to taggings.blog_id in this case
+                //'condition2',
+                //...
+            )
+        )
+    )
+));
+]]></programlisting>
+
+    </sect2>
+
 </sect1>