Question

I got this error while I configured Knp paginator Bundle with Symfony 2.4

ERROR : ClassNotFoundException: Attempted to load class "KnpPaginatorBundle" from namespace "Knp\Bundle\PaginatorBundle" in D:\Projects\wamp\www\Stutorial\app\AppKernel.php line 29. Do you need to "use" it from another namespace?

I followed this steps to install Knp paginator Bundle.

# Install Knp components
git clone git://github.com/KnpLabs/knp-components.git vendor/knp-components

# Install knp paginator bundle
git clone git://github.com/KnpLabs/KnpPaginatorBundle.git vendor/bundles/Knp/Bundle/PaginatorBundle

My config.yml file:

knp_paginator:
    page_range: 5                      # default page range used in pagination control
    default_options:
        page_name: page                # page query parameter name
        sort_field_name: sort          # sort field query parameter name
        sort_direction_name: direction # sort direction query parameter name
        distinct: true                 # ensure distinct results, useful when ORM queries are using GROUP BY statements
    template:
        pagination: KnpPaginatorBundle:Pagination:sliding.html.twig     # sliding pagination controls template
        sortable: KnpPaginatorBundle:Pagination:sortable_link.html.twig # sort link template

I added two lines in my autoload_namespaces.php

'Knp\\Component'      => array($vendorDir.'/knp-components/src'),
'Knp\\Bundle'         => array($vendorDir.'/bundles'),

And this line to AppKernel.php file

new Knp\Bundle\PaginatorBundle\KnpPaginatorBundle(),

No correct solution

OTHER TIPS

Move your plugin folder to vendor/knplabs/knp-paginator-bundle/, so now the real path would be: vendor/knplabs/knp-paginator-bundle/Knp/Bundle/PaginatorBundle/.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top