Skip to content

Commit

Permalink
add order number to category frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
rserry committed Oct 11, 2023
1 parent 0c7724e commit d6158d2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -233,13 +233,6 @@ private function buildMenu()
$menu[$activeItem]['active'] = true;
}

$sort = array();
foreach ($menu as $key => $value) {
$sort[$key] = $value['title'] ?? $value['name'];
}

array_multisort($sort, $menu);

return $menu;
}

Expand Down
3 changes: 2 additions & 1 deletion module/PageBundle/Controller/Admin/CategoryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ public function manageAction()
$this->getParam('page'),
array(
'active' => true,
)
),
array('orderNumber' => 'ASC')
);

return new ViewModel(
Expand Down
3 changes: 2 additions & 1 deletion module/PageBundle/Repository/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@ public function findAllQuery()
->where(
$query->expr()->eq('c.active', 'true')
)
->orderBy('c.orderNumber', 'ASC')
->getQuery();
}

public function findByParent($parent)
{
return $this->getEntityManager()
->getRepository('PageBundle\Entity\Category')
->findBy(array('parent' => $parent, 'active' => true));
->findBy(array('parent' => $parent, 'active' => true), array('orderNumber' => 'ASC'));
}
}

0 comments on commit d6158d2

Please sign in to comment.