Pagerfanta white-october processus de pagination
Bonjour, je m'intéresse de prés au processus de pagination de page en utilisant le bundle White-october:
Mais en suivant je n'arrive pas à trouver ou ce remplit le tableau $this->views de la class ViewFactory :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
| <?php
/*
* This file is part of the Pagerfanta package.
*
* (c) Pablo Díez <pablodip@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Pagerfanta\View;
use Pagerfanta\PagerfantaInterface;
use Pagerfanta\Exception\InvalidArgumentException;
/**
* ViewFactory.
*
* @author Pablo Díez <pablodip@gmail.com>
*/
class ViewFactory implements ViewFactoryInterface
{
private $views;
/**
* Constructor.
*/
public function __construct()
{
$this->views = array();
}
/**
* {@inheritdoc}
*/
public function set($name, ViewInterface $view)
{
$this->views[$name] = $view;
}
/**
* {@inheritdoc}
*/
public function has($name)
{
return isset($this->views[$name]);
}
/**
* {@inheritdoc}
*/
public function add(array $views)
{
foreach ($views as $name => $view) {
$this->set($name, $view);
}
}
/**
* {@inheritdoc}
*/
public function get($name)
{
if (!$this->has($name)) {
throw new InvalidArgumentException(sprintf('The view "%s" does not exist.', $name));
}
return $this->views[$name];
}
/**
* {@inheritdoc}
*/
public function remove($name)
{
if (!$this->has($name)) {
throw new InvalidArgumentException(sprintf('The view "%s" does not exist.', $name));
}
unset($this->views[$name]);
}
/**
* {@inheritdoc}
*/
public function all()
{
return $this->views;
}
/**
* {@inheritdoc}
*/
public function clear()
{
$this->views = array();
}
} |
car pour afficher ma pagination j'utilise la methode:
Code:
1 2 3 4 5 6 7 8 9 10
| public function renderPagerfanta(PagerfantaInterface $pagerfanta, $viewName = null, array $options = array())
{
if (null === $viewName) {
$viewName = $this->container->getParameter('white_october_pagerfanta.default_view');
}
$routeGenerator = $this->createRouteGenerator($options);
return $this->container->get('white_october_pagerfanta.view_factory')->get($viewName)->render($pagerfanta, $routeGenerator, $options);
} |
le service "$this->container->get('white_october_pagerfanta.view_factory')" me renvoie la class ViewFactory beaucoup plus haut puis la methode get de la class ViewFactory me renvoi un objet "object(Pagerfanta\View\TwitterBootstrapView)"à la clé "twitter_bootstrap" dans le tableau $this->views[$name]
Voir ci dessous:
Code:
1 2 3 4 5 6 7 8
| public function get($name)
{
if (!$this->has($name)) {
throw new InvalidArgumentException(sprintf('The view "%s" does not exist.', $name));
}
var_dump($this->views[$name]);exit;
return $this->views[$name];
} |
resultat du var_dump($this->views[$name]) $name ayant pour valeur la clé "twitter_bootstrap"
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
object(Pagerfanta\View\TwitterBootstrapView)[655]
private 'template' (Pagerfanta\View\DefaultView) =>
object(Pagerfanta\View\Template\TwitterBootstrapTemplate)[656]
private 'routeGenerator' (Pagerfanta\View\Template\Template) => null
private 'options' (Pagerfanta\View\Template\Template) =>
array (size=12)
'prev_message' => string '← Previous' (length=15)
'prev_disabled_href' => string '#' (length=1)
'next_message' => string 'Next →' (length=11)
'next_disabled_href' => string '#' (length=1)
'dots_message' => string '…' (length=8)
'dots_href' => string '#' (length=1)
'css_container_class' => string 'pagination' (length=10)
'css_prev_class' => string 'prev' (length=4)
'css_next_class' => string 'next' (length=4)
'css_disabled_class' => string 'disabled' (length=8)
'css_dots_class' => string 'disabled' (length=8)
'css_active_class' => string 'active' (length=6)
private 'pagerfanta' (Pagerfanta\View\DefaultView) => null
private 'proximity' (Pagerfanta\View\DefaultView) => null
private 'currentPage' (Pagerfanta\View\DefaultView) => null
private 'nbPages' (Pagerfanta\View\DefaultView) => null
private 'startPage' (Pagerfanta\View\DefaultView) => null
private 'endPage' (Pagerfanta\View\DefaultView) => null |
affichage du tableau var_dump($this->views):
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163
| array (size=6)
'default' =>
object(Pagerfanta\View\DefaultView)[634]
private 'template' =>
object(Pagerfanta\View\Template\DefaultTemplate)[654]
private 'routeGenerator' (Pagerfanta\View\Template\Template) => null
private 'options' (Pagerfanta\View\Template\Template) =>
array (size=9)
...
private 'pagerfanta' => null
private 'proximity' => null
private 'currentPage' => null
private 'nbPages' => null
private 'startPage' => null
private 'endPage' => null
'default_translated' =>
object(WhiteOctober\PagerfantaBundle\View\DefaultTranslatedView)[660]
private 'view' (WhiteOctober\PagerfantaBundle\View\TranslatedView) =>
object(Pagerfanta\View\DefaultView)[634]
private 'template' =>
object(Pagerfanta\View\Template\DefaultTemplate)[654]
...
private 'pagerfanta' => null
private 'proximity' => null
private 'currentPage' => null
private 'nbPages' => null
private 'startPage' => null
private 'endPage' => null
private 'translator' (WhiteOctober\PagerfantaBundle\View\TranslatedView) =>
object(Symfony\Bundle\FrameworkBundle\Translation\Translator)[75]
protected 'container' =>
object(appDevDebugProjectContainer)[307]
...
protected 'options' =>
array (size=2)
...
protected 'loaderIds' =>
array (size=10)
...
protected 'catalogues' =>
array (size=0)
...
protected 'locale' => null
private 'fallbackLocales' (Symfony\Component\Translation\Translator) =>
array (size=1)
...
private 'loaders' (Symfony\Component\Translation\Translator) =>
array (size=0)
...
private 'resources' (Symfony\Component\Translation\Translator) =>
array (size=49)
...
private 'selector' (Symfony\Component\Translation\Translator) =>
object(Symfony\Component\Translation\MessageSelector)[74]
...
'twitter_bootstrap' =>
object(Pagerfanta\View\TwitterBootstrapView)[655]
private 'template' (Pagerfanta\View\DefaultView) =>
object(Pagerfanta\View\Template\TwitterBootstrapTemplate)[656]
private 'routeGenerator' (Pagerfanta\View\Template\Template) => null
private 'options' (Pagerfanta\View\Template\Template) =>
array (size=12)
...
private 'pagerfanta' (Pagerfanta\View\DefaultView) => null
private 'proximity' (Pagerfanta\View\DefaultView) => null
private 'currentPage' (Pagerfanta\View\DefaultView) => null
private 'nbPages' (Pagerfanta\View\DefaultView) => null
private 'startPage' (Pagerfanta\View\DefaultView) => null
private 'endPage' (Pagerfanta\View\DefaultView) => null
'twitter_bootstrap3' =>
object(Pagerfanta\View\TwitterBootstrap3View)[657]
private 'template' (Pagerfanta\View\DefaultView) =>
object(Pagerfanta\View\Template\TwitterBootstrap3Template)[658]
private 'routeGenerator' (Pagerfanta\View\Template\Template) => null
private 'options' (Pagerfanta\View\Template\Template) =>
array (size=12)
...
private 'pagerfanta' (Pagerfanta\View\DefaultView) => null
private 'proximity' (Pagerfanta\View\DefaultView) => null
private 'currentPage' (Pagerfanta\View\DefaultView) => null
private 'nbPages' (Pagerfanta\View\DefaultView) => null
private 'startPage' (Pagerfanta\View\DefaultView) => null
private 'endPage' (Pagerfanta\View\DefaultView) => null
'twitter_bootstrap3_translated' =>
object(WhiteOctober\PagerfantaBundle\View\TwitterBootstrap3TranslatedView)[661]
private 'view' (WhiteOctober\PagerfantaBundle\View\TranslatedView) =>
object(Pagerfanta\View\TwitterBootstrap3View)[657]
private 'template' (Pagerfanta\View\DefaultView) =>
object(Pagerfanta\View\Template\TwitterBootstrap3Template)[658]
...
private 'pagerfanta' (Pagerfanta\View\DefaultView) => null
private 'proximity' (Pagerfanta\View\DefaultView) => null
private 'currentPage' (Pagerfanta\View\DefaultView) => null
private 'nbPages' (Pagerfanta\View\DefaultView) => null
private 'startPage' (Pagerfanta\View\DefaultView) => null
private 'endPage' (Pagerfanta\View\DefaultView) => null
private 'translator' (WhiteOctober\PagerfantaBundle\View\TranslatedView) =>
object(Symfony\Bundle\FrameworkBundle\Translation\Translator)[75]
protected 'container' =>
object(appDevDebugProjectContainer)[307]
...
protected 'options' =>
array (size=2)
...
protected 'loaderIds' =>
array (size=10)
...
protected 'catalogues' =>
array (size=0)
...
protected 'locale' => null
private 'fallbackLocales' (Symfony\Component\Translation\Translator) =>
array (size=1)
...
private 'loaders' (Symfony\Component\Translation\Translator) =>
array (size=0)
...
private 'resources' (Symfony\Component\Translation\Translator) =>
array (size=49)
...
private 'selector' (Symfony\Component\Translation\Translator) =>
object(Symfony\Component\Translation\MessageSelector)[74]
...
'twitter_bootstrap_translated' =>
object(WhiteOctober\PagerfantaBundle\View\TwitterBootstrapTranslatedView)[662]
private 'view' (WhiteOctober\PagerfantaBundle\View\TranslatedView) =>
object(Pagerfanta\View\TwitterBootstrapView)[655]
private 'template' (Pagerfanta\View\DefaultView) =>
object(Pagerfanta\View\Template\TwitterBootstrapTemplate)[656]
...
private 'pagerfanta' (Pagerfanta\View\DefaultView) => null
private 'proximity' (Pagerfanta\View\DefaultView) => null
private 'currentPage' (Pagerfanta\View\DefaultView) => null
private 'nbPages' (Pagerfanta\View\DefaultView) => null
private 'startPage' (Pagerfanta\View\DefaultView) => null
private 'endPage' (Pagerfanta\View\DefaultView) => null
private 'translator' (WhiteOctober\PagerfantaBundle\View\TranslatedView) =>
object(Symfony\Bundle\FrameworkBundle\Translation\Translator)[75]
protected 'container' =>
object(appDevDebugProjectContainer)[307]
...
protected 'options' =>
array (size=2)
...
protected 'loaderIds' =>
array (size=10)
...
protected 'catalogues' =>
array (size=0)
...
protected 'locale' => null
private 'fallbackLocales' (Symfony\Component\Translation\Translator) =>
array (size=1)
...
private 'loaders' (Symfony\Component\Translation\Translator) =>
array (size=0)
...
private 'resources' (Symfony\Component\Translation\Translator) =>
array (size=49)
...
private 'selector' (Symfony\Component\Translation\Translator) =>
object(Symfony\Component\Translation\MessageSelector)[74]
... |
Donc je me casse la téte pour savoir ou la class VieFactory rempli ce fameux tableau $this->views
Une idée les amis
Merci