BlogBundle/Controller/CategoryController.php
public function sortAction(Request $request)
    {
        $em = $this->getDoctrine()->getManager();

        if ($request->isXmlHttpRequest()) {
            $this->get('admin_manager')->sort('BlogBundle:Category', $request->get('values'));

            return new Response(0, 200);
        }

        $categories = $em->getRepository('BlogBundle:Category')->findBy(
            array('parentCategory' => NULL),
            array('order' => 'asc')
        );

        return array(
            'categories' => $categories
        );
    }
public function sortAction(Request $request)
    {
        $em = $this->getDoctrine()->getManager();

        if ($request->isXmlHttpRequest()) {
            $this->get('admin_manager')->sort('BlogBundle:Category', $request->get('values'));

            return new Response(0, 200);
        }

        $categories = $em->getRepository('BlogBundle:Category')->findBy(
            array('parentCategory' => NULL),
            array('order' => 'asc')
        );

        return array(
            'categories' => $categories
        );
    }
Sorts a list of features.

@param Request $request
@param int     $categoryId

@throws NotFoundHttpException
@return array|Response

@Route("/sort")
@Method({"GET", "POST"})
@Template