Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge pull request #641 from bksunday/patch-1

Added yml example in ordered-associations.rst
  • Loading branch information...
commit edca8c88ea741a6ebec86dd6402bd906932fb3e7 2 parents 9b0f252 + 1278b79
Marco Pivetta authored April 03, 2013

Showing 1 changed file with 45 additions and 26 deletions. Show diff stats Hide diff stats

  1. 71  docs/en/tutorials/ordered-associations.rst
71  docs/en/tutorials/ordered-associations.rst
Source Rendered
@@ -12,32 +12,51 @@ collection.
12 12
 Additional to any ``@OneToMany`` or ``@ManyToMany`` annotation you
13 13
 can specify the ``@OrderBy`` in the following way:
14 14
 
15  
-.. code-block:: php
16  
-
17  
-    <?php
18  
-    /** @Entity **/
19  
-    class User
20  
-    {
21  
-        // ...
22  
-    
23  
-        /**
24  
-         * @ManyToMany(targetEntity="Group")
25  
-         * @OrderBy({"name" = "ASC"})
26  
-         **/
27  
-        private $groups;
28  
-    }
29  
-
30  
-.. code-block:: xml
31  
-
32  
-    <doctrine-mapping>
33  
-        <entity name="User">
34  
-            <many-to-many field="groups" target-entity="Group">
35  
-                <order-by>
36  
-                    <order-by-field name="name" direction="ASC" />
37  
-                </order-by>
38  
-            </many-to-many>
39  
-        </entity>
40  
-    </doctrine-mapping>
  15
+.. configuration-block::
  16
+
  17
+    .. code-block:: php
  18
+
  19
+        <?php
  20
+        /** @Entity **/
  21
+        class User
  22
+        {
  23
+            // ...
  24
+        
  25
+            /**
  26
+             * @ManyToMany(targetEntity="Group")
  27
+             * @OrderBy({"name" = "ASC"})
  28
+             **/
  29
+            private $groups;
  30
+        }
  31
+
  32
+    .. code-block:: xml
  33
+
  34
+        <doctrine-mapping>
  35
+            <entity name="User">
  36
+                <many-to-many field="groups" target-entity="Group">
  37
+                    <order-by>
  38
+                        <order-by-field name="name" direction="ASC" />
  39
+                    </order-by>
  40
+                </many-to-many>
  41
+            </entity>
  42
+        </doctrine-mapping>
  43
+
  44
+    .. code-block:: yaml
  45
+
  46
+        User:
  47
+          type: entity
  48
+          manyToMany:
  49
+            groups:
  50
+              orderBy: { 'name': 'ASC' }
  51
+              targetEntity: Group
  52
+              joinTable:
  53
+                name: users_groups
  54
+                joinColumns:
  55
+                  user_id:
  56
+                    referencedColumnName: id
  57
+                inverseJoinColumns:
  58
+                  group_id:
  59
+                    referencedColumnName: id
41 60
 
42 61
 The DQL Snippet in OrderBy is only allowed to consist of
43 62
 unqualified, unquoted field names and of an optional ASC/DESC

0 notes on commit edca8c8

Please sign in to comment.
Something went wrong with that request. Please try again.