Symfony 3 - KNP paginator error - Route issue?
<p>I added a pagination using KNP Paginator. It works well except for one page that render a page for specific ID. This page worked well before I added the pagination. the function was</p>

<pre><code>public function orderDetailAction($id)
</code></pre>

<p>For the pagination, I added the Request.</p>

<pre><code> /**
  * Display order detail
  *
  *@Route("/order/{id}", name="requestitem_order")
  *@Method("GET")
  */
  public function orderDetailAction(Request $request, $id)
  {
    $em = $this-&gt;getDoctrine()-&gt;getManager()-&gt;getRepository('ECAInventoryBundle:RequestItem');
    $query = $em-&gt;createQueryBuilder('r')
      -&gt;innerJoin('r.item','i')
      -&gt;select('i.name')
      -&gt;addSelect('r.quantity')
      -&gt;addSelect('i.id')
      -&gt;addSelect('r.date')
      -&gt;addSelect('r.remark')
      -&gt;where('i.id = :ID')-&gt;setParameter('ID', $id)
      -&gt;orderBy('r.date', 'DESC')
      -&gt;getQuery();

    $details = $query-&gt;getResult();

    $paginator = $this-&gt;get('knp_paginator');
    $result = $paginator-&gt;paginate(
      $details,
      $request-&gt;query-&gt;get('page', 1)/*page number*/,
      5/*limit per page*/
  );

    $form = $this-&gt;createFormBuilder($details)
      -&gt;add('id', TextType::class, array('attr' =&gt;array('class' =&gt;'form-control', 'style' =&gt;'margin-bottom:15px')))
      -&gt;add('name', TextType::class, array('attr' =&gt;array('class' =&gt;'form-control', 'style' =&gt;'margin-bottom:15px')))
      -&gt;add('quantity', TextType::class, array('attr' =&gt;array('class' =&gt;'form-control', 'style' =&gt;'margin-bottom:15px')))
      -&gt;add('date', DateType::class, array('attr' =&gt;array('class' =&gt;'form-control', 'style' =&gt;'margin-bottom:15px')))
      -&gt;add('remark', TextareaType::class, array('attr' =&gt;array('class' =&gt;'form-control', 'style' =&gt;'margin-bottom:15px', 'required' =&gt; false),'empty_data'  =&gt; null))
      -&gt;getForm();

    return $this-&gt;render('requestitem/order_details.html.twig', array('details'=&gt; $details, 'form' =&gt; $form-&gt;createView()));

  }
</code></pre>

<p>The Twig file is </p>

<pre><code>{% extends 'base.html.twig' %}

{% block body %}
{% set Name = '' %}
{% for detail in details %}
  {% set Name = detail.name %}
{% endfor %}

&lt;h1&gt;Detail&lt;/h1&gt;
&lt;h2&gt;{{Name}}&lt;/h2&gt;

&lt;table class="table table-striped"&gt;
    &lt;thead&gt;
      &lt;tr&gt;
          &lt;th scope="row"&gt;Quantity&lt;/th&gt;
          &lt;th scope="row"&gt;Date&lt;/th&gt;
          &lt;th scope="row"&gt;Remark&lt;/th&gt;
      &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;

        {% for detail in details %}
        &lt;tr&gt;
          &lt;td&gt;{{ detail.quantity}}&lt;/td&gt;
          &lt;td&gt;{{ detail.date|date('d M Y') }}&lt;/td&gt;
          &lt;td&gt;{{ detail.remark}}&lt;/td&gt;
        &lt;/tr&gt;
        {% endfor %}

    &lt;/tbody&gt;
&lt;/table&gt;
{# display navigation #}
&lt;div class="navigation text-center"&gt;
  {{ knp_pagination_render(details) }}
&lt;/div&gt;
&lt;hr /&gt;
&lt;a href="{{ path('requestitem_balance')}}" class="btn btn-default"&gt;Back to Balance&lt;/a&gt;
{% endblock %}
</code></pre>

<p>I have the following error</p>

<blockquote>
  <p>Type error: Argument 2 passed to
  Knp\Bundle\PaginatorBundle\Twig\Extension\PaginationExtension::render()
  must be an instance of
  Knp\Bundle\PaginatorBundle\Pagination\SlidingPagination, array given,
  called in
  C:\xampp\htdocs\inventory\var\cache\dev\twig\60\60f10f12ae3f80d30f6ac9425ed3eadb7f6a850a4574537165108f4cd8dfd500.php
  on line 107</p>
</blockquote>

<p>The controller route is @Route("/order/{id}" and the paginator uses this kind of route ?page=2. I don't know if this is the problem.</p>

<p>How can I solve it?</p>