public function popularTags(Request $request, $taxonomytype)
    {
        $table = $this->getOption('general/database/prefix');
        $table .= 'taxonomy';

        $query = $this->createQueryBuilder()
            ->select('name, COUNT(slug) AS count')
            ->from($table)
            ->where('taxonomytype = :taxonomytype')
            ->groupBy('name')
            ->orderBy('count', 'DESC')
            ->setMaxResults($request->query->getInt('limit', 20))
            ->setParameters([
                ':taxonomytype' => $taxonomytype,
            ]);

        $results = $query->execute()->fetchAll();

        usort(
            $results,
            function ($a, $b) {
                if ($a['name'] == $b['name']) {
                    return 0;
                }

                return ($a['name'] < $b['name']) ? -1 : 1;
            }
        );

        return $this->json($results);
    }
public function popularTags(Request $request, $taxonomytype)
    {
        $table = $this->getOption('general/database/prefix');
        $table .= 'taxonomy';

        $query = $this->createQueryBuilder()
            ->select('name, COUNT(slug) AS count')
            ->from($table)
            ->where('taxonomytype = :taxonomytype')
            ->groupBy('name')
            ->orderBy('count', 'DESC')
            ->setMaxResults($request->query->getInt('limit', 20))
            ->setParameters([
                ':taxonomytype' => $taxonomytype,
            ]);

        $results = $query->execute()->fetchAll();

        usort(
            $results,
            function ($a, $b) {
                if ($a['name'] == $b['name']) {
                    return 0;
                }

                return ($a['name'] < $b['name']) ? -1 : 1;
            }
        );

        return $this->json($results);
    }
public function popularTags ( Request $ request , $ taxonomytype ) { $ table = $ this -> getOption ( 'general/database/prefix' ) ; $ table .= 'taxonomy' ; $ query = $ this -> createQueryBuilder ( ) -> select ( 'name, COUNT(slug) AS count' ) -> from ( $ table ) -> where ( 'taxonomytype = :taxonomytype' ) -> groupBy ( 'name' ) -> orderBy ( 'count' , 'DESC' ) -> setMaxResults ( $ request -> query -> getInt ( 'limit' , 20 ) ) -> setParameters ( [ ':taxonomytype' => $ taxonomytype , ] ) ; $ results = $ query -> execute ( ) -> fetchAll ( ) ; usort ( $ results , function ( $ a , $ b ) { if ( $ a [ 'name' ] == $ b [ 'name' ] ) { return 0 ; } return ( $ a [ 'name' ] < $ b [ 'name' ] ) ? - 1 : 1 ; } ) ; return $ this -> json ( $ results ) ; }
Fetch a JSON encoded set of the most popular taxonomy specific tags.

@param Request $request
@param string  $taxonomytype

@return \Symfony\Component\HttpFoundation\JsonResponse
Fetch a JSON encoded set of the most popular taxonomy specific tags .