This commit is contained in:
parent
83989916a3
commit
25b73e7da5
2 changed files with 15 additions and 5 deletions
|
@ -11,6 +11,8 @@ use Doctrine\ORM\Mapping as ORM;
|
|||
use Symfony\Bridge\Doctrine\Types\UlidType;
|
||||
use Symfony\Component\Uid\Ulid;
|
||||
|
||||
use function iterator_to_array;
|
||||
|
||||
#[ORM\Entity(repositoryClass: FoodOrderRepository::class)]
|
||||
class FoodOrder
|
||||
{
|
||||
|
@ -104,9 +106,10 @@ class FoodOrder
|
|||
*/
|
||||
public function getOrderItemsSortedByName(): Collection
|
||||
{
|
||||
$iterator = $this->getOrderItems()->getIterator();
|
||||
$iterator = $this->getOrderItems()
|
||||
->getIterator();
|
||||
$iterator->uasort(
|
||||
fn (OrderItem $a, OrderItem $b): int => $a->getName() <=> $b->getName()
|
||||
static fn(OrderItem $a, OrderItem $b): int => $a->getName() <=> $b->getName()
|
||||
);
|
||||
return new ArrayCollection(
|
||||
iterator_to_array(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue