# Fehlermeldung ImportExport über CLI

**URL:** https://forum.shopware.com/t/fehlermeldung-importexport-uber-cli/59010
**Category:** Programmierung
**Created:** [9. April 2019 um 16:19 UTC](https://forum.shopware.com/t/fehlermeldung-importexport-uber-cli/59010 "2019-04-09T16:19:30Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![hbee](https://avatars.discourse-cdn.com/v4/letter/h/f08c70/32.png) [@hbee](https://forum.shopware.com/u/hbee)
#### Post date: [9. April 2019 um 16:19 UTC](https://forum.shopware.com/t/fehlermeldung-importexport-uber-cli/59010/1 "2019-04-09T16:19:30Z")

</div>

hi, ich möchte über ein eigenes CLI Command&nbsp; sw:importexport:import aufrufen.

```
[...]
$arguments = array(
                'command' => 'sw:importexport:import',
                'filepath' => Shopware()->DocPath() . $csvFilePath,
                '-p' => 'viison_pickware_erp_article_stocks_absolute',
            );
$importStockInput = new ArrayInput($arguments);

$command = $this->getApplication()->find('sw:importexport:import');
$command->run($importStockInput, $output);

[...]

```

Das scheint auch zu klappen nur bekomme ich folgenden Fehler:

```
PHP Fatal error: Call to a member function get() on null in /engine/Shopware/Plugins/Community/Backend/SwagImportExport/Commands/SwagImportExport/ImportCommand.php on line 139

```

in Zeile 139:

```
$em = $this->container->get('models');

```

Hat jemdan eine Idee wie ich das lösen kann? Offensichtlich steht der container hier ja nicht zur Verfügung.

Gruß,

Ich

---

<div class="post-metadata">

### Author: ![R4M](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/r4m/32/9983_2.png) [@R4M](https://forum.shopware.com/u/R4M)
#### Post date: [10. April 2019 um 11:48 UTC](https://forum.shopware.com/t/fehlermeldung-importexport-uber-cli/59010/2 "2019-04-10T11:48:14Z")

</div>

Bin mir nicht ganz sicher ob das eventuell mit der PHP-Version zusammenhängt. Die PHP-Version über Konsole muss nicht zwangsläufig mit der PHP-Version vom Webhosting übereinstimmen.

---

<div class="post-metadata">

### Author: ![hbee](https://avatars.discourse-cdn.com/v4/letter/h/f08c70/32.png) [@hbee](https://forum.shopware.com/u/hbee)
#### Post date: [11. April 2019 um 13:29 UTC](https://forum.shopware.com/t/fehlermeldung-importexport-uber-cli/59010/3 "2019-04-11T13:29:42Z")

</div>

> [@R4M schrieb:](https://forum.shopware.com/profile/17170/R4M "R4M")
> 
> Bin mir nicht ganz sicher ob das eventuell mit der PHP-Version zusammenhängt. Die PHP-Version über Konsole muss nicht zwangsläufig mit der PHP-Version vom Webhosting übereinstimmen.

Danke für deine Antwort. Das ist ein guter Hinweis. ich habe hier nur eine 5.6.38 wenn ich das aber von hand übe php bin/console aufrufe, klappt es. Da sollte ja die gleiche PHP version verwendet werden.

---

<div class="post-metadata">

### Author: ![ahmadsaad](https://avatars.discourse-cdn.com/v4/letter/a/65b543/32.png) [@ahmadsaad](https://forum.shopware.com/u/ahmadsaad)
#### Post date: [11. April 2019 um 13:54 UTC](https://forum.shopware.com/t/fehlermeldung-importexport-uber-cli/59010/4 "2019-04-11T13:54:18Z")

</div>

Hallo @hbee‍,

du muss dieses Code bevore run benutzen:

```
        if ($command instanceof ContainerAwareInterface) {
            $command->setContainer($this->getContainer());
        }

```

für mehr Info schaue mal&nbsp;[https://github.com/shopware/shopware/blob/5.5/engine/Shopware/Components/Console/Application.php#L113](https://github.com/shopware/shopware/blob/5.5/engine/Shopware/Components/Console/Application.php#L113)

VG,

Tel.: +49 755&nbsp;- 183 990 00 | Web:&nbsp;[http://enbit.de/](http://enbit.de/)
