# Problem mit CLI generiertem Plugin

**URL:** <https://forum.shopware.com/t/problem-mit-cli-generiertem-plugin/36709>\
**Category:** Programmierung\
**Created:** [12. Mai 2016 um 11:42 UTC](https://forum.shopware.com/t/problem-mit-cli-generiertem-plugin/36709 "2016-05-12T11:42:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![karei](https://avatars.discourse-cdn.com/v4/letter/k/858c86/32.png) [@karei](https://forum.shopware.com/u/karei)\
**Post date:** [12. Mai 2016 um 11:42 UTC](https://forum.shopware.com/t/problem-mit-cli-generiertem-plugin/36709/1 "2016-05-12T11:42:36Z")

</div>

Hallo,

Ich habe für die Erstellung eines neuen Backend-Plugins das CLI-Tool&nbsp;eingesetzt. Das hat mit dem Befehl

```
sw plugin:create --namespace=Backend --backendModel=ZweTestModel --haveBackend --haveModels ZweTest

```

soweit auch alles geklappt und ich konnte das Plugin installieren und aktivieren. Die entsprechende Tabelle in der Datenbank wurde auch angelegt.&nbsp;Jedoch erhalte ich dann eine Fehlermeldung, wenn ich das Plugin aufrufe…&nbsp;

```
Ups! Ein Fehler ist aufgetreten!
Die nachfolgenden Hinweise sollten Ihnen weiterhelfen.

Class 'ZweTestModel' does not exist in vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/MappingException.php on line 96

#0 vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/RuntimeReflectionService.php(41): Doctrine\Common\Persistence\Mapping\MappingException::nonExistingClass('ZweTestModel')
#1 vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php(281): Doctrine\Common\Persistence\Mapping\RuntimeReflectionService->getParentClasses('ZweTestModel')
#2 vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php(311): Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory->getParentClasses('ZweTestModel')
#3 vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php(78): Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory->loadMetadata('ZweTestModel')
#4 vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php(216): Doctrine\ORM\Mapping\ClassMetadataFactory->loadMetadata('ZweTestModel')
#5 vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php(281): Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory->getMetadataFor('ZweTestModel')
#6 Shopware/Controllers/Backend/Application.php(1119): Doctrine\ORM\EntityManager->getClassMetadata('ZweTestModel')
#7 Shopware/Controllers/Backend/Application.php(1006): Shopware_Controllers_Backend_Application->getModelFields('ZweTestModel', 'zwe_test_model')
#8 Shopware/Controllers/Backend/Application.php(365): Shopware_Controllers_Backend_Application->getFilterConditions(Array, 'ZweTestModel', 'zwe_test_model', Array)
#9 Shopware/Controllers/Backend/Application.php(219): Shopware_Controllers_Backend_Application->getList('0', '20', Array, Array, Array)
#10 Enlight/Controller/Action.php(158): Shopware_Controllers_Backend_Application->listAction()
#11 Enlight/Controller/Dispatcher/Default.php(523): Enlight_Controller_Action->dispatch('listAction')
#12 Enlight/Controller/Front.php(226): Enlight_Controller_Dispatcher_Default->dispatch(Object(Enlight_Controller_Request_RequestHttp), Object(Enlight_Controller_Response_ResponseHttp))
#13 Shopware/Kernel.php(153): Enlight_Controller_Front->dispatch()
#14 vendor/symfony/http-kernel/HttpCache/HttpCache.php(492): Shopware\Kernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#15 Shopware/Components/HttpCache/AppCache.php(255): Symfony\Component\HttpKernel\HttpCache\HttpCache->forward(Object(Symfony\Component\HttpFoundation\Request), true, NULL)
#16 vendor/symfony/http-kernel/HttpCache/HttpCache.php(263): Shopware\Components\HttpCache\AppCache->forward(Object(Symfony\Component\HttpFoundation\Request), true)
#17 Shopware/Components/HttpCache/AppCache.php(103): Symfony\Component\HttpKernel\HttpCache\HttpCache->pass(Object(Symfony\Component\HttpFoundation\Request), true)
#18 shopware.php(101): Shopware\Components\HttpCache\AppCache->handle(Object(Symfony\Component\HttpFoundation\Request))
#19 {main}

```

Kann mir da jemand helfen und einen Tipp geben, wo das Problem liegen könnte und was ich anpassen muss, damit das funktioniert? Leider ist die Dokumentation zum CLI-Tool mir da keine große Hilfe gewesen…

Danke.

---

<div class="post-metadata">

**Author:** ![karei](https://avatars.discourse-cdn.com/v4/letter/k/858c86/32.png) [@karei](https://forum.shopware.com/u/karei)\
**Post date:** [1. Juni 2016 um 12:19 UTC](https://forum.shopware.com/t/problem-mit-cli-generiertem-plugin/36709/2 "2016-06-01T12:19:01Z")

</div>

Hat niemand eine Idee wo der Fehler liegen könnte?

---

<div class="post-metadata">

**Author:** ![mikewink](https://avatars.discourse-cdn.com/v4/letter/m/a4c791/32.png) [@mikewink](https://forum.shopware.com/u/mikewink)\
**Post date:** [25. Dezember 2016 um 21:05 UTC](https://forum.shopware.com/t/problem-mit-cli-generiertem-plugin/36709/3 "2016-12-25T21:05:49Z")

</div>

Ich denke und hoffe Du hast das Problem inzwischen selbst beheben können oder auf eine andere Art und Weise einen Weg zum Ziel gefunden.

Ich bin heute selbst auf das Problem gestoßen und habe nach etwas Spielerei und Source Code lesen die Antwort gefunden.&nbsp;

In einem Backend Controller muss die $model Property nicht nur der Name des Models sein, sondern den gesamten Pfad enthalten.&nbsp;

> If this property isn’t set, the whole backend application don’t works. To configure this property you have only to set the whole model class name into this parameter.

Hier der Kommentauszug&nbsp;aus der _Shopware\_Controllers\_Backend\_Application_ class.&nbsp;

Wenn man also mit dem CLI ein&nbsp;Plugin „_MyDemoPlugin_“&nbsp;mit Backend (–haveBackend) erzeugt und eine Model "_FooModel"_ dafür&nbsp;erstellt muss in der Property nicht nur „_FooModel_“ stehen sondern „_MyDemoPlugin\Models\FooModel_“.&nbsp;

Das ist schon die Lösung. Zumindest hat es für mich damit funktioniert.

---

<div class="post-metadata">

**Author:** ![Michael\_Telgmann](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/michael_telgmann/32/20289_2.png) [@Michael\_Telgmann](https://forum.shopware.com/u/Michael_Telgmann)\
**Post date:** [27. Dezember 2016 um 08:26 UTC](https://forum.shopware.com/t/problem-mit-cli-generiertem-plugin/36709/4 "2016-12-27T08:26:34Z")

</div>

Hallo zusammen,

bei der Erstellung wird gefragt “Please specify the main model for your backend application:” Als Vorschlag erhaltet ihr dabei “MyDemoPlugin\Models\DemoPlugin”

Heißt also, ihr solltet dort auch den kompletten Pfad zum Model angeben.&nbsp;

Viele Grüße aus Schöppingen

![cool](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/1X/86c57fbace799dd4eb1f1b8a2d3bdc1733f0aea1.png "cool")&nbsp;Michael Telgmann

---

<div class="post-metadata">

**Author:** ![mikewink](https://avatars.discourse-cdn.com/v4/letter/m/a4c791/32.png) [@mikewink](https://forum.shopware.com/u/mikewink)\
**Post date:** [28. Dezember 2016 um 16:36 UTC](https://forum.shopware.com/t/problem-mit-cli-generiertem-plugin/36709/5 "2016-12-28T16:36:34Z")

</div>

> [@Michael Telgmann schrieb:](https://forum.shopware.com/profile/17553/Michael%20Telgmann "Michael%20Telgmann")
> 
> Hallo zusammen,
> 
> bei der Erstellung wird gefragt „Please specify the main model for your backend application:“ Als Vorschlag erhaltet ihr dabei „MyDemoPlugin\Models\DemoPlugin“
> 
> Heißt also, ihr solltet dort auch den kompletten Pfad zum Model angeben.&nbsp;
> 
> Viele Grüße aus Schöppingen
> 
> ![cool](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/1X/86c57fbace799dd4eb1f1b8a2d3bdc1733f0aea1.png "cool")&nbsp;Michael Telgmann

Ja wenn man sich so langsam in die Shopware-Welt einliest und denkt dann wird einem das klar. 🙂 Vielleicht könnte man aber trotzdem den Hilfetext an der Stelle noch ein wenig verfeinern.

Vielen Dank.&nbsp;
