1
0
mirror of synced 2025-01-18 22:41:43 +03:00

Merge pull request #641 from bksunday/patch-1

Added yml example in ordered-associations.rst
This commit is contained in:
Marco Pivetta 2013-04-03 09:36:19 -07:00
commit edca8c88ea

View File

@ -12,7 +12,9 @@ collection.
Additional to any ``@OneToMany`` or ``@ManyToMany`` annotation you Additional to any ``@OneToMany`` or ``@ManyToMany`` annotation you
can specify the ``@OrderBy`` in the following way: can specify the ``@OrderBy`` in the following way:
.. code-block:: php .. configuration-block::
.. code-block:: php
<?php <?php
/** @Entity **/ /** @Entity **/
@ -27,7 +29,7 @@ can specify the ``@OrderBy`` in the following way:
private $groups; private $groups;
} }
.. code-block:: xml .. code-block:: xml
<doctrine-mapping> <doctrine-mapping>
<entity name="User"> <entity name="User">
@ -39,6 +41,23 @@ can specify the ``@OrderBy`` in the following way:
</entity> </entity>
</doctrine-mapping> </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 The DQL Snippet in OrderBy is only allowed to consist of
unqualified, unquoted field names and of an optional ASC/DESC unqualified, unquoted field names and of an optional ASC/DESC
positional statement. Multiple Fields are separated by a comma (,). positional statement. Multiple Fields are separated by a comma (,).