Skip to content

[json] howto #8

@brikou

Description

@brikou

mandango is great (I really mean it ;)) as it only query what is needed but I want to return a json representation of my collection

<?php
    // ...

    $labels = $app['mandango']
        ->getRepository('Model\Label')
        ->createQuery()
        ->all()
    ;

    return new Response(
        json_encode($labels),
        200,
        array('Content-Type' => 'application/json')
    );

$labels only contains ids of my labels, how should i do to hydrate this with all the data... do you have a clue? I havn't found anything in the doc

thx

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions