<?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\Adapter;

/**
 * PropelAdapter.
 *
 * @author William DURAND <william.durand1@gmail.com>
 */
class PropelAdapter implements AdapterInterface
{
    private $query;

    /**
     * Constructor.
     */
    public function __construct($query)
    {
        $this->query = $query;
    }

    /**
     * Returns the query.
     */
    public function getQuery()
    {
        return $this->query;
    }

    /**
     * {@inheritdoc}
     */
    public function getNbResults()
    {
        return $this->query->count();
    }

    /**
     * {@inheritdoc}
     */
    public function getSlice($offset, $length)
    {
        return $this->query->limit($length)->offset($offset)->find();
    }
}

<?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\Adapter;

/**
 * PropelAdapter.
 *
 * @author William DURAND <william.durand1@gmail.com>
 */
class PropelAdapter implements AdapterInterface
{
    private $query;

    /**
     * Constructor.
     */
    public function __construct($query)
    {
        $this->query = $query;
    }

    /**
     * Returns the query.
     */
    public function getQuery()
    {
        return $this->query;
    }

    /**
     * {@inheritdoc}
     */
    public function getNbResults()
    {
        return $this->query->limit(0)->count();
    }

    /**
     * {@inheritdoc}
     */
    public function getSlice($offset, $length)
    {
        return $this->query->limit($length)->offset($offset)->find();
    }
}

Enforce the limit to be reset in get query :
Enforce the limit to be reset in get query :

```
 $query = \Admingenerator\PropelDemoBundle\Model\MovieQuery::create('q')
 $paginator = new Pagerfanta(new PagerAdapter($query));
 $paginator->setMaxPerPage(3);
 $paginator->setCurrentPage($this->getPage(), false, true);
```

```
SELECT propel_movies.ID, propel_movies.TITLE, propel_movies.IS_PUBLISHED, propel_movies.RELEASE_DATE, propel_movies.PRODUCER_ID
FROM `propel_movies` LIMIT 3
Time: 0.041 sec - Memory: 22.1 MB
SELECT COUNT(*)
FROM (SELECT propel_movies.ID, propel_movies.TITLE, propel_movies.IS_PUBLISHED, propel_movies.RELEASE_DATE, propel_movies.PRODUCER_ID
FROM `propel_movies` LIMIT 3) propelmatch4cnt
Time: 0.002 sec - Memory: 24.6 MB
```

So was always make one page !!