简体   繁体   中英

Symfony 2.4 : Knp paginator Bundle Installation issue

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(),

将您的插件文件夹移动到vendor/knplabs/knp-paginator-bundle/ ,因此现在的真实路径为: vendor/knplabs/knp-paginator-bundle/Knp/Bundle/PaginatorBundle/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM