# Administration: keine Daten mit dump()

**URL:** https://forum.shopware.com/t/administration-keine-daten-mit-dump/66111
**Category:** Programmierung
**Created:** [7. April 2020 um 14:05 UTC](https://forum.shopware.com/t/administration-keine-daten-mit-dump/66111 "2020-04-07T14:05:29Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![ralfh](https://avatars.discourse-cdn.com/v4/letter/r/ee7513/32.png) [@ralfh](https://forum.shopware.com/u/ralfh)
#### Post date: [7. April 2020 um 14:05 UTC](https://forum.shopware.com/t/administration-keine-daten-mit-dump/66111/1 "2020-04-07T14:05:29Z")

</div>

Ich weiß nicht was ich falsch mache. Das erweitern des backend templates funktioniert, allerdings kann ich auf keinerlei Daten zugreifen.

Ich möchte einen Block aus sw-category-detail-base.html.twig erweitern, das funktioniert auch soweit mit

```
{% block sw_category_detail_information_name %}
    {% parent %}
    {{ dump() }}
    {{ category.name }} {{ dump(category) }}
    {{ dump(categoryLayout) }}
{% endblock %}

```

Allerdings bekomme ich keinerlei Daten mit dump oder direkter Ausgabe. Irgendeinen Text direkt ausgeben funktionert allerdings.  
Meine main.js  
&nbsp;

```
import { Component } from 'src/core/shopware';
import template from "./module/sw-category/view/sw-category-detail-base/sw-category-detail-base.html.twig";

Component.override('sw-category-detail-base', {
    template,
    computed: {
        categoryLayout() {
            return [
                {value: 'normal', label: 'normal'},
                {value: 'alternative', label: 'alternativ'}
            ];
        }
    }
});

```

Ich hoffe mir kann jemand einen Tipp geben, bin schon den ganzen Tag am Fluchen. Für einen Profi sicher ein Leichtes das zu beantworten.

---

<div class="post-metadata">

### Author: ![Moritz\_Naczenski](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/moritz_naczenski/32/7792_2.png) [@Moritz\_Naczenski](https://forum.shopware.com/u/Moritz_Naczenski)
#### Post date: [7. April 2020 um 17:09 UTC](https://forum.shopware.com/t/administration-keine-daten-mit-dump/66111/2 "2020-04-07T17:09:55Z")

</div>

Ich bin kein Entwickler, daher entschuldige, wenn es vielleicht nur Halbwissen ist.

Soweit ich weiß, ist das nicht 1:1 Twig, es werden keine Variablen an das Template gegeben, sondern per Javascript gerendert. Das ist nicht das gleiche wie ein PHP/Twig Stack in der Administration. Es wird twigjs benutzt:&nbsp;[Home · twigjs/twig.js Wiki · GitHub](https://github.com/twigjs/twig.js/wiki)&nbsp;

Entsprechend kannst du dir per Javascript auch die Variablen ausgeben lassen, aber nicht per dump, denn zur Zeit in der die Templates gerendert werden, noch garkeine Variablen verfügbar sind. Lass dir doch am besten mit console.log in deinem Javascript die Variablen ausgeben.

---

<div class="post-metadata">

### Author: ![shyim](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/shyim/32/7681_2.png) [@shyim](https://forum.shopware.com/u/shyim)
#### Post date: [7. April 2020 um 17:33 UTC](https://forum.shopware.com/t/administration-keine-daten-mit-dump/66111/3 "2020-04-07T17:33:30Z")

</div>

Es wird nur Twig im Admin verwendet um ein Block System zu haben. Alle anderen Features funktionieren nicht wirklich. Wenn du etwas ausgeben willst schreib einfach {{&nbsp;category }} dann wird das als JSON ausgegeben

---

<div class="post-metadata">

### Author: ![ralfh](https://avatars.discourse-cdn.com/v4/letter/r/ee7513/32.png) [@ralfh](https://forum.shopware.com/u/ralfh)
#### Post date: [9. April 2020 um 13:42 UTC](https://forum.shopware.com/t/administration-keine-daten-mit-dump/66111/4 "2020-04-09T13:42:04Z")

</div>

Irgendwie bekomme ich für meine Erweiterung der Felder der Category trotzdem immer null, keine Ahnung warum.

**CustomExtension.php**

```
class CustomExtension implements EntityExtensionInterface
{
    public function extendFields(FieldCollection $collection): void
    {
        $collection->add(
            (new ObjectField('custom_struct', 'test'))->addFlags(new Runtime())
        );
    }

    public function getDefinitionClass(): string
    {
        return CategoryDefinition::class;
    }
}

```

**MySubscriber.php**

```
class MySubscriber implements EventSubscriberInterface
{
    public static function getSubscribedEvents(): array
    {
        return [
            CategoryEvents::CATEGORY_LOADED_EVENT => 'onCategoryLoaded'
        ];
    }

    public function onCategoryLoaded(EntityLoadedEvent $event): void
    {
        /** @var CategoryEntity $categoryEntity */
        foreach ($event->getEntities() as $categoryEntity) {
            $categoryEntity->addExtension('custom_struct', new ArrayEntity(['test'=>'123']));
        }
    }
}

```

![](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/2X/c/ce76079885bdab40b67b180efc2cfc38afcbd086.png)
