Guten Morgen zusammen,
ich versuche gerade einmal das customerRepository und customerAddressRepository in eine Tabelle in der Administration zu laden. Leider greift immer nur ein Repository, kann mir da jemand auf die sprünge helfen?
Mein Code sieht wie folgt aus:
list.js
_import_ template _from_ './swag-bundle-list.html.twig'; _const_ { Component } = Shopware; _const_ { Criteria } = Shopware.Data; Component.register('swag-bundle-list', { template, inject: ['repositoryFactory'], metaInfo() { _return_ { title: _this_.$createTitle() }; }, data() { _return_ { repository: _null_, customerRepository: _null_, customerAddressRepository: _null_, }; }, computed: { columns() { _return_ _this_.getMRDColumns(); } }, methods: { getMRDColumns() { _return_ [{ property: 'firstName', dataIndex: 'firstName', label: 'Vorname', primary: _true_, }, { property: 'lastName', dataIndex: 'lastName', label: 'Nachname' }, { property: 'lastLogin', dataIndex: 'lastLogin', label: 'Letzter Login' }, { property: 'phoneNumber', dataIndex: 'phoneNumber', label: 'Telefonummer' },]; } }, created() { _this_.repository = _this_.repositoryFactory.create('customer'); _this_.repository .search(_new_ Criteria(), Shopware.Context.api) .then((result) =\> { _this_.customerRepository = result; }); _this_.repository = _this_.repositoryFactory.create('customerAddressService'); _this_.repository .search(_new_ Criteria(), Shopware.Context.api) .then((result) =\> { _this_.customerAddressRepository = result; }); } });
list.html.twig
{% _block_ swag\_bundle\_list %} <sw-page>class="swag-bundle-list">
{% <em>block </em>swag_bundle_list_smart_bar_actions %}
{% <em>endblock </em>%}
<template>slot="content">
{% <em>block </em>swag_bundle_list_content %}
<sw-entity-listing>:items="customerRepository"
<em>:items</em>="customerAddressRepository"
<em>:repository</em>="repository"
<em>:showSelection</em>="false"
<em>:columns</em>="columns">
</sw-entity-listing>
{% <em>endblock </em>%}
</template>
</sw-page> {% _endblock_ %}
Live: Telefonnummer bleibt leider leer …