Comments (6)
What's the state of this? Ideas? Ping @stof
from whiteoctoberpagerfantabundle.
I have been looking at this for 2 hours and cannot figure out why this wont work
This is in my controller
$pager = new Pagerfanta(new DoctrineORMAdapter($query));
try {
$pager
->setMaxPerPage($max)
->setCurrentpage($page);
} catch (OutOfRangeCurrentPageException $e) {
throw $this->createNotFoundException($e->getMessage());
}
return $this->render($template, array('pager' => $pager));
This is in my template
{{ pagerfanta(pager, 'twitter_bootstrap_translated') }}
This is my response:
ContextErrorException: Warning: array_merge(): Argument #2 is not an array in site/vendor/white-october/pagerfanta-bundle/WhiteOctober/PagerfantaBundle/Twig/PagerfantaExtension.php line 119
Running, i Think , Symfony 2.3
from whiteoctoberpagerfantabundle.
I think i solved my issue, may not apply to everyone. I had a default parameter of page 1 in my route, removing that cleared this up for me
from whiteoctoberpagerfantabundle.
Facing same issue with Symfony 2.3.
I guess $request->attributes->get('_route_params')
should be checked with is_array()
or against null values before merging arrays.
from whiteoctoberpagerfantabundle.
This always happens if we forward to action that later uses pagerfanta, as subrequest has no information about route: symfony/symfony#5804
update:
Added pull request.
update2:
in controller:
$ret = array_merge($request->attributes->all(),
array(
// my normal forwarding params
));
return $this->forward('controller:action', $ret);
from whiteoctoberpagerfantabundle.
I ran into this problem again, rendering an embedded controller with pagerfanta in the template, As a temp solution I get the master request current route and pass it to pager fanta:
In Controller:
$request = $this->container->get('request_stack')->getParentRequest();
$route = $request->get('_route');
In View:
{{ pagerfanta(pager, 'twitter_bootstrap3', {'routeName' : route }) }}
Working great at the moment, but id like to not have to. But i cant think of a more elegant way to do this
from whiteoctoberpagerfantabundle.
Related Issues (20)
- PHP 5.3 builds are failing (and are running with outdated distro config) HOT 1
- Error with MySQL5.7 HOT 2
- Remove tests from autoloading HOT 10
- Pagination inside an embedded Controller HOT 4
- Call from PHP templates? HOT 2
- Incorrect translate "previous" HOT 4
- Pagerfanta 2.x is now PHP 7, upgrade this project to match
- Not working with Symfony 4.1 beta 2 HOT 2
- Not added to bundles.php in Symfony 4 - getting Unknown “pagerfanta” function HOT 1
- Create a recipe so that the bundle can be automatically set up by Symfony Flex HOT 4
- Unknown "pagerfanta" function. in symfony 4.1 HOT 3
- How to paginate list with form elements? HOT 1
- Pagerfanta ArrayAdapter ; add text in view HOT 4
- Romanian translation does not work
- Looking for maintainers HOT 7
- Allowed memory size
- Less results than expected on each page
- Archive repo HOT 8
- Symfony 5 support HOT 1
- Supply a view which would actually use Twig for rendering HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from whiteoctoberpagerfantabundle.