Last active
December 14, 2015 05:49
Revisions
-
dbeuchler revised this gist
Feb 26, 2013 . 1 changed file with 7 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,12 @@ /** * This method helps you to sort your entity request in an Symfony2 entity! * * Please, share your tips commenting here: * https://gist.github.com/5038457 * * Author: @dbeuchler * * (Tested and used with doctrine 2.x and Symfony 2.0.x, 2.1.x) */ public function getProductsSortedByPositionInGroup() -
dbeuchler created this gist
Feb 26, 2013 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ /** * This method helps you to sort your entity request in an Symfony2 entity! */ public function getProductsSortedByPositionInGroup() { $arr = $this->product->toArray(); usort($arr, function($a, $b) { if ($a->getPositionInGroup() > $b->getPositionInGroup()) { return 1; } }); return $arr; }