I require setting the package in a disconnected environment. I have read some special web sites that talks about it, but in previous versions.
I'm using Symfony 2.4.1, recently downloaded. The KnpPaginatorBundle package I downloaded today exactly.
I extracted the master.zip, with this folder inside: "KnpPaginatorBundle-master", from GitHub repository and assumed this structure:
\vendor\Knp\Bundle\PaginatorBundle
ClassNotFoundException: Attempted to load class "KnpPaginatorBundle" from namespace "Knp\Bundle\PaginatorBundle" in C:\EasyPHP-DevServer-14.1VC11\data\localweb\projects\sf_zktime\app\AppKernel.php line 20. Do you need to "use" it from another namespace?
new Knp\Bundle\PaginatorBundle\KnpPaginatorBundle(),//Paginator
C:\EasyPHP-DevServer-14.1VC11\data\localweb\projects\sf_zktime\vendor\Knp\Bundle\PaginatorBundle
knp_paginator:
page_range: 5 # número de páginas que se muestran en el paginador
default_options:
# los siguientes tres parámetros permiten "traducir" el paginador
# puedes utilizar por ejemplo: 'pagina', 'ordenar' y 'direccion'
page_name: page
sort_field_name: sort
sort_direction_name: direction
# sólo incluir resultados diferentes (útil cuando haces consultas GROUP BY)
distinct: true
template:
# estas opciones configuran la plantilla utilizada para la paginación
# y para los controles que premiten reordenar los resultados
pagination: KnpPaginatorBundle:Pagination:sliding.html.twig
sortable: KnpPaginatorBundle:Pagination:sortable_link.html.twig
http://symfony.es/bundles/knplabs/knppaginatorbundle/instalacion-en-symfony-2-1 https://github.com/KnpLabs/KnpPaginatorBundle/
Edit vendor/composer/autoload_namespaces.php
and add this line:
'Knp\\Bundle\\PaginatorBundle' => array($vendorDir . '/knplabs/knp-paginator-bundle'),
EDIT: 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/
.
Then delete cache and reload the web server.
Edit vendor/composer/autoload_namespaces.php
and add this line:
'Knp\\Component' => array($vendorDir . '/knplabs/knp-components/src'),
'Knp\\Bundle\\PaginatorBundle' => array($vendorDir . '/knplabs/knp-paginator-bundle'),
its work for me
regards..
Hendrawan
The solution is:
1) In cmd run: composer require knplabs/knp-paginator-bundle
2) In autoload_namespaces add: 'Knp\Component' => array($vendorDir . '/knplabs/knp-components/src'),
3) In config.yml:
knp_paginator:
page_range: 5 # number of pages displayed in the paginator.
default_options:
# the following three parameters allow "translate" the paginator.
# you can use eg 'page', 'order' and 'direction'
page_name: page
sort_field_name: sort
sort_direction_name: direction
# only include different results (useful when you do GROUP BY
# queries)
distinct: true
template:
# these options configure the template used for pagination.
# and the controls that allow you to sort the results
pagination: KnpPaginatorBundle:Pagination:sliding.html.twig
sortable: KnpPaginatorBundle:Pagination:sortable_link.html.twig
4) In Appkernel.php add: new Knp\Bundle\PaginatorBundle\KnpPaginatorBundle(),
5) In a cmd run: php app/console cache:clear
6) Reload browser.
7) Finally, it works !