Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #641 from bksunday/patch-1

Added yml example in ordered-associations.rst
  • Loading branch information...
commit edca8c88ea741a6ebec86dd6402bd906932fb3e7 2 parents 9b0f252 + 1278b79
@Ocramius Ocramius authored
Showing with 45 additions and 26 deletions.
  1. +45 −26 docs/en/tutorials/ordered-associations.rst
View
71 docs/en/tutorials/ordered-associations.rst
@@ -12,32 +12,51 @@ collection.
Additional to any ``@OneToMany`` or ``@ManyToMany`` annotation you
can specify the ``@OrderBy`` in the following way:
-.. code-block:: php
-
- <?php
- /** @Entity **/
- class User
- {
- // ...
-
- /**
- * @ManyToMany(targetEntity="Group")
- * @OrderBy({"name" = "ASC"})
- **/
- private $groups;
- }
-
-.. code-block:: xml
-
- <doctrine-mapping>
- <entity name="User">
- <many-to-many field="groups" target-entity="Group">
- <order-by>
- <order-by-field name="name" direction="ASC" />
- </order-by>
- </many-to-many>
- </entity>
- </doctrine-mapping>
+.. configuration-block::
+
+ .. code-block:: php
+
+ <?php
+ /** @Entity **/
+ class User
+ {
+ // ...
+
+ /**
+ * @ManyToMany(targetEntity="Group")
+ * @OrderBy({"name" = "ASC"})
+ **/
+ private $groups;
+ }
+
+ .. code-block:: xml
+
+ <doctrine-mapping>
+ <entity name="User">
+ <many-to-many field="groups" target-entity="Group">
+ <order-by>
+ <order-by-field name="name" direction="ASC" />
+ </order-by>
+ </many-to-many>
+ </entity>
+ </doctrine-mapping>
+
+ .. code-block:: yaml
+
+ User:
+ type: entity
+ manyToMany:
+ groups:
+ orderBy: { 'name': 'ASC' }
+ targetEntity: Group
+ joinTable:
+ name: users_groups
+ joinColumns:
+ user_id:
+ referencedColumnName: id
+ inverseJoinColumns:
+ group_id:
+ referencedColumnName: id
The DQL Snippet in OrderBy is only allowed to consist of
unqualified, unquoted field names and of an optional ASC/DESC
Please sign in to comment.
Something went wrong with that request. Please try again.