Created
September 18, 2014 12:13
-
-
Save webdevilopers/a2ddf5f9d721db5795c4 to your computer and use it in GitHub Desktop.
Single and Multiple Ordering To-Many Associations in Doctrine2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * @ORM\Entity | |
| * @ORM\Table(name="branches") | |
| */ | |
| class Branch | |
| { | |
| /** | |
| * @ORM\OneToMany(targetEntity="Application\Sonata\UserBundle\Entity\User", mappedBy="branch") | |
| * @ORM\OrderBy({"lastName" = "ASC", "firstName" = "ASC"}) | |
| */ | |
| private $users; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * @ORM\Entity | |
| * @ORM\Table(name="branches") | |
| */ | |
| class Branch | |
| { | |
| /** | |
| * @ORM\OneToMany(targetEntity="Application\Sonata\UserBundle\Entity\User", mappedBy="branch") | |
| * @ORM\OrderBy({"lastName" = "ASC"}) | |
| */ | |
| private $users; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment