Apigility+Doctrine: how to return a paginated collection
<p>I´ve manage to install Apigility + Doctrine and to return results of single entities (/service/x_id) and collections (/service), this works out of the box with no modifications. </p>

<p>I am now in the phase of returning filtered results based on URL parameters. </p>

<p>I can retrieve the url parameters and I can retrieve filtered results. To do this, I extended fetch*() methods in my own ResourceClass. It works fine but this result is not paginated and not in the same HAL / Json format as the other responses (the out-of-the-box responses). I am returning the result of <code>getEntityManager('my.em.name')-&gt;getRepository(my.repo.name)-&gt;findBy($params)</code> and it actually looks like this:</p>

<pre><code>    {
"_links":
{
    "self":
    {
        "href": "http://api.local/service?startcode=7531"
    }
},
"_embedded":
{
    "objektprojectstart":
    [
        {
            "oid": 14427,
            "opsId": 3760,
            "startcode": "7531",
            "tid": 44798,
            "_links":
            {
                "self":
                {
                    "href": "http://studoraapi.local/service/3760"
                }
            }
        },
        {... more},
</code></pre>

<p>What is the correct solution for this problem? Thanks!</p>