src/Kunstmaan/ArticleBundle/Twig/ArticleTwigExtension.php
public function getCategories(Request $request, $className)
    {
        $context = array();

        $categoryRepository = $this->em->getRepository($className);
        $context['categories'] = $categoryRepository->findBy(array(), array('name' => 'ASC'));

        $searchCategory = $request->get('category') ? explode(',', $request->get('category')) : null;
        if ($searchCategory) {
            $context['activeCategory'] = true;
            $context['activeCategories'] = $searchCategory;
        }

        return $context;
    }
public function getCategories(Request $request, $className)
    {
        $context = array();

        $categoryRepository = $this->em->getRepository($className);
        $context['categories'] = $categoryRepository->findBy(array(), array('name' => 'ASC'));

        $searchCategory = $request->get('category') ? explode(',', $request->get('category')) : null;
        if ($searchCategory) {
            $context['activeCategory'] = true;
            $context['activeCategories'] = $searchCategory;
        }

        return $context;
    }
public function getCategories ( Request $ request , $ className ) { $ context = array ( ) ; $ categoryRepository = $ this -> em -> getRepository ( $ className ) ; $ context [ 'categories' ] = $ categoryRepository -> findBy ( array ( ) , array ( 'name' => 'ASC' ) ) ; $ searchCategory = $ request -> get ( 'category' ) ? explode ( ',' , $ request -> get ( 'category' ) ) : null ; if ( $ searchCategory ) { $ context [ 'activeCategory' ] = true ; $ context [ 'activeCategories' ] = $ searchCategory ; } return $ context ; }
Get categories array for view.

@param Request $request
@param string  $className

@return array
Get categories array for view .