# Base Query Format Output

**URL:** https://forum.shopware.com/t/base-query-format-output/56572
**Category:** Programmierung
**Created:** [20. November 2018 um 13:13 UTC](https://forum.shopware.com/t/base-query-format-output/56572 "2018-11-20T13:13:12Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Misengo](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/misengo/32/21446_2.png) [@Misengo](https://forum.shopware.com/u/Misengo)
#### Post date: [20. November 2018 um 13:13 UTC](https://forum.shopware.com/t/base-query-format-output/56572/1 "2018-11-20T13:13:12Z")

</div>

Hallo zusammen,

habe mir eine API gebaut in der ich folgende Methode nutze

&nbsp;

```
protected function getBaseQuery()
    {
        $builder = $this->getManager()->createQueryBuilder();
        $builder->select(array('questions','customer.number as customerNumber'))
            ->from('ScQuestionAnswer\Models\ScQuestions', 'questions')
            ->leftJoin('questions.customer', 'customer');
        return $builder;
    }

```

In meinem Model nutze ich eine ManyToOne Relation

```
    /**
     * @ORM\ManyToOne(targetEntity="\Shopware\Models\Customer\Customer")
     * @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=false)
     */
    protected $customer;

```

zum Customer. Wenn ich die Daten jetzt abrufe, bekomme ich so eine “Grütze” am Ende:

&nbsp;

```
{
  "data": {
    "0": {
      "id": 1,
      "shopId": 6,
      "articleId": 11111,
      "question": "API Frage 2",
      "question_date": "2012-08-31T08:51:46+0200",
      "active": true
    },
    "customerNumber": "11111"
  },
  "success": true
}

```

Gibt es ne Möglichkeit das ich das alle direkt in data bekomme ohne die 0 und customerNumber darauf? Vermutlich nur mit einem Query was ich selbst schreibe, richtig?
